/* ============================================================
   MediBook — Main Stylesheet
   Bootstrap 5 + Custom Design System
   ============================================================ */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 68px;
    --topbar-height: 64px;

    --primary:     #2563eb;
    --primary-soft:#eff6ff;
    --success:     #16a34a;
    --success-soft:#f0fdf4;
    --danger:      #dc2626;
    --warning:     #d97706;
    --info:        #0891b2;
    --teal:        #0d9488;
    --orange:      #ea580c;

    --bg:          #f8fafd;
    --card-bg:     #ffffff;
    --border:      #e5e9f0;
    --text:        #1e293b;
    --muted:       #64748b;
    --radius:      14px;
    --shadow-sm:   0 1px 4px rgba(0,0,0,.06);
    --shadow:      0 4px 20px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    font-size: 14px;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: #0f172a;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width .25s ease;
    /* allow scrolling so footer links (logout) aren’t pushed off-screen */
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    min-height: var(--topbar-height);
}

.brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px;
    flex-shrink: 0;
}

.brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
}

.sidebar-nav {
    list-style: none;
    padding: 12px 8px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-weight: 500;
    transition: all .2s;
    margin-bottom: 2px;
    white-space: nowrap;
}

.sidebar-nav .nav-link i { font-size: 18px; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; }

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,.07);
    /* keep logout pinned at the bottom of sidebar */
    margin-top: auto;
}

.sidebar-footer .nav-link {
    display: flex; gap: 12px; align-items: center;
    padding: 10px 12px; border-radius: 10px;
    color: rgba(255,255,255,.5);
    text-decoration: none;
    transition: all .2s;
    font-weight: 500;
    white-space: nowrap;
}

.sidebar-footer .nav-link:hover { background: rgba(220,38,38,.15); color: #f87171; }

/* ============================================================
   MAIN WRAPPER / TOPBAR
   ============================================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.topbar {
    position: sticky; top: 0; z-index: 900;
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.topbar-title { font-weight: 700; font-size: 16px; color: var(--text); }

.sidebar-toggle {
    background: none; border: none;
    font-size: 22px; color: var(--muted);
    cursor: pointer; padding: 4px 8px;
    border-radius: 8px;
    display: none;
    transition: color .2s;
}
.sidebar-toggle:hover { color: var(--primary); }

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

.topbar-btn {
    position: relative;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 10px; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--muted); cursor: pointer;
    transition: all .2s;
}
.topbar-btn:hover { border-color: var(--primary); color: var(--primary); }

.notif-badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger); color: #fff;
    border-radius: 50%; width: 18px; height: 18px;
    font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

.topbar-user {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 10px; padding: 6px 12px;
    cursor: pointer; transition: all .2s;
}
.topbar-user:hover { border-color: var(--primary); }

.user-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 13px;
}

.user-name { font-weight: 600; font-size: 13px; }

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

/* ============================================================
   CARDS
   ============================================================ */
.card-custom {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header-custom {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; flex-direction: column;
    gap: 4px;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: var(--radius) 0 0 var(--radius);
}

.stat-primary::before  { background: var(--primary); }
.stat-success::before  { background: var(--success); }
.stat-danger::before   { background: var(--danger); }
.stat-info::before     { background: var(--info); }
.stat-warning::before  { background: var(--warning); }
.stat-orange::before   { background: var(--orange); }
.stat-teal::before     { background: var(--teal); }

.stat-icon {
    font-size: 22px; margin-bottom: 6px;
}
.stat-primary  .stat-icon { color: var(--primary); }
.stat-success  .stat-icon { color: var(--success); }
.stat-danger   .stat-icon { color: var(--danger); }
.stat-info     .stat-icon { color: var(--info); }
.stat-warning  .stat-icon { color: var(--warning); }
.stat-orange   .stat-icon { color: var(--orange); }
.stat-teal     .stat-icon { color: var(--teal); }

.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }

/* ============================================================
   QUICK BOOK BANNER
   ============================================================ */
.quick-book-banner {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex; align-items: center;
    justify-content: space-between; gap: 16px;
    color: #fff;
}
.quick-book-banner h5, .quick-book-banner p { color: #fff !important; }
.quick-book-banner .btn { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); color: #fff; }
.quick-book-banner .btn:hover { background: rgba(255,255,255,.25); }

/* ============================================================
   DOCTOR CARDS
   ============================================================ */
.doctor-card { display: flex; flex-direction: column; }

.doctor-card-top {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 16px 0;
}

.doctor-avatar {
    width: 54px; height: 54px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 22px; font-weight: 700;
    flex-shrink: 0;
}

.doctor-avatar-lg {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 30px; font-weight: 700;
    flex-shrink: 0;
}

.doctor-card-body { padding: 12px 16px; flex: 1; }

.doctor-meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    margin-bottom: 8px;
}

.meta-item {
    display: flex; align-items: center; gap: 5px;
    font-size: 13px; color: var(--muted);
}

.doctor-card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex; gap: 8px;
}

/* ============================================================
   AVATARS
   ============================================================ */
.avatar-sm {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: var(--primary);
    flex-shrink: 0;
}

/* ============================================================
   SLOT GRID
   ============================================================ */
.slot-grid {
    display: flex; flex-wrap: wrap; gap: 8px;
}

.slot-btn {
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    background: var(--bg);
    color: var(--text);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all .18s;
    font-family: inherit;
}

.slot-free:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.slot-selected { border-color: var(--primary) !important; background: var(--primary) !important; color: #fff !important; }
.slot-booked { border-color: #e5e7eb; background: #f9fafb; color: #d1d5db; cursor: not-allowed; text-decoration: line-through; }

/* ============================================================
   SUMMARY PANEL
   ============================================================ */
.summary-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--bg);
    font-size: 13px;
}
.summary-item:last-child { border-bottom: none; }

/* ============================================================
   QUICK ACTION CARDS (Admin)
   ============================================================ */
.quick-action-card {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-radius: var(--radius);
    text-decoration: none; font-weight: 600;
    font-size: 15px;
    transition: opacity .2s, transform .2s;
}
.quick-action-card i { font-size: 24px; }
.quick-action-card:hover { opacity: .88; transform: translateY(-2px); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center; color: var(--muted); padding: 40px;
}
.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 15px; margin-bottom: 12px; }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-no_show   { background: #f3f4f6; color: #6b7280; }

/* ============================================================
   TABLES
   ============================================================ */
.table th { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--primary-soft); }

/* ============================================================
   NOTIFICATIONS DROPDOWN
   ============================================================ */
.notif-dropdown { min-width: 320px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.notif-header { font-size: 13px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item:last-child { border-bottom: none; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-body { background: #f1f5f9; min-height: 100vh; display: flex; align-items: stretch; }

.auth-container { display: flex; width: 100%; min-height: 100vh; }

.auth-left {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 60px;
}

.auth-left-content { max-width: 400px; }

.auth-brand {
    font-size: 22px; font-weight: 800; color: #fff;
    display: flex; align-items: center;
}

.auth-tagline { font-size: 42px; font-weight: 800; color: #fff; line-height: 1.2; }
.auth-sub { color: rgba(255,255,255,.65); font-size: 16px; margin-top: 16px; }
.auth-features { display: flex; flex-direction: column; gap: 10px; }
.auth-feature { color: rgba(255,255,255,.8); font-size: 14px; }

.auth-right {
    width: 500px;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 32px;
    background: var(--card-bg);
}

.auth-card { width: 100%; max-width: 400px; }

.auth-logo-sm { font-size: 20px; font-weight: 800; color: var(--primary); }

.demo-creds .demo-role {
    cursor: pointer; padding: 8px; border-radius: 8px;
    border: 1px solid var(--border); text-align: center;
    transition: border-color .2s;
}
.demo-creds .demo-role:hover { border-color: var(--primary); background: var(--primary-soft); }

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-control, .form-select {
    border-radius: 9px;
    border-color: var(--border);
    font-size: 14px;
    padding: 9px 14px;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.input-group-text { border-radius: 9px; font-size: 14px; }
.input-group > .form-control:not(:first-child) { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.input-group > .form-control:not(:last-child) { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }

.btn { border-radius: 9px; font-weight: 600; font-size: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* ============================================================
   SIDEBAR COLLAPSED
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: flex !important; }
    .page-content { padding: 20px 16px; }
}

@media (max-width: 575.98px) {
    .quick-book-banner { flex-direction: column; align-items: flex-start; }
    .auth-right { width: 100%; }
    .stat-value { font-size: 22px; }
}
