/* admin/style.css */

:root {
    /* Palette de couleurs (Basée sur Saniflo) */
    --primary: #004a8f;
    --primary-light: #0063bf;
    --secondary: #ffc400;
    --secondary-hover: #e0a800;

    /* Couleurs sémantiques */
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --info: #3498db;

    /* Couleurs neutres */
    --bg-body: #f4f6f9;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e2e8f0;

    /* Effets */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

/* --- RESET & BASES --- */
* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    margin: 0;
    padding: 0;
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; padding: 0; margin: 0; }

/* --- LOGIN PAGE --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #002a52 100%);
}

.login-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border-top: 5px solid var(--secondary);
}

.login-box h2 { margin-bottom: 25px; color: var(--primary); font-size: 1.5rem; }
.login-box p { margin-bottom: 20px; font-size: 0.9rem; }

.login-box input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 2px solid var(--bg-body);
    border-radius: var(--radius);
    background: var(--bg-body);
    transition: var(--transition);
}

.login-box input:focus {
    background: #fff;
    border-color: var(--primary);
    outline: none;
}

.btn-admin {
    background: var(--secondary);
    color: var(--primary);
    padding: 12px;
    border: none;
    width: 100%;
    font-weight: bold;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-admin:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 196, 0, 0.3);
}

/* --- HEADER & NAVIGATION --- */
.admin-header {
    background: var(--primary);
    color: white;
    padding: 0 30px;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.admin-logo {
    font-weight: 800;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 1px;
}

.admin-nav { display: flex; align-items: center; height: 100%; }

.admin-nav a {
    color: rgba(255,255,255,0.8);
    margin-left: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    height: 70px;
    display: flex;
    align-items: center;
    border-bottom: 3px solid transparent;
}

.admin-nav a:hover, .admin-nav a.active {
    color: white;
    border-bottom-color: var(--secondary);
    background: rgba(255,255,255,0.05);
}

.logout-btn {
    background: rgba(255,255,255,0.1) !important;
    height: auto !important;
    padding: 8px 20px !important;
    border-radius: 50px;
    border-bottom: none !important;
    margin-left: 30px !important;
}

.logout-btn:hover { background: var(--danger) !important; }

/* --- DASHBOARD LAYOUT --- */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    animation: fadeIn 0.5s ease-in-out;
}

h1, h2, h3 { color: var(--text-main); margin-top: 0; }

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary);
    transition: var(--transition);
}

.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }

.card h3 {
    margin: 0 0 5px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card .number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.card i {
    font-size: 2.5rem;
    color: var(--border-color);
    opacity: 0.5;
}

/* --- TABLES --- */
.table-container {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    margin-bottom: 30px;
}

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

th, td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: #f8faff;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border-color);
}

/* Coins arrondis pour le header de table */
th:first-child { border-top-left-radius: var(--radius); border-left: 1px solid var(--border-color); }
th:last-child { border-top-right-radius: var(--radius); border-right: 1px solid var(--border-color); }

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fbfbfb; }

/* --- BADGES & BUTTONS --- */
.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-new { background: #e3f2fd; color: #1976d2; }
.badge-done { background: #e8f5e9; color: #2e7d32; }
.badge-cancel { background: #ffebee; color: #c62828; }

.btn-action {
    padding: 6px 12px;
    background: var(--bg-body);
    color: var(--text-main);
    border-radius: 6px;
    font-size: 0.85rem;
    margin-right: 5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
}

.btn-action:hover { background: #e2e6ea; color: var(--primary); }

.btn-add {
    background: var(--success);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}
.btn-add:hover { background: #27ae60; color: white; transform: translateY(-2px); }

/* --- FORMS (CRUD) --- */
.crud-form {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-width: 700px;
    margin: 0 auto;
}

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #fdfdfd;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 74, 143, 0.1);
    background: white;
    outline: none;
}

/* Boutons spécifiques aux actions CRUD */
.btn-edit { background: var(--warning); color: #fff; border: none; }
.btn-edit:hover { background: #d4ac0d; }

.btn-delete { background: var(--danger); color: #fff; border: none; }
.btn-delete:hover { background: #c0392b; }

/* --- UTILITIES --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar stylisée (Chrome/Safari) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #bbb; }

/* Responsive Mobile */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        height: auto;
        padding: 15px;
    }

    .admin-nav {
        margin-top: 15px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .admin-nav a {
        margin: 0 5px;
        height: 40px;
        font-size: 0.8rem;
    }

    .dashboard-cards { grid-template-columns: 1fr; }

    .crud-form { padding: 20px; }
}