/**
 * Styles pour la sélection moderne de cibles avec modale
 */

/* Badge compact dans le header */
.target-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.target-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.target-badge:active {
    transform: translateY(0);
}

.target-badge-number {
    font-size: 1.1rem;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
}

/* Modale centrée avec taille adaptée à 5 colonnes */
.target-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(95vw, 560px);
    max-height: 90vh;
    background: #1a1f2e;
    border: 1px solid #30363d;
    border-radius: 12px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease;
    opacity: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.target-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.target-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #7CB342 0%, #9ACD32 100%);
    color: white;
}

.target-modal-header h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-close-modal {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white;
    font-size: 1.1rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.btn-close-modal:hover {
    background: rgba(220, 53, 69, 0.85);
    border-color: rgba(255, 255, 255, 0.5);
}

.target-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: #1a1f2e;
}

/* Grille de cibles - 5 colonnes fixes (scopé à .target-modal pour éviter conflits) */
.target-modal .target-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    max-width: 500px;
    gap: 0.8rem;
    margin: 0 auto;
}

.target-grid-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem !important;
    font-weight: bold;
    background: #21262d;
    border: 2px solid #30363d;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #e6edf3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0 !important;
    line-height: 1;
    height: auto !important;
}

.target-grid-item:hover {
    background: #2a313d;
    color: white;
    border-color: #9ACD32;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(154, 205, 50, 0.25);
}

.target-grid-item:active {
    transform: scale(0.95);
}

.target-grid-item.selected {
    background: linear-gradient(135deg, #7CB342 0%, #9ACD32 100%);
    color: #1a1a1a;
    border-color: #9ACD32;
}

.no-targets-available {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: #999;
}

.target-modal-loading {
    text-align: center;
    padding: 3rem 2rem;
    font-size: 1.1rem;
    color: #9ACD32;
    letter-spacing: 0.04em;
    animation: loading-pulse 1.2s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* Tablette portrait */
@media (min-width: 700px) and (max-width: 1024px) and (orientation: portrait) {
    .target-modal {
        min-width: 0;
        width: 96vw;
        max-width: 96vw;
    }

    .target-modal-header {
        padding: 1rem 1.25rem;
    }

    .target-modal-header h2 {
        font-size: 1.1rem;
    }

    .target-modal-body {
        padding: 1.25rem;
    }

    .target-modal .target-grid {
        max-width: none;
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.75rem;
    }

    .target-modal .target-grid-item {
        font-size: clamp(1.55rem, 2.6vw, 1.9rem) !important;
    }

    .zoom-view-modal {
        max-width: 92vw;
    }

    .zoom-view-card {
        min-width: 124px;
    }

    .zoom-view-card-label {
        font-size: 0.82rem;
    }
}

/* Responsive mobile */
@media (max-width: 640px) {
    .target-number-display {
        min-width: 60px;
        min-height: 50px;
    }
    
    #current-target-number {
        font-size: 2rem;
    }
    
    .target-modal-header {
        padding: 1rem;
    }
    
    .target-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .target-modal-body {
        padding: 1rem;
    }
    
    .target-modal .target-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.75rem;
    }
    
    .target-modal .target-grid-item {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .target-number-display {
        min-width: 50px;
        min-height: 45px;
    }
    
    #current-target-number {
        font-size: 1.5rem;
    }
    
    .target-modal .target-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.5rem;
    }
    
    .target-modal .target-grid-item {
        font-size: 1.2rem !important;
    }
}

/* Mode sombre */
body.dark-mode .target-modal-body {
    background: #1a1a1a;
}

/* ============================================================
   Modale de sélection du type de vue cible (style BLE)
   ============================================================ */

.zoom-view-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-view-modal {
    background: #1a1f2e;
    border: 1px solid #30363d;
    border-radius: 12px;
    overflow: hidden;
    min-width: 340px;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.zoom-view-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #7CB342 0%, #9ACD32 100%);
}

.zoom-view-modal-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
}

.zoom-view-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 1.5rem;
    justify-content: center;
    background: #1a1f2e;
}

.zoom-view-card {
    border: 2px solid #30363d;
    border-radius: 10px;
    padding: 10px 10px 8px;
    cursor: pointer;
    background: #21262d;
    min-width: 115px;
    text-align: center;
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.zoom-view-card:hover {
    border-color: #9ACD32;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(154, 205, 50, 0.25);
}

.zoom-view-card.zoom-view-card-selected {
    border-color: #9acd32;
    box-shadow: 0 0 0 1px rgba(154, 205, 50, 0.3);
}

.zoom-view-card-label {
    font-size: 0.75rem;
    color: #c9d1d9;
    margin-top: 7px;
    font-family: monospace;
    white-space: pre-line;
    line-height: 1.3;
}

.zoom-view-card.zoom-view-card-selected .zoom-view-card-label {
    color: #9acd32;
    font-weight: 600;
}

.zoom-view-card.zoom-view-card-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(60%);
}

.zoom-view-card.zoom-view-card-disabled:hover {
    border-color: #30363d;
    transform: none;
    box-shadow: none;
}

/* ─── Titres de sections dans la modale combinée Vue & Affichage ─── */
.zoom-view-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6e7681;
    padding: 0.6rem 1.5rem 0.15rem;
    border-top: 1px solid #21262d;
}

.zoom-view-section-title:first-of-type {
    border-top: none;
    padding-top: 0.5rem;
}

.display-mode-section {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

/* Bouton trigger dans la barre latérale */
.zoom-view-btn {
    margin-top: 0.75rem;
    padding: 0.45rem 0.6rem;
    border: 2px solid #007bff;
    border-radius: 0.375rem;
    font-size: 0.78rem;
    background-color: #f8f9ff;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s, border-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zoom-view-btn:hover {
    background-color: #e8f0ff;
    border-color: #0056b3;
}

body.dark-mode .zoom-view-btn {
    background-color: #1e2436;
    color: #c9d1d9;
    border-color: #4a7c59;
}

body.dark-mode .zoom-view-btn:hover {
    background-color: #2a3048;
    border-color: #9acd32;
}

@media (max-width: 480px) {
    .zoom-view-overlay {
        align-items: flex-end;
    }
    .zoom-view-modal {
        min-width: 100vw;
        border-radius: 12px 12px 0 0;
    }
    .zoom-view-cards {
        gap: 8px;
        padding: 1rem;
    }
    .zoom-view-card {
        min-width: 95px;
    }
}

body.dark-mode .target-grid-item {
    background: #21262d;
    color: #e6edf3;
    border-color: #30363d;
}

body.dark-mode .target-grid-item:hover {
    background: #2a313d;
    border-color: #9ACD32;
}
