/* ================================================================
 * OPEP LIVE STUDIO - Styles
 * ================================================================ */

/* --- CONSOLE PRINCIPALE --- */
.studio-console {
    background: #121212;
    color: #e0e0e0;
    padding: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* --- INPUTS --- */
.studio-console .studio-input {
    background: #1e1e1e !important;
    border: 1px solid #444 !important;
    color: #fff !important;
    padding: 8px 10px;
    width: 100%;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 13px;
    margin-bottom: 8px;
}
.studio-console .studio-input:focus,
.studio-console .studio-input:active {
    outline: 2px solid #00bcd4 !important;
    background: #263238 !important;
    color: #fff !important;
}
.studio-console select.studio-input { height: 35px; }
.studio-console select option { background: #1e1e1e !important; color: #fff !important; }
.studio-console label { font-size: 10px !important; color: #aaa !important; display: block; margin-bottom: 2px; }

/* --- AUTOCOMPLETE --- */
#autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    background: #263238;
    border: 1px solid #00bcd4;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}
.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

/* --- ADN DISPLAY --- */
#adn-display {
    background: #1565c0;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    margin-bottom: 10px;
    display: none;
    border: 1px solid #90caf9;
}

/* --- CARTES ACTION --- */
.action-card {
    background: #1e1e1e;
    border-left: 4px solid #90caf9;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}
.action-card.encours { border-left-color: #ff9800; background: #2b1d1d; }
.action-card.champion { border-left-color: #ffd700; background: #1a237e; }

/* --- GRILLE HISTORIQUE --- */
.grid-historique { width: 100%; font-size: 12px; border-collapse: collapse; margin-bottom: 8px; }
.grid-historique th { text-align: left; padding: 4px; color: #81d4fa; border-bottom: 1px solid #444; font-size: 11px; }
.grid-historique td { padding: 4px; font-weight: bold; }
.tech-val { color: #4caf50; }
.sub-info { font-size: 10px; color: #888; margin-bottom: 8px; font-family: monospace; }
.alert-anom { color: #ff5722; font-weight: bold; }
.badge-pupitre {
    background: #263238;
    color: #e0e0e0;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin: 2px;
    display: inline-block;
    border: 1px solid #37474f;
    font-family: monospace;
}

/* --- ARCHIVE --- */
#zone-archive { background: #1a1a1a; border: 1px solid #555; padding: 15px; border-radius: 6px; margin-top: 10px; display: none; }
.archive-group { margin-bottom: 10px; background: #263238; border-radius: 4px; padding: 8px; border-left: 3px solid #81d4fa; }
.archive-item { font-size: 12px; color: #fff; margin-bottom: 4px; }

/* --- PUPITRE --- */
.pupitre-card { background: #1c2326; border-left: 4px solid #4caf50; margin-top: 10px; border-radius: 6px; }
.pupitre-card.vierge { border-left-color: #ff9800; background-color: #2b1d1d; }
.pupitre-header {
    padding: 10px;
    font-weight: bold;
    font-size: 14px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #263238;
}
.pupitre-body { padding: 10px; display: none; }

/* --- RESULTAT LIVE --- */
.live-result-box {
    background: #00333f;
    padding: 10px;
    margin-top: 10px;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    border: 1px solid #00bcd4;
}

/* --- OPTIONS --- */
.studio-console .option-tuile {
    background: #263238 !important;
    border: 1px solid #455a64 !important;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}
.studio-console .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background: #00333f !important;
    padding: 8px;
    border-radius: 4px;
    color: #fff !important;
    user-select: none;
}
.studio-console .checkbox-label:hover,
.studio-console .checkbox-label:focus-within {
    background: #004d60 !important;
    color: #fff !important;
}
.studio-console .option-texte { font-size: 12px; margin-top: 5px; color: #e0e0e0 !important; }
.studio-console .option-titre { font-size: 13px; margin: 0; font-weight: bold; color: #fff !important; }

/* --- BOUTONS --- */
.btn-action {
    background: #4caf50;
    color: #fff;
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    width: 100%;
    text-transform: uppercase;
    margin-top: 10px;
}
.btn-half { width: 48%; display: inline-block; }

/* --- FORMULAIRE CREATION --- */
#creation-form {
    background: #1a1a1a;
    padding: 15px;
    border-radius: 6px;
    border: 2px dashed #00bcd4;
    margin-top: 10px;
    display: none;
}
.allure-box { background: #222; padding: 10px; border-radius: 6px; margin-bottom: 10px; border-left: 3px solid; }
.allure-box:first-child { border-left-color: #4caf50; }
.allure-box:nth-child(2) { border-left-color: #2196f3; }
.allure-box:nth-child(3) { border-left-color: #ff9800; }

/* --- GAMME OVERLAY --- */
#gamme-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #000;
    z-index: 99999;
    display: none;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}
#gamme-texte {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00e5ff;
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    line-height: 1.4;
}
#gamme-controls { display: flex; gap: 10px; padding-bottom: 20px; flex-wrap: wrap; }
.btn-giant {
    flex: 1;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    min-width: 45%;
}
#gamme-video-container {
    flex: 1;
    display: none;
    justify-content: center;
    align-items: center;
    background: #111;
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
}
#gamme-video-player { width: 100%; height: 100%; object-fit: contain; }

/* --- LIGHTBOX PHOTO --- */
#photo-lightbox img { transition: transform 0.3s ease; }
#photo-lightbox img:hover { transform: scale(1.02); }

/* ================================================================
 * MODAL REMPLACEMENT AIMANT
 * ================================================================ */
.modal-remplacement-aimant {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-remplacement-aimant .modal-content {
    background: #1e1e1e;
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-remplacement-aimant h3 { color: #f59e0b; margin-top: 0; font-size: 16px; }
.modal-remplacement-aimant .info-ancien {
    background: #263238;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 12px;
    color: #ccc;
}
.modal-remplacement-aimant .info-ancien strong { color: #81d4fa; }
.modal-remplacement-aimant .champ-recherche {
    width: 100%;
    padding: 10px;
    background: #121212;
    border: 1px solid #444;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
}
.modal-remplacement-aimant .liste-aimants { max-height: 300px; overflow-y: auto; margin-bottom: 15px; }
.modal-remplacement-aimant .aimant-item {
    padding: 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
    color: #e0e0e0;
}
.modal-remplacement-aimant .aimant-item:hover,
.modal-remplacement-aimant .aimant-item.selected {
    background: #00333f;
    border-left: 3px solid #4caf50;
}
.modal-remplacement-aimant .aimant-item .dim { color: #81d4fa; font-weight: bold; }
.modal-remplacement-aimant .aimant-item .materiau { font-size: 10px; color: #aaa; }
.modal-remplacement-aimant .champ-orientation { display: flex; gap: 10px; margin-bottom: 15px; }
.modal-remplacement-aimant .btn-orientation {
    flex: 1;
    padding: 10px;
    border: 2px solid #444;
    background: #263238;
    color: #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}
.modal-remplacement-aimant .btn-orientation.active-sud { border-color: #4caf50; background: #1b5e20; color: #fff; }
.modal-remplacement-aimant .btn-orientation.active-nord { border-color: #f44336; background: #b71c1c; color: #fff; }
.modal-remplacement-aimant .btn-confirmer {
    width: 100%;
    padding: 12px;
    background: #f59e0b;
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
}
.modal-remplacement-aimant .btn-annuler {
    width: 100%;
    padding: 10px;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 5px;
}
.modal-remplacement-aimant .label-pivote {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
}
.modal-remplacement-aimant .label-pivote input { transform: scale(1.2); }
.modal-remplacement-aimant .commentaire-pose {
    width: 100%;
    padding: 8px;
    background: #121212;
    border: 1px solid #444;
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 15px;
    resize: vertical;
    min-height: 40px;
}
.modal-remplacement-aimant .alert-gap {
    background: #b71c1c;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 12px;
    display: none;
}

/* ================================================================
 * PLAN INLINE - AIMANTS CLIQUABLES
 * ================================================================ */
.aimant-modifie { position: relative; }
.aimant-modifie::after {
    content: "✏️";
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 8px;
    color: #f59e0b;
}
.aimant-clickable { cursor: pointer; transition: opacity 0.2s; }
.aimant-clickable:hover { opacity: 0.85; outline: 2px solid #f59e0b; }
/* Forcer la modale Parc Auto à être visible */
.parc-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.85) !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.parc-modal-content {
    background: #1a1a2e !important;
    border: 1px solid #00bcd4 !important;
    border-radius: 12px !important;
    width: 90% !important;
    max-width: 800px !important;
    max-height: 85vh !important;
    overflow: hidden !important;
    color: #fff !important;
}

.parc-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px 20px !important;
    background: #16213e !important;
    border-bottom: 1px solid #00bcd4 !important;
}

.parc-header h3 {
    color: #00bcd4 !important;
    margin: 0 !important;
    font-size: 16px !important;
}

.parc-close {
    background: none !important;
    border: none !important;
    color: #fff !important;
    font-size: 22px !important;
    cursor: pointer !important;
}

.parc-stats {
    padding: 10px 20px !important;
    background: #0d1b2a !important;
    font-size: 12px !important;
    color: #aaa !important;
    border-bottom: 1px solid #2a2a4a !important;
}

.parc-list {
    padding: 10px !important;
    max-height: 400px !important;
    overflow-y: auto !important;
}

.parc-item {
    display: flex !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    margin-bottom: 4px !important;
    background: #1a1a2e !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    color: #fff !important;
}

.parc-item:hover {
    background: #2a2a4a !important;
}

.parc-budget {
    color: #4caf50 !important;
    font-weight: bold !important;
}

.parc-status {
    font-size: 11px !important;
    padding: 2px 8px !important;
    border-radius: 10px !important;
}

.parc-empty {
    text-align: center !important;
    color: #666 !important;
    padding: 40px !important;
}


/* Bouton Ouvrir dans la liste PARC AUTO */
.btn-small {
    background: #00bcd4 !important;
    color: #000 !important;
    border: none !important;
    padding: 3px 12px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    transition: background 0.2s !important;
}

.btn-small:hover {
    background: #00e5ff !important;
}

.parc-actions {
    flex-shrink: 0 !important;
}

/* ================================================================
 * ONGLETS EN BAS (mobile-first)
 * ================================================================ */

.onglets-bas {
    display: flex;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0d1b2a;
    border-top: 2px solid #00bcd4;
    z-index: 100;
    margin: 10px -10px 0 -10px;
    padding: 0;
}

.onglet-btn {
    flex: 1;
    padding: 14px 10px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    border-bottom: 3px solid transparent;
}

.onglet-btn.active {
    color: #00bcd4;
    border-bottom-color: #00bcd4;
    background: rgba(0, 188, 212, 0.05);
}

.onglet-btn:active {
    background: rgba(0, 188, 212, 0.15);
}

.onglet-content {
    padding-bottom: 10px;
    min-height: 300px;
}

/* Zone Site */
#site-list .parc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: #1a1a2e;
    border-radius: 6px;
    cursor: pointer;
    border-left: 3px solid #333;
    transition: background 0.15s;
}

#site-list .parc-item:active {
    background: #2a2a4a;
}

#site-list .parc-item .plaque {
    font-weight: bold;
    color: #fff;
    min-width: 80px;
    font-size: 14px;
}

#site-list .parc-item .info {
    flex: 1;
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#site-list .parc-item .budget {
    color: #4caf50;
    font-weight: bold;
    font-size: 13px;
    min-width: 60px;
    text-align: right;
}

#site-list .parc-item .status {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 55px;
    text-align: center;
    flex-shrink: 0;
}

#site-list .parc-item .status.date {
    background: #0d47a1;
    color: #64b5f6;
}

#site-list .parc-item .status.never {
    background: #1a1a1a;
    color: #555;
}

/* Responsive */
@media (max-width: 480px) {
    .onglet-btn {
        font-size: 12px;
        padding: 12px 8px;
    }

    #site-list .parc-item {
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 4px;
    }

    #site-list .parc-item .plaque {
        min-width: 60px;
        font-size: 13px;
    }

    #site-list .parc-item .info {
        font-size: 10px;
        flex: 1 1 100%;
        white-space: normal;
    }

    #site-list .parc-item .budget {
        font-size: 12px;
        min-width: 50px;
    }
}

/* ================================================================
 * ATELIER PLEIN ÉCRAN
 * ================================================================ */
#studio-workspace.actif {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: #121212 !important;
    overflow-y: auto !important;
    display: block !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

#studio-workspace.actif #zone-pupitres {
    max-width: 800px !important;
    margin: 0 auto !important;
}

#studio-workspace.actif ~ .onglets-bas {
    display: none !important;
}

#studio-workspace.actif .pupitre-card {
    display: block !important;
    margin-bottom: 15px !important;
}

#studio-workspace.actif .live-result-box {
    display: block !important;
}


/* ================================================================
 * GALERIES PHOTOS - STYLES FORCÉS
 * ================================================================ */

.gal-option,
#gal_machine,
#gal_action {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    margin-top: 5px !important;
    min-height: 35px !important;
    padding: 4px !important;
    border: 1px solid #2a2a4a !important;
    border-radius: 4px !important;
    background: rgba(0,0,0,0.2) !important;
}

.gal-option img,
#gal_machine img,
#gal_action img {
    height: 30px !important;
    width: auto !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    margin-right: 2px !important;
    object-fit: cover !important;
    transition: transform 0.2s !important;
}

.gal-option img:hover,
#gal_machine img:hover,
#gal_action img:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 0 10px rgba(0,188,212,0.5) !important;
}

/* ================================================================
 * LIGHTBOX - EN DEHORS DES ONGLETS
 * ================================================================ */

#photo-lightbox {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.95) !important;
    z-index: 999999999 !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    cursor: pointer !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

#photo-lightbox[style*="display: flex"] {
    display: flex !important;
}

#photo-lightbox-img {
    max-width: 95vw !important;
    max-height: 85vh !important;
    object-fit: contain !important;
    border-radius: 8px !important;
}

#photo-lightbox-caption {
    color: #fff !important;
    margin-top: 15px !important;
    font-size: 14px !important;
    text-align: center !important;
    max-width: 90% !important;
}

#photo-lightbox-close {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    background: #f44336 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 4px !important;
    font-size: 18px !important;
    cursor: pointer !important;
    z-index: 999999999 !important;
}

/* ================================================================
 * CONSIGNES DE POSE
 * ================================================================ */

.btn-consignes {
    background: transparent !important;
    border: none !important;
    color: #f59e0b !important;
    cursor: pointer !important;
    font-size: 14px !important;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    transition: background 0.2s !important;
}

.btn-consignes:hover {
    background: rgba(245, 158, 11, 0.15) !important;
}

.consignes-container {
    background: #1a1a2e !important;
    border-left: 3px solid #f59e0b !important;
    padding: 10px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    color: #e0e0e0 !important;
    line-height: 1.6 !important;
    margin-top: 8px !important;
}


/* ================================================================
 * FORCER L'OVERLAY ATELIER - PAGE UNIQUE
 * ================================================================ */
#studio-workspace.actif {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: #121212 !important;
    overflow-y: auto !important;
    display: block !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

#studio-workspace.actif #zone-pupitres {
    max-width: 800px !important;
    margin: 0 auto !important;
}

#studio-workspace.actif ~ .onglets-bas {
    display: none !important;
}

#studio-workspace.actif .pupitre-card {
    display: block !important;
    margin-bottom: 15px !important;
}

#studio-workspace.actif .live-result-box {
    display: block !important;
}


.pupitre-card {
    min-height: 100px !important;
    border: 1px solid #4caf50 !important;
    padding: 10px !important;
    background: #1c2326 !important;
}

/* ================================================================
 * SÉLECTEUR DE SITES (Parc Auto)
 * ================================================================ */

.site-selector-dropdown {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
    z-index: 100;
}

.site-selector-btn {
    background: #1a3a5c;
    color: #00bcd4;
    border: 1px solid #00bcd4;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s;
}

.site-selector-btn:hover {
    background: #00bcd4;
    color: #0a0a1a;
}

.site-selector-list {
    position: absolute;
    top: 100%;
    left: 0;
    background: #0d1b2a;
    border: 1px solid #00bcd4;
    border-radius: 4px;
    padding: 10px;
    min-width: 250px;
    max-width: 350px;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.site-selector-list label {
    display: block;
    padding: 4px 6px;
    color: #e0e0e0;
    font-size: 12px;
    cursor: pointer;
    border-radius: 2px;
    white-space: nowrap;
}

.site-selector-list label:hover {
    background: #1a3a4a;
}

.site-selector-list input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #00bcd4;
}

.site-selector-list button {
    font-size: 11px;
    flex: 1;
}

/* Séparateur de site dans la liste */
.parc-site-separator {
    background: #1a3a4a !important;
    color: #00bcd4 !important;
    padding: 4px 10px !important;
    font-size: 11px !important;
    font-weight: bold !important;
    margin-top: 5px !important;
    border-left: 3px solid #00bcd4;
}