/* Global styles */
* {
    box-sizing: border-box;
}
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f5f7;
    color: #222;
}
a {
    text-decoration: none;
    color: #007bff;
}
.btn-primary {
    display: inline-block;
    background: #007bff;
    color: #fff;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.btn-primary:hover {
    background: #005fce;
}
.btn-secondary {
    display: inline-block;
    background: #6c757d;
    color: #fff;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.btn-secondary:hover {
    background: #565e64;
}

/* ================= LAYOUT ================= */
/* Sidebar + navbar + main content form a fixed-sidebar admin shell.
   None of this existed before - the panel rendered as a plain unstyled
   stack of links and text. */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 230px;
    height: 100vh;
    background: #1f2937;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.25s ease;
}
.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 70px 0 20px;
}
.sidebar li a {
    display: block;
    padding: 12px 24px;
    color: #cbd5e1;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}
.sidebar li a:hover {
    background: #111827;
    color: #fff;
    border-left-color: #007bff;
}

.navbar {
    position: fixed;
    top: 0;
    left: 230px;
    right: 0;
    height: 60px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 90;
}
.navbar h2 {
    font-size: 1.1rem;
    margin: 0;
}
.navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.navbar .nav-right a {
    color: #333;
    font-size: 0.9rem;
}
.navbar .nav-right a:hover {
    color: #007bff;
}
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    margin-right: 12px;
}

main, .content-wrapper {
    margin-left: 230px;
    padding: 90px 30px 40px;
}

/* Only offset content when a .sidebar is actually present earlier in the
   DOM (i.e. not on login.php, which intentionally has no sidebar/navbar) */
.sidebar ~ section {
    margin-left: 230px;
    padding-top: 90px;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .navbar {
        left: 0;
    }
    .sidebar-toggle {
        display: inline-block;
    }
    main, .content-wrapper,
    .sidebar ~ section {
        margin-left: 0;
    }
}

/* ================= CONTENT ================= */
h1 {
    font-size: 1.6rem;
    margin-bottom: 20px;
}
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
table th, table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}
table th {
    background: #f8f9fa;
    font-weight: 600;
}

.dashboard .cards,
.admin-home .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    font-weight: 600;
    color: #444;
}

.loader {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

footer {
    padding: 20px 30px;
    color: #888;
    font-size: 0.85rem;
}
.sidebar ~ footer {
    margin-left: 230px;
}
@media (max-width: 900px) {
    .sidebar ~ footer { margin-left: 0; }
}

/* ================= LOGIN PAGE ================= */
.login-page {
    max-width: 380px;
    margin: 80px auto;
    background: #fff;
    padding: 40px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.login-page h1 {
    text-align: center;
    font-size: 1.4rem;
}
.login-page form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-page label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
}
.login-page input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
}
.login-page button {
    margin-top: 10px;
    padding: 10px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}
.login-page button:hover {
    background: #005fce;
}
.login-page .form-error {
    background: #fdecea;
    color: #b3261e;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    display: none;
}
.login-page .form-error.active {
    display: block;
}

/* =========================================================================
   MODERN ADMIN COMPONENTS — dashboard head, stat cards, panels, calendar,
   upcoming list, status pills. Shared across dashboard + appointments so
   they work regardless of which $pageCss module file is also loaded.
   ========================================================================= */
.dashboard-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.dashboard-head h1 { margin-bottom: 6px; }
.dashboard-sub { color: #6b7280; font-size: 0.92rem; margin: 0; }

.btn-admin-primary {
    display: inline-block;
    background: #1f2937;
    color: #fff;
    padding: 11px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s ease;
}
.btn-admin-primary:hover { background: #007bff; }

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 22px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-top: 3px solid #007bff;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    font-weight: 600;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
    align-items: start;
}
@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.dashboard-panel {
    background: #fff;
    border-radius: 10px;
    padding: 22px 24px 26px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 22px;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.panel-head h2 { font-size: 1.1rem; margin: 0; }
.panel-link { font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.dashboard-empty { color: #9ca3af; font-size: 0.9rem; padding: 12px 0; }

/* -- Upcoming appointments list -- */
.upcoming-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.upcoming-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 6px;
    border-bottom: 1px solid #f1f2f4;
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: #eef2ff;
    color: #1f2937;
    flex-shrink: 0;
}
.upcoming-day { font-weight: 700; font-size: 1rem; line-height: 1.1; }
.upcoming-mon { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; color: #6b7280; }
.upcoming-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.upcoming-info strong { font-size: 0.92rem; color: #1f2937; }
.upcoming-info span { font-size: 0.82rem; color: #6b7280; }

.status-pill {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 999px;
    white-space: nowrap;
    background: #eee;
    color: #555;
}
.status-pill--pending { background: #fef3c7; color: #92400e; }
.status-pill--approved { background: #dbeafe; color: #1e40af; }
.status-pill--completed { background: #dcfce7; color: #166534; }
.status-pill--cancelled { background: #fee2e2; color: #991b1b; }
.status-pill--rescheduled { background: #ede9fe; color: #5b21b6; }

/* -- Admin data table -- */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #f1f2f4; font-size: 0.88rem; }
.admin-table th { color: #6b7280; font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.03em; }

/* -- Monthly calendar grid (dashboard preview + full calendar page) -- */
.dashboard-calendar-panel .panel-head { justify-content: space-between; }
.dashboard-calendar-panel--full .panel-head { justify-content: space-between; }
.kg-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
    margin-bottom: 8px;
}
.kg-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.kg-cal-cell {
    min-height: 64px;
    border-radius: 6px;
    background: #f9fafb;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}
.kg-cal-cell--empty { background: transparent; }
.kg-cal-cell--today { background: #eef2ff; box-shadow: inset 0 0 0 1.5px #007bff; }
.kg-cal-cell--has-appts { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.kg-cal-daynum { font-size: 0.78rem; font-weight: 600; color: #374151; }
.kg-cal-appts { display: flex; flex-direction: column; gap: 2px; }
.kg-cal-appt-pill {
    font-size: 0.64rem;
    background: #eef2ff;
    color: #1e3a8a;
    border-radius: 3px;
    padding: 2px 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kg-cal-more { font-size: 0.62rem; color: #9ca3af; }

@media (max-width: 700px) {
    .kg-cal-cell { min-height: 44px; }
    .kg-cal-appt-pill, .kg-cal-more { display: none; }
}

