/* =============================================
   LA PETITE ACADEMY - ADMIN PANEL CSS
   ============================================= */

:root {
    --navy:       #1E2D6B;
    --blue:       #3A5BA0;
    --blue-light: #5A7CC0;
    --lavender:   #C9A8C8;
    --green:      #4CAF50;
    --green-dark: #2E7D32;
    --sidebar-w:  260px;
    --topbar-h:   64px;
    --white:      #FFFFFF;
    --off-white:  #F5F7FF;
    --gray-100:   #F0F2F8;
    --gray-200:   #E2E6F0;
    --gray-500:   #8896B0;
    --text:       #2D3748;
    --radius:     12px;
    --shadow:     0 4px 20px rgba(30,45,107,0.10);
    --shadow-lg:  0 8px 40px rgba(30,45,107,0.16);
    --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: 'Nunito', sans-serif;
    background: var(--off-white);
    color: var(--text);
    line-height: 1.6;
}
h1,h2,h3,h4 { font-family: 'Playfair Display', serif; color: var(--navy); line-height: 1.2; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ============================
   LOGIN PAGE
   ============================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 60%, #4A6BB8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo { height: 80px; margin: 0 auto 20px; }
.login-title { font-size: 1.5rem; color: var(--navy); margin-bottom: 6px; }
.login-subtitle { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 32px; }
.login-badge {
    display: inline-block;
    background: var(--off-white);
    border: 2px solid var(--gray-200);
    color: var(--navy);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 28px;
}

.login-form .form-group { margin-bottom: 20px; text-align: left; }
.login-form label { display: block; font-weight: 700; font-size: 0.875rem; color: var(--navy); margin-bottom: 8px; }
.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--off-white);
}
.login-form input:focus {
    outline: none;
    border-color: var(--blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(58,91,160,0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}
.btn-login:hover { background: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow); }

.login-back { margin-top: 20px; color: var(--gray-500); font-size: 0.875rem; }
.login-back a { color: var(--blue); font-weight: 600; }

/* ============================
   ADMIN LAYOUT
   ============================ */
.admin-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo { height: 48px; width: auto; }

.sidebar-brand { flex: 1; }
.sidebar-brand-top {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
}
.sidebar-brand-name {
    font-family: 'Playfair Display', serif;
    color: white;
    font-size: 0.85rem;
    line-height: 1.2;
}

.sidebar-nav { padding: 20px 0; flex: 1; }

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    padding: 16px 20px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    border-left-color: var(--lavender);
}

.sidebar-link.active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: var(--green);
}

.sidebar-link-icon { font-size: 1.1rem; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    background: var(--blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    font-weight: 700;
}

.sidebar-user-info { flex: 1; }
.sidebar-user-name { font-size: 0.875rem; font-weight: 700; color: white; }
.sidebar-user-role { font-size: 0.72rem; color: rgba(255,255,255,0.5); }

.sidebar-logout {
    display: block;
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
    transition: var(--transition);
    text-align: center;
}
.sidebar-logout:hover { background: #EF5350; color: white; border-color: transparent; }

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    height: var(--topbar-h);
    background: white;
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 20px;
    box-shadow: var(--shadow);
}

.admin-topbar h1 {
    font-size: 1.25rem;
    color: var(--navy);
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.notif-btn {
    width: 40px; height: 40px;
    background: var(--off-white);
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    position: relative;
}
.notif-btn:hover { background: var(--navy); border-color: var(--navy); filter: invert(1); }

.notif-badge {
    position: absolute; top: -6px; right: -6px;
    background: #EF5350;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}

.site-link {
    padding: 10px 20px;
    background: var(--green);
    color: white;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.82rem;
    transition: var(--transition);
}
.site-link:hover { background: var(--green-dark); }

/* PAGE CONTENT */
.admin-page { padding: 32px; flex: 1; }

/* ============================
   DASHBOARD STATS
   ============================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-widget {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border-left: 4px solid transparent;
}
.stat-widget:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.stat-widget.blue   { border-left-color: var(--blue); }
.stat-widget.green  { border-left-color: var(--green); }
.stat-widget.purple { border-left-color: var(--lavender); }
.stat-widget.brown  { border-left-color: #8B5E3C; }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.blue .stat-icon   { background: #EEF2FF; }
.green .stat-icon  { background: #E8F5E9; }
.purple .stat-icon { background: #F3E5F5; }
.brown .stat-icon  { background: #FBE9E7; }

.stat-info { flex: 1; }
.stat-widget .stat-num { font-size: 2rem; font-weight: 700; color: var(--navy); font-family: 'Playfair Display', serif; }
.stat-widget .stat-label { color: var(--gray-500); font-size: 0.82rem; margin-top: 2px; }
.stat-trend { font-size: 0.72rem; font-weight: 700; margin-top: 4px; }
.trend-up   { color: var(--green); }
.trend-neutral { color: var(--gray-500); }

/* ============================
   PANELS & TABLES
   ============================ */
.admin-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 2px solid var(--gray-200);
}

.admin-card-header h2 {
    font-size: 1.1rem;
    color: var(--navy);
}

.admin-card-body { padding: 24px; }

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--navy);
    color: white;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}
.btn-add:hover { background: var(--blue); transform: translateY(-2px); }

.btn-sm {
    padding: 6px 14px;
    border-radius: 6px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}
.btn-edit   { background: #EEF2FF; color: var(--blue); }
.btn-delete { background: #FFEBEE; color: #C62828; }
.btn-edit:hover   { background: var(--blue); color: white; }
.btn-delete:hover { background: #EF5350; color: white; }
.btn-view   { background: #E8F5E9; color: var(--green-dark); }
.btn-view:hover { background: var(--green); color: white; }

/* TABLE */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--off-white);
    color: var(--navy);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    color: var(--text);
    vertical-align: middle;
}

.data-table tr:hover td { background: var(--off-white); }
.data-table tr:last-child td { border-bottom: none; }

/* BADGES */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-publie  { background: #E8F5E9; color: var(--green-dark); }
.badge-brouillon { background: #FFF3E0; color: #E65100; }
.badge-nouveau { background: #EEF2FF; color: var(--blue); }
.badge-lu { background: var(--gray-100); color: var(--gray-500); }

/* ============================
   FORMS ADMIN
   ============================ */
.admin-form .form-group { margin-bottom: 22px; }
.admin-form label {
    display: block;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--navy);
    margin-bottom: 8px;
}
.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--off-white);
    transition: var(--transition);
}
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(58,91,160,0.1);
}
.admin-form textarea { resize: vertical; min-height: 150px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.btn-save {
    padding: 14px 32px;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-save:hover { background: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow); }

.btn-cancel {
    padding: 14px 28px;
    background: var(--gray-100);
    color: var(--navy);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-cancel:hover { background: var(--gray-200); }

/* ALERTS */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 0.9rem;
    border-left: 4px solid;
}
.alert-success { background: #E8F5E9; color: var(--green-dark); border-color: var(--green); }
.alert-error   { background: #FFEBEE; color: #C62828; border-color: #EF5350; }

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .admin-page { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
