/*
 * Delfi - Dark Theme (Noir et Violet)
 * Design élégant, épuré, moderne
 */

:root {
    --dark-bg: #0a0a0a;
    --dark-surface: #1a1a1a;
    --dark-surface-light: #2a2a2a;
    --purple-primary: #8b5cf6;
    --purple-light: #a78bfa;
    --purple-dark: #6d28d9;
    --purple-glow: rgba(139, 92, 246, 0.3);
    --text-primary: #e5e5e5;
    --text-secondary: #9ca3af;
    --border-color: #374151;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Surcharge des variables Bootstrap pour remplacer le bleu par du violet */
    --bs-primary: #8b5cf6;
    --bs-primary-rgb: 139, 92, 246;
    --bs-primary-text-emphasis: #a78bfa;
    --bs-primary-bg-subtle: rgba(139, 92, 246, 0.1);
    --bs-primary-border-subtle: rgba(139, 92, 246, 0.2);
}

/* Global Styles */
html, body {
    height: 100%;
}

body {
    background-color: var(--dark-bg);
    /* L'image de fond sera définie aléatoirement par JavaScript (random-background.js) */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    flex-direction: column;
}

/* Police cursive élégante uniquement pour les titres principaux */
h1 {
    font-family: 'Allura', cursive;
    font-weight: 400;
    letter-spacing: 2px;
}

/* Police serif élégante pour les autres titres */
h2, h3, h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Police Inter pour h5 et h6 */
h5, h6,
.card-header h5,
.card-header h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Navbar personnalisée */
.navbar {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b4e 100%) !important;
    border-bottom: 1px solid var(--purple-primary);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    min-height: 70px;
    z-index: 1000;
}

/* Effet shimmer discret sur la navbar - sans blur pour éviter débordement */
.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(
            110deg,
            transparent 0%,
            transparent 35%,
            rgba(139, 92, 246, 0.12) 45%,
            rgba(167, 139, 250, 0.18) 50%,
            rgba(139, 92, 246, 0.12) 55%,
            transparent 65%,
            transparent 100%
        );
    background-size: 200% 100%;
    background-position: 200% 0;
    animation: shimmer-sweep 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.navbar > .container {
    position: relative;
    z-index: 10;
}

@keyframes shimmer-sweep {
    0% {
        background-position: 200% 0;
    }
    50% {
        background-position: -100% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.navbar-brand {
    font-family: 'Allura', cursive;
    font-weight: 400;
    font-size: 2.5rem;
    color: var(--purple-light) !important;
    text-shadow: 0 0 20px var(--purple-glow);
    letter-spacing: 2px;
}

.navbar-brand:hover {
    color: var(--purple-primary) !important;
}

.nav-link {
    color: var(--text-secondary) !important;
    transition: all 0.3s ease;
    margin: 0 0.5rem;
}

.nav-link:hover {
    color: var(--purple-light) !important;
    transform: translateY(-2px);
}

/* Cards */
.card {
    background: linear-gradient(135deg, var(--dark-surface) 0%, var(--dark-surface-light) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px var(--purple-glow);
    border-color: var(--purple-primary);
}

.card-header {
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple-primary) 100%);
    border-bottom: 1px solid var(--purple-primary);
    font-weight: 600;
}

.card-body {
    color: var(--text-primary);
}

/* Surcharge Bootstrap border-primary */
.border-primary {
    --bs-border-opacity: 1;
    border-color: var(--purple-primary) !important;
}

/* Surcharge Bootstrap bg-primary */
.bg-primary {
    background-color: var(--purple-primary) !important;
}

/* Surcharge Bootstrap text-primary */
.text-primary {
    color: var(--purple-light) !important;
}

/* Surcharge pour les cartes avec header bg-primary */
.card-header.bg-primary {
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple-primary) 100%) !important;
    border-color: var(--purple-primary) !important;
}

/* Carte défi actif - Effet spécial */
.card.border-primary {
    border: 2px solid var(--purple-primary) !important;
    box-shadow: 0 0 30px var(--purple-glow), inset 0 0 60px rgba(139, 92, 246, 0.05);
    animation: pulse-border 3s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        box-shadow: 0 0 20px var(--purple-glow), inset 0 0 60px rgba(139, 92, 246, 0.05);
    }
    50% {
        box-shadow: 0 0 40px var(--purple-glow), inset 0 0 80px rgba(139, 92, 246, 0.1);
    }
}

/* Défi verrouillé - Effet mystère */
.locked-challenge {
    opacity: 0.7;
    filter: grayscale(0.4);
    position: relative;
    cursor: not-allowed;
    user-select: none;
}

.locked-challenge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
    z-index: 1;
}

.locked-challenge .card-header,
.locked-challenge .card-body {
    position: relative;
    z-index: 2;
}

/* Titre mystérieux - Flou */
.mystery-title {
    filter: blur(6px);
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    user-select: none;
    transition: filter 0.5s ease;
}

.locked-challenge:hover .mystery-title {
    filter: blur(4px);
}

/* Contenu mystérieux */
.mystery-content {
    position: relative;
}

.mystery-content em {
    color: var(--purple-light);
    font-size: 0.95rem;
}

/* Effet de flou sur le texte des points */
.blurred-text {
    filter: blur(4px);
    user-select: none;
    color: rgba(255, 255, 255, 0.7);
}

.mystery-blur {
    opacity: 0.6;
}

/* Animation au hover pour tease */
.locked-challenge:hover {
    opacity: 0.8;
    transform: none;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.2);
}

.locked-challenge:hover .mystery-blur {
    opacity: 0.8;
}

/* Animation shake pour les clics sur défis verrouillés */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}


/* Boutons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--purple-light) 0%, var(--purple-primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--purple-glow);
}

.btn-outline-primary {
    border: 2px solid var(--purple-primary);
    color: var(--purple-light);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--purple-primary);
    color: white;
    box-shadow: 0 6px 20px var(--purple-glow);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Badges */
.badge {
    border-radius: 6px;
    padding: 0.5em 1em;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}


.badge.bg-success {
    background: var(--success) !important;
}

.badge.bg-secondary {
    background: var(--dark-surface-light) !important;
    border: 1px solid var(--border-color);
}

/* Alerts */
.alert {
    border-radius: 12px;
    border: 1px solid;
    background: var(--dark-surface);
    position: relative;
    z-index: 100;
}

.alert-info {
    border-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    color: #93c5fd;
}

.alert-success {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    color: #6ee7b7;
}

.alert-warning {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    color: #fcd34d;
}

/* Forms */
.form-control {
    background: var(--dark-surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-control:focus {
    background: var(--dark-surface);
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px var(--purple-glow);
    color: var(--text-primary);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Images */
img {
    border-radius: 12px;
}

.card-img-top {
    border-radius: 0;
    transition: transform 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

/* Footer sticky */
main {
    flex: 1 0 auto;
}

footer.footer {
    flex-shrink: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b4e 100%);
    border-top: 2px solid var(--purple-primary);
    color: var(--text-secondary);
    box-shadow: 0 -4px 20px rgba(139, 92, 246, 0.15);
}

footer.footer .footer-quote {
    color: var(--purple-light);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    display: block;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Sidebar sticky */
.sticky-top {
    position: sticky;
    top: 20px;
}

/* Progress Display */
.display-4 {
    font-weight: 700;
    background: linear-gradient(135deg, var(--purple-light) 0%, var(--purple-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Login page */
.card.shadow {
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple-primary) 100%);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--purple-light);
}

/* Responsive */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }
}

/* Glow effect pour les éléments importants */
.glow {
    box-shadow: 0 0 20px var(--purple-glow);
}

/* Texte secondaire */
.text-muted {
    color: var(--text-secondary) !important;
}

/* Dropdown */
.dropdown-menu {
    background: var(--dark-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 1050 !important;
}

.dropdown-item {
    color: var(--text-primary);
}

.dropdown-item:hover {
    background: var(--purple-primary);
    color: white;
}

/* Navbar dropdown spécifique */
.navbar .dropdown-menu {
    z-index: 1050 !important;
}

.navbar .nav-item.dropdown {
    position: relative;
    z-index: 1001;
}
