/* ===== RESET ET BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c1022, #1a1a2e);
    color: #eee;
    min-height: 100vh;
    transition: all 0.5s ease;
    overflow-x: hidden;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-3d {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.animate-3d.visible {
    animation: fadeInUp 0.6s ease forwards;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #000000, #ffffff); /* Gradient noir à blanc */
    color: #fff;
    padding: 20px 30px;
    display: flex;
    justify-content: center;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    border-bottom: 3px solid #ccc; /* Accent gris pour contraste */
    animation: slideIn 0.8s ease-out;
}

.header-content {
    max-width: 1200px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 160px;
    transition: transform 0.3s ease;
    /* Supprimé border-radius et box-shadow pour un look plat */
}

.logo:hover {
    transform: scale(1.05);
}

/* HEADER ACTIONS */
.header-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-register {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: #fff;
}

.btn-login {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #000;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

/* THEME BUTTON */
.theme-btn {
    background: #333;
    border: 2px solid #fff;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    transform: rotate(180deg) scale(1.1);
    background: #fff;
    color: #000;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
}

/* ===== FOOTER ===== */
.footer {
    background: #111;
    color: #ccc;
    padding: 30px 10px;
    margin-top: auto;
    text-align: center;
}

.footer-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.social-icons a {
    margin: 0 15px;
    color: #00aaff;
    font-size: 24px;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    transform: scale(1.2);
    color: #fff;
    text-shadow: 0 0 10px #00aaff;
}

/* ===== DARK / LIGHT MODE ===== */
:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc, #e2e8f0);
    --text-main: #0f172a;
    --text-dim: #475569;
    --surface: #ffffff;
    --surface-soft: #f1f5f9;
    --border: rgba(0, 0, 0, 0.08);
    --input-bg: #ffffff;
    --input-color: #0f172a;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    --bg-gradient: linear-gradient(135deg, #0c1022, #1a1a2e);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --surface: #1e293b;
    --surface-soft: #0f172a;
    --border: rgba(255, 255, 255, 0.05);
    --input-bg: #0f172a;
    --input-color: #ffffff;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
}

body.light-mode {
    --bg-gradient: linear-gradient(135deg, #f8fafc, #e2e8f0);
    --text-main: #0f172a;
    --text-dim: #475569;
    --surface: #ffffff;
    --surface-soft: #f1f5f9;
    --border: rgba(0, 0, 0, 0.08);
    --input-bg: #ffffff;
    --input-color: #0f172a;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
}

body {
    background: var(--bg-gradient) !important;
    color: var(--text-main) !important;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Card and inputs on all pages using variables */
.dashboard-card, .profile-header-top, .password-section, .profile-container > div, .filiere-card-modern {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-main) !important;
    box-shadow: var(--shadow) !important;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease !important;
}

.dashboard-card:hover, .profile-header-top:hover, .password-section:hover, .profile-container > div:hover, .filiere-card-modern:hover {
    transform: translateY(-6px) scale(1.005);
    box-shadow: var(--shadow-lg) !important;
    border-color: #6366f1 !important;
}

.dashboard-card h1, .dashboard-card h2, .dashboard-card h3,
.profile-header-top h1, .profile-header-top h2, .profile-header-top h3,
.password-section h1, .password-section h2, .password-section h3,
.profile-container h1, .profile-container h2, .profile-container h3,
.profile-container strong, .filiere-card-modern h3,
.dashboard-header, .dashboard-header h1, .dashboard-header p {
    color: var(--text-main) !important;
}

.profile-container span, .profile-title p, .password-section label, .filiere-card-modern p {
    color: var(--text-dim) !important;
}

.filiere-section h2 {
    color: var(--text-main) !important;
}

.form-input, .profile-container input, .profile-container select, .password-section input {
    background: var(--input-bg) !important;
    border: 1px solid var(--border) !important;
    color: var(--input-color) !important;
}

.dashboard-table th, .dashboard-table td {
    border-bottom: 1px solid var(--border) !important;
    color: var(--text-main) !important;
}

.dashboard-table th {
    color: var(--text-dim) !important;
    background: var(--surface-soft) !important;
}

body.light-mode .header {
    background: linear-gradient(135deg, #000000, #ffffff); /* Garde le gradient même en mode clair */
    color: #000; /* Texte noir pour contraste */
}

body.light-mode .btn-login {
    color: #000;
}

body.light-mode .theme-btn {
    background: #f5f5f5;
    border-color: #000;
    color: #000;
}

body.light-mode .theme-btn:hover {
    background: #000;
    color: #fff;
}

body.light-mode .footer {
    background: #222;
    color: #eee;
}

/* ===== RESPONSIVE ===== */
.menu-toggle-btn {
    display: none;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
    }

    .logo-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .menu-toggle-btn {
        display: block !important;
        background: none;
        border: none;
        color: var(--text-main) !important;
        font-size: 24px;
        cursor: pointer;
    }

    .header-actions {
        display: none !important;
        width: 100%;
        flex-direction: column;
        gap: 12px;
        margin-top: 15px;
        background: var(--surface) !important;
        padding: 20px;
        border-radius: 12px;
        border: 1px solid var(--border) !important;
        box-shadow: var(--shadow-lg) !important;
    }

    .header-actions.show {
        display: flex !important;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    .logo {
        width: 120px;
    }
}