body { margin: 0; overflow: hidden; font-family: system-ui, -apple-system, sans-serif; }

.potree_container {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
}

#potree_render_area {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
}

.upload-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    z-index: 10000;
    display: none; /* Hidden by default, shown only in debug mode */
}

.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

.btn-primary:hover { transform: translateY(-2px); }

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.3s;
}

.hidden { display: none !important; }

/* Réduire la taille de l'image de prévisualisation par 2 */
#previewImg {
    width: 50% !important;
    max-width: 50% !important;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Modal pour éditer les mesures */
.measurement-edit-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #4CAF50;
    border-radius: 12px;
    padding: 24px;
    z-index: 50000;
    min-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.measurement-edit-modal h3 {
    color: white;
    margin: 0 0 16px 0;
    font-size: 1.2rem;
}

.measurement-edit-modal .info-row {
    display: flex;
    justify-content: space-between;
    margin: 12px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.measurement-edit-modal input[type="number"] {
    width: 100%;
    padding: 10px;
    margin: 16px 0;
    border: 2px solid #4CAF50;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1rem;
    text-align: center;
}

.measurement-edit-modal input[type="number"]:focus {
    outline: none;
    border-color: #66BB6A;
    background: rgba(255, 255, 255, 0.15);
}

.measurement-edit-modal .button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.measurement-edit-modal button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.measurement-edit-modal .btn-primary {
    background: #4CAF50;
    color: white;
}

.measurement-edit-modal .btn-primary:hover {
    background: #66BB6A;
}

.measurement-edit-modal .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.measurement-edit-modal .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal pour sélectionner une mesure (même style que measurement-edit-modal) */
.measurement-selection-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #4CAF50;
    border-radius: 12px;
    padding: 24px;
    z-index: 50000;
    min-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.measurement-selection-modal h3 {
    color: white;
    margin: 0 0 16px 0;
    font-size: 1.2rem;
}

.measurement-selection-modal .instruction {
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 16px 0;
    font-size: 0.95rem;
}

.measurement-selection-modal .measurement-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 12px;
    margin: 16px 0;
    max-height: 300px;
    overflow-y: auto;
}

.measurement-selection-modal .measurement-item {
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 0;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.measurement-selection-modal .measurement-item:last-child {
    border-bottom: none;
}

.measurement-selection-modal input[type="number"] {
    width: 100%;
    padding: 10px;
    margin: 16px 0;
    border: 2px solid #4CAF50;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1rem;
    text-align: center;
}

.measurement-selection-modal input[type="number"]:focus {
    outline: none;
    border-color: #66BB6A;
    background: rgba(255, 255, 255, 0.15);
}

.measurement-selection-modal .button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.measurement-selection-modal button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.measurement-selection-modal .btn-primary {
    background: #4CAF50;
    color: white;
}

.measurement-selection-modal .btn-primary:hover {
    background: #66BB6A;
}

.measurement-selection-modal .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.measurement-selection-modal .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Input éditable directement dans le label */
.measurement-editable-input {
    background: rgba(76, 175, 80, 0.2);
    border: 2px solid #4CAF50;
    border-radius: 4px;
    padding: 2px 6px;
    color: white;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
    cursor: text;
}

.measurement-editable-input:focus {
    outline: none;
    border-color: #66BB6A;
    background: rgba(76, 175, 80, 0.3);
}

/* Full-screen loader for non-debug mode */
.fullscreen-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.fullscreen-loader .spinner {
    width: 80px;
    height: 80px;
    border-width: 6px;
}

.fullscreen-loader .loader-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
}

.fullscreen-loader .loader-subtext {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Bouton de mesure overlay */
.measure-btn-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    display: none;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.measure-btn-overlay:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.measure-btn-overlay.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
}

.measure-btn-overlay.visible {
    display: flex;
}

.measure-icon {
    width: 32px;
    height: 32px;
    display: inline-block;
}

.measure-icon img {
    width: 100%;
    height: 100%;
    filter: brightness(0) saturate(100%);
}

.measure-btn-overlay.active .measure-icon img {
    filter: brightness(0) invert(1);
}

/* Toolbar Potree (basé sur toolbar.html) */
#potree_toolbar {
    position: absolute; 
    z-index: 10000; 
    left: 50%;
    transform: translateX(-50%);
    top: 20px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.3em 0.8em;
    font-family: "system-ui";
    border-radius: 0em 0em 0.3em 0.3em;
    display: flex;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.potree_toolbar_label {
    text-align: center;
    font-size: smaller;
    opacity: 0.9;
}

.potree_toolbar_separator {
    background: white;
    padding: 0px;
    margin: 5px 10px;
    width: 1px;
    opacity: 0.3;
}

.potree_toolbar_separator span {
    display: flex;
    gap: 5px;
}

.annotation-action-icon {
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
}

.annotation-action-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Documentation Modal */
.documentation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 60000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.documentation-modal.hidden {
    display: none;
}

.documentation-modal-content {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #4CAF50;
    border-radius: 12px;
    padding: 0;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.documentation-modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.documentation-modal-header h2 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.documentation-modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.documentation-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.documentation-modal-body {
    padding: 24px;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.9);
}

.documentation-section {
    margin-bottom: 24px;
}

.documentation-section:last-child {
    margin-bottom: 0;
}

.documentation-section h3 {
    color: #4CAF50;
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.documentation-section ul {
    margin: 0;
    padding-left: 24px;
    list-style-type: disc;
}

.documentation-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.documentation-section li:last-child {
    margin-bottom: 0;
}

.documentation-section strong {
    color: #66BB6A;
    font-weight: 600;
}

.documentation-section .doc-icon {
    display: inline-block;
    vertical-align: middle;
}
