/* ─── SafeJunior Espace Client — CSS ─────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
    --blue-dark:   #1E3A8A;
    --blue-mid:    #2563EB;
    --blue-light:  #3B82F6;
    --blue-pale:   #EFF6FF;
    --green:       #059669;
    --green-pale:  #ECFDF5;
    --amber:       #D97706;
    --amber-pale:  #FFFBEB;
    --red:         #DC2626;
    --red-pale:    #FEF2F2;
    --slate-900:   #0F172A;
    --slate-700:   #334155;
    --slate-500:   #64748B;
    --slate-300:   #CBD5E1;
    --slate-100:   #F1F5F9;
    --slate-50:    #F8FAFC;
    --white:       #FFFFFF;
    --radius:      12px;
    --shadow:      0 4px 24px rgba(30,58,138,.09);
    --shadow-lg:   0 8px 40px rgba(30,58,138,.14);
    --transition:  .2s cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Quicksand', sans-serif;
    background: var(--slate-50);
    color: var(--slate-700);
    min-height: 100vh;
    display: flex;
}

/* ─── SIDEBAR ──────────────────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: linear-gradient(160deg, var(--blue-dark) 0%, #162d6e 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(30,58,138,.18);
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.sidebar-logo .logo-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,.15);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(4px);
}

.sidebar-logo .logo-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--white);
    letter-spacing: -.3px;
}
.sidebar-logo .logo-text span { color: #93C5FD; }

.sidebar-user {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-user .user-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3B82F6, #60A5FA);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-user .user-info { margin-left: 12px; overflow: hidden; }
.sidebar-user .user-name {
    font-weight: 700; font-size: .9rem; color: white;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .user-num {
    font-size: .75rem; color: #93C5FD;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user { display: flex; align-items: center; }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    padding: 8px 12px 4px;
    margin-top: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: rgba(255,255,255,.7);
    font-weight: 600;
    font-size: .88rem;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: rgba(255,255,255,.1);
    color: white;
}

.nav-link.active {
    background: rgba(59,130,246,.35);
    color: white;
    box-shadow: 0 2px 12px rgba(59,130,246,.3);
}

.nav-link .nav-icon {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.08);
    border-radius: 8px;
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-link.active .nav-icon { background: rgba(59,130,246,.4); }

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

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

.sidebar-footer .nav-link {
    color: rgba(255,255,255,.5);
}

/* ─── MAIN ─────────────────────────────────────────────────────────────── */
.main {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── TOPBAR ───────────────────────────────────────────────────────────── */
.topbar {
    background: white;
    border-bottom: 1px solid var(--slate-100);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 12px rgba(30,58,138,.06);
}

.topbar-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--slate-900);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notif-btn {
    width: 38px; height: 38px;
    border: none;
    background: var(--slate-100);
    border-radius: 10px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    position: relative;
    transition: background var(--transition);
    text-decoration: none;
    color: var(--slate-700);
}
.notif-btn:hover { background: var(--blue-pale); color: var(--blue-mid); }
.notif-dot {
    position: absolute; top: 5px; right: 5px;
    width: 8px; height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid white;
}

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

/* ─── CARDS ────────────────────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    border: 1px solid rgba(30,58,138,.06);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── STAT CARDS ───────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(30,58,138,.06);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.blue   { background: var(--blue-pale);  color: var(--blue-mid); }
.stat-icon.green  { background: var(--green-pale);  color: var(--green); }
.stat-icon.amber  { background: var(--amber-pale);  color: var(--amber); }
.stat-icon.red    { background: var(--red-pale);    color: var(--red); }

.stat-num {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--slate-900);
    line-height: 1;
}
.stat-label {
    font-size: .78rem;
    color: var(--slate-500);
    font-weight: 600;
    margin-top: 3px;
}

/* ─── TABLE ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

th {
    text-align: left;
    padding: 10px 14px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--slate-500);
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-100);
}

td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--slate-100);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--blue-pale); }

/* ─── BADGES ───────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .3px;
}
.badge-success   { background: var(--green-pale);  color: var(--green); }
.badge-warning   { background: var(--amber-pale);  color: var(--amber); }
.badge-danger    { background: var(--red-pale);    color: var(--red); }
.badge-info      { background: var(--blue-pale);   color: var(--blue-dark); }
.badge-secondary { background: var(--slate-100);   color: var(--slate-500); }
.badge-essentiel { background: #EFF6FF; color: #1D4ED8; }
.badge-confort   { background: #F0FDF4; color: #15803D; }
.badge-premium   { background: #FFF7ED; color: #C2410C; }

/* ─── BUTTONS ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 10px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: .85rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-mid), var(--blue-light));
    color: white;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,.45); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--slate-300);
    color: var(--slate-700);
}
.btn-outline:hover { border-color: var(--blue-mid); color: var(--blue-mid); background: var(--blue-pale); }

.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-danger { background: var(--red); color: white; }
.btn-success { background: var(--green); color: white; }

/* ─── FORMS ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-weight: 700;
    font-size: .82rem;
    color: var(--slate-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--slate-300);
    border-radius: 10px;
    font-family: 'Quicksand', sans-serif;
    font-size: .9rem;
    color: var(--slate-900);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--blue-mid);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ─── ALERTS ───────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: .88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: var(--green-pale); color: #065F46; border-left: 4px solid var(--green); }
.alert-danger  { background: var(--red-pale);   color: #7F1D1D; border-left: 4px solid var(--red); }
.alert-info    { background: var(--blue-pale);  color: var(--blue-dark); border-left: 4px solid var(--blue-mid); }
.alert-warning { background: var(--amber-pale); color: #78350F; border-left: 4px solid var(--amber); }

/* ─── GRID HELPERS ─────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ─── EMPTY STATE ──────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--slate-500);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; margin-bottom: 16px; }

/* ─── LOGIN PAGE ───────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--blue-dark) 0%, #1e40af 50%, var(--blue-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(15,23,42,.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-img {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--slate-900);
}
.login-logo h1 span { color: var(--blue-mid); }
.login-logo p {
    font-size: .83rem;
    color: var(--slate-500);
    margin-top: 4px;
}

.login-divider {
    text-align: center;
    margin: 20px 0 8px;
    font-size: .8rem;
    color: var(--slate-500);
}

/* ─── MODAL ────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }

.modal {
    background: white;
    border-radius: 16px;
    padding: 28px;
    max-width: 560px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--slate-900);
}

.modal-close {
    background: var(--slate-100);
    border: none;
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
}
.modal-close:hover { background: var(--red-pale); color: var(--red); }

/* ─── CHAT TICKET ──────────────────────────────────────────────────────── */
.chat-container {
    background: var(--slate-50);
    border-radius: 12px;
    padding: 16px;
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: .88rem;
    line-height: 1.6;
}

.chat-msg.client {
    background: var(--blue-pale);
    color: var(--blue-dark);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg.admin {
    background: white;
    border: 1px solid var(--slate-200);
    color: var(--slate-700);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(30,58,138,.06);
}

.chat-meta {
    font-size: .7rem;
    color: var(--slate-500);
    margin-bottom: 4px;
    font-weight: 600;
}

/* ─── NOTIFICATION ─────────────────────────────────────────────────────── */
.notif-item {
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--slate-50);
    border: 1px solid var(--slate-100);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
    transition: background var(--transition);
}
.notif-item:hover { background: var(--blue-pale); }
.notif-item.unread { border-left: 3px solid var(--blue-mid); background: #EFF6FF; }

.notif-dot-type {
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}
.notif-dot-type.success { background: var(--green); }
.notif-dot-type.info    { background: var(--blue-mid); }
.notif-dot-type.error   { background: var(--red); }
.notif-dot-type.warning { background: var(--amber); }

/* ─── WELCOME BANNER ───────────────────────────────────────────────────── */
.welcome-banner {
    background: linear-gradient(135deg, var(--blue-dark), #2563EB, #3B82F6);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 24px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -40px; top: -40px;
    width: 200px; height: 200px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
}
.welcome-banner::before {
    content: '';
    position: absolute;
    right: 60px; bottom: -60px;
    width: 160px; height: 160px;
    background: rgba(255,255,255,.04);
    border-radius: 50%;
}

.welcome-text h2 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    margin-bottom: 4px;
}
.welcome-text p { font-size: .88rem; opacity: .8; }

.welcome-emoji { font-size: 3rem; z-index: 1; }

/* ─── RESPONSIVE ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar { padding: 0 16px; }
    .page-content { padding: 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px;
    color: var(--slate-700);
}
@media (max-width: 900px) { .hamburger { display: block; } }
