/* ==========================================================================
   SYSTÈME D'OVERLAYS ET IMAGES IMBRIQUÉES
   Fichier: 03-components/overlays.css
   ========================================================================== */

/* ==========================================================================
   OVERLAYS D'IMAGES
   ========================================================================== */
.overlay-image {
    position: absolute;
    border-radius: 8px;
    box-shadow: var(--overlay-shadow);
    transition: var(--overlay-transition);
    z-index: 2;
    border: var(--overlay-border);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    overflow: hidden;
}

.overlay-image:hover {
    transform: scale(1.05);
    box-shadow: var(--overlay-shadow-hover);
    z-index: 10;
}

/* ==========================================================================
   TEXTE DES OVERLAYS
   ========================================================================== */
.overlay-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--overlay-text-bg);
    color: white;
    padding: 15px 10px 8px;
    font-family: 'Arial', sans-serif;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    border-radius: 0 0 6px 6px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
}

/* ==========================================================================
   VARIANTES DE TAILLES D'OVERLAYS
   ========================================================================== */
.overlay-image.small {
    width: 200px !important;
    height: 120px !important;
}

.overlay-image.medium {
    width: 300px !important;
    height: 180px !important;
}

.overlay-image.large {
    width: 400px !important;
    height: 240px !important;
}

/* ==========================================================================
   POSITIONNEMENT PRÉDÉFINI
   ========================================================================== */
.overlay-top-left {
    top: 5% !important;
    left: 5% !important;
}

.overlay-top-right {
    top: 5% !important;
    right: 5% !important;
}

.overlay-bottom-left {
    bottom: 5% !important;
    left: 5% !important;
}

.overlay-bottom-right {
    bottom: 5% !important;
    right: 5% !important;
}

.overlay-center {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
}

.overlay-center:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

/* ==========================================================================
   TYPES D'OVERLAYS SPÉCIALISÉS
   ========================================================================== */

/* Overlay pour oscilloscope */
.overlay-oscilloscope {
    border: 3px solid #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3), var(--overlay-shadow);
}

.overlay-oscilloscope .overlay-text {
    background: linear-gradient(transparent, rgba(0, 100, 0, 0.9));
    color: #00ff00;
    font-family: 'Courier New', monospace;
}

/* Overlay pour interface de contrôle */
.overlay-control {
    border: 3px solid #1a73e8;
    box-shadow: 0 0 20px rgba(26, 115, 232, 0.3), var(--overlay-shadow);
}

.overlay-control .overlay-text {
    background: linear-gradient(transparent, rgba(26, 115, 232, 0.9));
    color: white;
}

/* Overlay pour résultats de test */
.overlay-test-result {
    border: 3px solid #34a853;
    box-shadow: 0 0 20px rgba(52, 168, 83, 0.3), var(--overlay-shadow);
}

.overlay-test-result .overlay-text {
    background: linear-gradient(transparent, rgba(52, 168, 83, 0.9));
    color: white;
}

/* ==========================================================================
   BADGES ET INDICATEURS SUR OVERLAYS
   ========================================================================== */
.overlay-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
    z-index: 1;
}

.overlay-badge.success {
    background: #34a853;
}

.overlay-badge.warning {
    background: #fbbc05;
}

.overlay-badge.info {
    background: #1a73e8;
}

/* ==========================================================================
   ANIMATION D'APPARITION
   ========================================================================== */
@keyframes overlayFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.overlay-image.animated {
    animation: overlayFadeIn 0.5s ease-out;
}

/* ==========================================================================
   OVERLAYS INTERACTIFS
   ========================================================================== */
.overlay-image.clickable {
    cursor: pointer;
    transition: var(--overlay-transition);
}

.overlay-image.clickable:hover {
    transform: scale(1.08);
    box-shadow: var(--overlay-shadow-hover);
}

.overlay-image.clickable:active {
    transform: scale(1.02);
}

/* ==========================================================================
   MODAL POUR AGRANDISSEMENT D'OVERLAY
   ========================================================================== */
.overlay-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.overlay-modal.show {
    display: flex;
}

.overlay-modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    min-width: 400px;
    min-height: 300px;
}

.overlay-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    background: white;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: var(--overlay-transition);
}

.overlay-modal-close:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.overlay-modal-title {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   CONTENEUR DE TESTS SPÉCIALISÉ
   ========================================================================== */
.test-container {
    margin: 40px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    position: relative;
}

.test-container h3 {
    color: #495057;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.test-container p {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #1a73e8;
    color: #555;
    line-height: 1.6;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
    .overlay-image {
        width: 200px !important;
        height: 120px !important;
    }
    
    .overlay-text {
        font-size: 10px;
        padding: 10px 5px 5px;
    }
    
    .overlay-image.large {
        width: 250px !important;
        height: 150px !important;
    }
    
    .overlay-image.medium {
        width: 200px !important;
        height: 120px !important;
    }
    
    .overlay-image.small {
        width: 150px !important;
        height: 90px !important;
    }
    
    /* Repositionnement pour mobile */
    .overlay-top-right,
    .overlay-bottom-right {
        right: 2% !important;
    }
    
    .overlay-top-left,
    .overlay-bottom-left {
        left: 2% !important;
    }
    
    .test-container {
        padding: 15px;
        margin: 20px 0;
    }
    
    .test-container h3 {
        font-size: 1.2em;
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .overlay-image {
        width: 160px !important;
        height: 100px !important;
    }
    
    .overlay-text {
        font-size: 9px;
        padding: 8px 4px 4px;
        line-height: 1.1;
    }
    
    .overlay-modal-content {
        min-width: 300px;
        min-height: 200px;
    }
    
    .overlay-modal {
        padding: 10px;
    }
}

/* ==========================================================================
   FALLBACK POUR IMAGES NON CHARGÉES
   ========================================================================== */
.overlay-image[style*="background-image"]:not([style*="url"]) {
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    text-align: center;
}

.overlay-image[style*="background-image"]:not([style*="url"])::before {
    content: "📷";
    font-size: 2em;
    display: block;
    margin-bottom: 10px;
}

/* ==========================================================================
   UTILITAIRES POUR OVERLAYS
   ========================================================================== */
.overlay-hidden {
    display: none !important;
}

.overlay-fade {
    opacity: 0.7;
}

.overlay-fade:hover {
    opacity: 1;
}

.overlay-pulse {
    animation: overlayPulse 2s infinite;
}

@keyframes overlayPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}