:root {
    --bg-color: #050505; /* Noir encore plus profond */
    --card-bg: #121212;
    --primary-color: #FFD700; /* Or pur intense */
    --primary-hover: #FFED4A; /* Or plus clair au survol */
    --primary-dim: #B8860B; /* Or foncé pour les bordures subtiles */
    --text-color: #FFFFFF;
    --text-muted: #B0B0B0;
    --border-color: #333333;
    --input-bg: #1E1E1E;
    --danger-color: #ff4444;
    --success-color: #00C851;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --gold-gradient: linear-gradient(135deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C);
    --gold-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: all 0.3s;
    text-shadow: 0 0 2px rgba(255, 215, 0, 0.2);
}

a:hover {
    color: var(--primary-hover);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.card:hover {
    border-color: var(--primary-dim);
    box-shadow: 0 4px 20px rgba(184, 134, 11, 0.15);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--primary-dim);
    box-shadow: var(--gold-shadow);
}

/* Typography */
h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 0 0 1px rgba(255, 215, 0, 0.3);
    letter-spacing: 0.5px;
}

h1 { 
    font-size: 2.2rem; 
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent; /* Fallback */
    text-shadow: none;
}

h2 { font-size: 1.6rem; }

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
}

input, select {
    width: 100%;
    max-width: 100%; /* Prevent overflow */
    padding: 12px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s;
    box-sizing: border-box; /* Ensure padding doesn't add to width */
}

/* Fix for date inputs on mobile */
input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
    min-height: 45px; /* Consistent height */
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--gold-gradient);
    background-size: 200% auto;
    color: #000;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(184, 134, 11, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.btn:active {
    transform: scale(0.98);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: none;
}

.btn-secondary:hover {
    background-color: rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
    background: #c0392b;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

/* Action Buttons (Table) */
.btn-icon {
    display: inline-block;
    padding: 8px 20px;
    margin: 0 4px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.btn-icon:hover {
    background-color: transparent;
    color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

.btn-icon.delete {
    border: none;
    background: var(--danger-color);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
}

.btn-icon.delete:hover {
    background: #cc0000;
    color: white;
    box-shadow: 0 6px 20px rgba(255, 68, 68, 0.5);
    transform: translateY(-2px);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-left: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.05));
    pointer-events: none;
}

.stat-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-shadow: none;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(184, 134, 11, 0.3);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 10px;
}

th {
    padding: 15px;
    text-align: left;
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--primary-dim);
}

td {
    padding: 15px;
    background-color: #1E1E1E;
    border-top: 1px solid #2A2A2A;
    border-bottom: 1px solid #2A2A2A;
}

td:first-child {
    border-left: 1px solid #2A2A2A;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

td:last-child {
    border-right: 1px solid #2A2A2A;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

tr:hover td {
    background-color: #252525;
    border-color: var(--primary-dim);
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.hidden { display: none !important; }

/* Loader */
.loader {
    border: 4px solid var(--card-bg);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--primary-color);
}

/* Toast */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--card-bg);
    border-left: 4px solid var(--primary-color);
    color: var(--text-color);
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 1;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

/* Charts */
canvas {
    max-width: 100%;
}

/* Filters Section */
.filter-container {
    margin-bottom: 20px;
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.1);
}

.filter-label {
    display: block;
    margin-bottom: 15px;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-item label {
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.filter-type {
    flex-grow: 1;
    min-width: 200px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto; /* Push buttons to the right on desktop */
}

.btn-export {
    /* Inherits gold style from .btn */
    display: inline-block;
    min-width: 140px; /* Ensure consistent width */
}

/* Remove the green override */
/* 
.btn-export:hover {
   ...
} 
*/

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        width: 100%;
    }

    h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filter-container {
        padding: 15px;
        overflow: hidden; /* Prevent child overflow */
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .filter-item {
        width: 100%;
        min-width: 0; /* Reset min-width */
    }
    
    .filter-buttons {
        margin-left: 0;
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
        gap: 15px;
    }

    .filter-buttons .btn {
        width: 100%;
        display: block;
        margin: 0;
        text-align: center;
    }

    /* Table adjustments for mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 20px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
    }
    
    table {
        min-width: 600px; /* Ensure table doesn't get too squished */
    }

    th, td {
        padding: 10px;
        font-size: 0.9rem;
    }

    .btn-icon {
        padding: 6px 10px;
        font-size: 0.75rem;
        margin: 2px 0;
        display: block;
        width: 100%;
        text-align: center;
    }

    /* Card adjustments */
    .card {
        padding: 20px;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 90%; /* Reduce width slightly to ensure margins */
        max-width: 95%;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }

    .stat-value {
        font-size: 1.8rem;
    }
    
    /* Navigation/Header adjustments if needed */
    .flex-between {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .flex-between h1 {
        margin-bottom: 0;
    }
    
    .flex-between .btn {
        width: 100%;
    }
}
