/* puzzles-publicitaires/assets/css/style.css */

/* ==========================================================================
   VARIABLES - Noir Premium & Or
   ========================================================================== */
:root {
    --bg-dark: transparent;
    --bg-panel: #111111;
    --text-main: #f5f5f5;
    --text-muted: #999999;
    
    --gold-primary: #d4af37;
    --gold-light: #f3e5ab;
    --gold-dark: #997a00;
    
    --border-radius: 4px;
    --transition-speed: 0.3s;
    
    --font-family: inherit;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
#sygnex-puzzle-container {
    margin-top: 20px;
    margin-bottom: 20px;
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.5;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
}

#sygnex-puzzle-container * {
    box-sizing: border-box;
}

#sygnex-puzzle-container a {
    color: var(--gold-primary);
    text-decoration: none;
    transition: color var(--transition-speed);
}

#sygnex-puzzle-container a:hover {
    color: var(--gold-light);
}

/* ==========================================================================
   ANIMATIONS DE TRANSITION
   ========================================================================== */
.fade-out {
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.fade-in {
    opacity: 1;
    animation: fadeInAnimation 0.6s ease forwards;
}

@keyframes fadeInAnimation {
    0% { opacity: 0; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   TYPOGRAPHIE & TITRES
   ========================================================================== */
#sygnex-puzzle-container h1, 
#sygnex-puzzle-container h2 {
    font-weight: 500;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

#sygnex-puzzle-container h1 {
    color: var(--gold-primary);
    font-size: 1.6rem; 
    padding-bottom: 5px;
    margin-bottom: 5px;
}

#sygnex-puzzle-container h2 {
    color: var(--gold-primary);
    border-bottom: 1px solid var(--gold-dark);
    padding-bottom: 6px;
    margin-bottom: 12px;
    font-size: 1.1rem; 
}

/* ==========================================================================
   LAYOUT & CONTAINERS (Compacts)
   ========================================================================== */
#sygnex-puzzle-container .panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--gold-dark);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: opacity 0.5s ease;
}

/* ==========================================================================
   CARROUSEL & GALERIE D'IMAGES
   ========================================================================== */
.carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
}

.carousel-btn {
    background: var(--gold-primary);
    color: #000;
    border: none;
    font-size: 1.3rem;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    z-index: 10;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

.carousel-btn:hover {
    background: var(--gold-light);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
    transform: scale(1.05);
}

.carousel-btn:active {
    transform: scale(0.95);
}

.image-gallery {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 5px;
    width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.image-gallery::-webkit-scrollbar {
    display: none;
}

.gallery-item {
    flex: 0 0 auto; 
    width: 100px;
    height: 100px;
    border: 2px solid #333;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-speed);
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed);
}

.gallery-item:hover {
    border-color: var(--gold-light);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item.selected {
    border-color: var(--gold-primary);
    box-shadow: 0 0 15px var(--gold-primary);
}

.gallery-item.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--gold-primary);
    color: #000;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ==========================================================================
   FORMULAIRES & BOUTONS
   ========================================================================== */
#sygnex-puzzle-container .btn {
    display: inline-block;
    background-color: var(--gold-primary);
    color: #000;
    border: 1px solid var(--gold-primary);
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-align: center;
}

#sygnex-puzzle-container .btn:hover {
    background-color: var(--gold-light);
    border-color: var(--gold-light);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

#btn-quit-puzzle {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
    padding: 4px 12px;
}

#btn-quit-puzzle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--text-main);
}

#sygnex-puzzle-container input[type="text"],
#sygnex-puzzle-container select {
    width: 100%;
    padding: 9px 12px;
    background-color: #000;
    border: 1px solid var(--gold-dark);
    color: var(--text-main);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

#sygnex-puzzle-container input[type="text"]:focus,
#sygnex-puzzle-container select:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

/* ==========================================================================
   PLATEAU DE PUZZLE (Mise à jour pour Canvas)
   ========================================================================== */
.puzzle-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    width: 100%;
    position: relative;
}

/* 
   Le Canvas remplace la table de jeu. Il prend la largeur complète
   et gère visuellement ses propres limites. 
*/
#puzzle-canvas {
    background-color: #1a1a1a; 
    border: 4px solid var(--gold-primary);
    box-shadow: 0 15px 35px rgba(0,0,0,0.8), inset 0 0 50px rgba(0,0,0,0.5);
    border-radius: 8px;
    width: 100%;
    height: 70vh; 
    min-height: 500px;
    touch-action: none; 
    display: block;
    cursor: default;
}

/* ==========================================================================
   HUD (HEADS UP DISPLAY) - TEMPS ET COUPS
   ========================================================================== */
.puzzle-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.8);
    padding: 8px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--gold-dark);
    margin-bottom: 12px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.5);
}

.hud-item {
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--text-main);
}

.hud-item span {
    color: var(--gold-primary);
    font-size: 1.2rem;
    margin-left: 8px;
}

/* ==========================================================================
   TABLEAU DE CLASSEMENT
   ========================================================================== */
#sygnex-puzzle-container .leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9rem;
}

#sygnex-puzzle-container .leaderboard-table th, 
#sygnex-puzzle-container .leaderboard-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #333;
}

#sygnex-puzzle-container .leaderboard-table th {
    background-color: rgba(212, 175, 55, 0.1);
    color: var(--gold-primary);
}

#sygnex-puzzle-container .leaderboard-table tr:nth-child(1) td {
    color: var(--gold-primary);
    font-weight: bold;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
    .puzzle-hud {
        flex-direction: column;
        gap: 6px;
    }
    
    #puzzle-canvas {
        height: 50vh; 
    }

    .carousel-btn {
        padding: 6px 8px;
        font-size: 1rem;
    }
}