/* -------------------------------------------------------------------------- */
/* DESIGN TOKENS (Sémantiques)                                               */
/* Ces variables sont pilotées par theme_loader.php                          */
/* -------------------------------------------------------------------------- */
:root {
    /* Valeurs par défaut (Bootstrap Fallback) */
    --pc-primary: #b5835a;
    --pc-primary-hover: #966d48;
    --pc-secondary: #d1c0a5;
    
    --pc-status-success: #28a745;
    --pc-status-danger: #dc3545;
    --pc-color-terminal-green: #a9ffaf;
    --pc-color-terminal-bg: #212529;

    --pc-bg-page: #12100e;
    --pc-bg-surface: #1e1b18;
    --pc-bg-subtle: #2a2621;
    --pc-border: rgba(241, 232, 216, 0.1);
    --pc-overlay: rgba(0, 0, 0, 0.7);

    --pc-text-main: #f1e8d8;
    --pc-text-muted: rgba(241, 232, 216, 0.6);
    --pc-text-on-primary: #ffffff;
    --pc-text-on-secondary: #12100e;

    /* Surcharge des variables Bootstrap par les Design Tokens */
    --bs-primary: var(--pc-primary);
    --bs-primary-rgb: 181, 131, 90;
    --bs-secondary: var(--pc-secondary);
    --bs-info: var(--pc-secondary); /* On mappe l'info sur le secondary pour éviter le bleu */
    --bs-warning: var(--pc-primary);
    --bs-danger: var(--pc-status-danger);
    --bs-success: var(--pc-status-success);
    
    --bs-body-bg: var(--pc-bg-page);
    --bs-body-color: var(--pc-text-main);
    --bs-link-color: var(--pc-primary);
    --bs-link-hover-color: var(--pc-primary-hover);
}

/* -------------------------------------------------------------------------- */
/* LAYOUT & BASE                                                              */
/* -------------------------------------------------------------------------- */
html, body {
    height: 100%; /* Requis pour le sticky footer */
}

body {
    display: flex;
    flex-direction: column;
    background-color: var(--pc-bg-page);
    color: var(--pc-text-main);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
}

/* Titres standardisés */
h1, h2, h3, h4, h5, h6, .card-title {
    color: var(--pc-text-main) !important;
    font-weight: 700;
}

/* On rattrape le bleu Bootstrap hardcodé dans le JS */
.text-info, .text-primary {
    color: var(--pc-text-main) !important;
}

.bg-info, .bg-primary {
    background-color: var(--pc-primary) !important;
    color: var(--pc-text-on-primary) !important;
}

.badge {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.footer-canopee { 
    padding: 3rem 0; 
    background-color: var(--pc-primary);
    color: var(--pc-text-main);
    margin-top: auto; /* Magie du flex : pousse le footer en bas */
}

.footer-canopee a { 
    color: var(--pc-text-main) !important;
    text-decoration: none;
    opacity: 0.9;
}

.footer-canopee a:hover { 
    opacity: 1; 
    text-decoration: underline;
}

.nav-separator { border-bottom: 1px solid var(--pc-border); }

/* Barre de config (ex-wood) */
.theme-config-bar { 
    background-color: var(--pc-secondary); 
    color: var(--pc-text-on-secondary);
    border: 1px solid var(--pc-primary);
}

/* -------------------------------------------------------------------------- */
/* COMPONENTS                                                                 */
/* -------------------------------------------------------------------------- */

/* Cartes */
.card, .modal-content, .list-group-item {
    background-color: var(--pc-bg-surface);
    color: var(--pc-text-main);
    border: 1px solid var(--pc-border);
    border-radius: 12px;
    overflow: hidden;
}

.exercice-img-header {
    background-color: var(--pc-secondary) !important;
    border-bottom: 1px solid var(--pc-border);
}

/* Forcer le contraste du texte dans les surfaces claires si besoin */
.card .text-muted { color: var(--pc-text-muted) !important; }

/* Boutons */
.btn-primary {
    background-color: var(--pc-primary);
    border-color: var(--pc-primary);
    color: var(--pc-text-on-primary);
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--pc-primary-hover);
    border-color: var(--pc-primary-hover);
    color: var(--pc-text-on-primary);
}

.btn-outline-primary {
    border-color: var(--pc-primary);
    color: var(--pc-primary);
}

.btn-outline-primary:hover, .btn-outline-primary:active, .btn-outline-primary.active {
    background-color: var(--pc-primary);
    color: var(--pc-text-on-primary);
}

/* Console / Terminal */
.terminal-output { 
    max-height: 400px; overflow-y: auto; 
    color: var(--pc-color-terminal-green); background-color: var(--pc-color-terminal-bg);
    font-family: 'Courier New', monospace; padding: 1rem; border-radius: 0.375rem;
}

/* Logos & Icons */
.img-logo-header { height: 30px; width: auto; object-fit: contain; }
.img-logo-footer { height: 64px; width: auto; object-fit: contain; }
.img-user-header { width: 24px; height: 24px; object-fit: cover; background-color: var(--pc-bg-surface); }
.img-user-login, .img-icon-inline { width: 24px; height: 24px; object-fit: contain; }

/* -------------------------------------------------------------------------- */
/* NAVIGATION                                                                 */
/* -------------------------------------------------------------------------- */
nav.navbar {
    background-color: #000000 !important;
}

.navbar .navbar-brand { font-weight: 700; color: #ffffff; }
.navbar .nav-link { color: rgba(255, 255, 255, 0.7); }
.navbar .nav-link:hover, .navbar .nav-link.active { color: #ffffff; }

.dropdown-menu {
    background-color: var(--pc-bg-surface);
    border: 1px solid var(--pc-border);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.dropdown-item { color: var(--pc-text-main); font-weight: 500; }
.dropdown-item:hover { background-color: var(--pc-bg-subtle); color: var(--pc-primary); }

/* -------------------------------------------------------------------------- */
/* UTILITIES                                                                  */
/* -------------------------------------------------------------------------- */
.text-pre-wrap { white-space: pre-wrap; }

/* --- Contraintes pour les grandes images dans les contenus --- */
.atelier-content img, #exerciceContent img, #chansonViewerContent img {
    max-width: 100%; height: auto; border-radius: 8px; margin-bottom: 1rem;
}

/* Visionneuse de partition (Contenu injecté) */
#chansonViewerContent {
    background-color: var(--pc-bg-surface);
    color: var(--pc-text-main);
    padding: 1.5rem;
    line-height: 1.6;
}

#chansonViewerContent a {
    color: var(--pc-primary) !important;
    text-decoration: underline;
}

#chansonViewerContent h1, #chansonViewerContent h2, #chansonViewerContent h3 {
    color: var(--pc-primary) !important;
    margin-top: 1.5rem;
}

/* Badges d'exercices associés */
.exercice-badge-link {
    background-color: var(--pc-secondary) !important;
    color: var(--pc-text-on-secondary) !important;
    border: 1px solid var(--pc-primary);
    transition: transform 0.2s;
    text-decoration: none !important;
}

.exercice-badge-link:hover {
    transform: scale(1.05);
    background-color: var(--pc-primary) !important;
    color: var(--pc-text-on-primary) !important;
}

/* --- Vidéos YouTube et Iframes --- */
.video-container {
    position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; margin-bottom: 1.5rem;
}
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* Modales spécifiques (Exercices) */
#exerciceDetailModal .modal-header {
    background-color: var(--pc-primary) !important;
    color: var(--pc-bg-surface) !important;
}

#exerciceDetailModal .modal-title, #exerciceDetailModal .modal-header i {
    color: var(--pc-bg-surface) !important;
}

#exerciceDetailModal .modal-body {
    background-color: var(--pc-secondary) !important;
    color: var(--pc-text-on-secondary) !important;
}

#exerciceDetailModal .modal-body h1, 
#exerciceDetailModal .modal-body h2, 
#exerciceDetailModal .modal-body h3,
#exerciceDetailModal .modal-body h4,
#exerciceDetailModal .modal-body .card-title {
    color: var(--pc-text-on-secondary) !important;
}

/* Alertes personnalisées (ex-bleu ciel) */
.alert-theme-preview {
    background-color: var(--pc-secondary) !important;
    color: var(--pc-text-on-secondary) !important;
    border: 2px solid var(--pc-primary) !important;
    font-weight: 600;
}

/* Cartes de propositions (Sondages) */
.proposition-card {
    background-color: var(--pc-secondary) !important;
    color: var(--pc-text-on-secondary) !important;
    border: 1px solid var(--pc-border);
}

.proposition-card .card-title, .proposition-card .card-text {
    color: var(--pc-text-on-secondary) !important;
}

/* --- Save the Date (Post-it) --- */
.post-it-container { display: flex; flex-wrap: wrap; gap: 35px; padding: 10px 0; }
.post-it {
    background: #fdfd86;
    color: #222;
    width: 160px; height: 160px;
    padding: 10px;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
    display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
    text-decoration: none;
    position: relative;
}
.post-it:hover { transform: scale(1.05) rotate(0deg) !important; color: #000; z-index: 5; }
.post-it:nth-child(even) { transform: rotate(2deg); }
.post-it:nth-child(odd) { transform: rotate(-2deg); }
.post-it .date-day { font-size: 2rem; font-weight: 800; line-height: 1; }
.post-it .date-month { font-size: 1.1rem; text-transform: uppercase; font-weight: 700; border-bottom: 1px solid rgba(0,0,0,0.1); width: 80%; }
.post-it .title { font-size: 1rem; font-weight: 700; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
