/* Hospital & Clinic Management - Modern UI */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #14b8a6;
    --sidebar-bg: #0b1220;
    --sidebar-surface: rgba(255, 255, 255, 0.04);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: rgba(255, 255, 255, 0.72);
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #14b8a6;
    --sidebar-accent-soft: rgba(20, 184, 166, 0.16);
    --sidebar-width: 320px;
    --body-bg: #f0f9ff;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border-color: rgba(226, 232, 240, 0.8);
    --topbar-bg: #ffffff;
    --card-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --radius: 14px;
    --text: #1e293b;
    --muted: #64748b;
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    background: var(--body-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    background: #fff;
    overflow: hidden;
}

.login-hero {
    flex: 1;
    background: linear-gradient(135deg, #0f766e 0%, #0ea5e9 50%, #6366f1 100%);
    color: #fff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-hero::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.login-hero::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    bottom: -80px;
    left: -80px;
}

.login-hero-content { position: relative; z-index: 1; max-width: 480px; }

.login-hero .hero-icon {
    width: 72px;
    height: 72px;
    background: rgba(255,255,255,0.2);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(8px);
}

.login-hero h1 { font-size: 1.85rem; font-weight: 700; margin-bottom: 0.75rem; }

.login-hero p { opacity: 0.9; line-height: 1.7; font-size: 0.95rem; }

.login-features {
    list-style: none;
    padding: 0;
    margin: 2rem 0 0;
}

.login-features li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.login-features i { color: #a7f3d0; font-size: 1.1rem; }

.login-panel {
    width: 100%;
    max-width: 460px;
    padding: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.login-card {
    width: 100%;
    border: none;
    box-shadow: none;
}

.login-card .form-label { font-weight: 600; font-size: 0.85rem; color: var(--text); }

.login-card .form-control {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
}

.btn-login {
    background: linear-gradient(135deg, #0ea5e9, #14b8a6);
    border: none;
    padding: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35);
    background: linear-gradient(135deg, #0284c7, #0d9488);
}

.input-group-icon {
    position: relative;
}

.input-group-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    z-index: 5;
}

.input-group-icon .form-control { padding-left: 2.5rem; }

.password-toggle-group .btn-password-toggle {
    border-color: var(--bs-border-color, #dee2e6);
    min-width: 2.75rem;
    cursor: pointer;
}
.password-toggle-group .btn-password-toggle:hover {
    background: var(--bs-light, #f8f9fa);
}
.password-toggle-group .btn-password-toggle i {
    pointer-events: none;
}

/* ========== SIDEBAR ========== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 8px 0 32px rgba(2, 6, 23, 0.28);
    transition: transform 0.28s ease;
}

.sidebar-brand {
    flex-shrink: 0;
    padding: 0rem 0rem 0rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0rem;
    text-decoration: none;
    color: inherit;
    padding: 0.35rem;
    border-radius: 12px;
    transition: background 0.2s;
}

.sidebar-brand-link:hover {
    background: var(--sidebar-surface);
    color: inherit;
}

.sidebar-brand-icon {
    width: 200px;
    height:110px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.28);
    flex-shrink: 0;
}

.sidebar-brand-icon--logo {
  
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    padding: 4px;
}

.sidebar-brand-icon--logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand-title {
    font-weight: 800;
    font-size: 1.02rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #fff;
}

.sidebar-brand-sub {
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.48);
    letter-spacing: 0.02em;
    margin-top: 0.1rem;
}

.sidebar-nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.65rem 1rem 0.85rem 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

.sidebar-nav {
    gap: 0.15rem;
}

.sidebar-section {
    list-style: none;
    padding: 1rem 0.75rem 0.45rem;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.34);
}

.sidebar-link {
    color: var(--sidebar-text);
    padding: 0.62rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.86rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid transparent;
    position: relative;
}

.sidebar-link:hover {
    background: var(--sidebar-surface);
    color: var(--sidebar-text-active);
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(20, 184, 166, 0.22) 0%, rgba(14, 165, 233, 0.12) 100%);
    color: var(--sidebar-text-active);
    border-color: rgba(20, 184, 166, 0.22);
    box-shadow: inset 3px 0 0 var(--sidebar-accent);
}

.nav-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-link:hover .nav-icon-wrap {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-link.active .nav-icon-wrap {
    background: rgba(20, 184, 166, 0.22);
    color: #5eead4;
}

.nav-link-text {
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.35;
    word-break: break-word;
}

/* Submenu parent arrow (^) — text wraps to 2nd line; arrow stays fixed on right */
.nav-group .nav-group-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    padding-right: 2.15rem !important;
    overflow: visible;
}
.nav-group .nav-group-toggle-inner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
    overflow: visible;
}
.nav-group .nav-group-label {
    min-width: 0;
    flex: 1 1 auto;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.35;
    word-break: break-word;
}
.nav-group .nav-group-chevron {
    position: absolute !important;
    right: 0.55rem;
    top: 50%;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0 !important;
    font-size: 0.8rem !important;
    color: #5eead4 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none;
    z-index: 2;
    transition: transform 0.22s ease;
    transform: translateY(-50%) rotate(180deg);
}
.nav-group.open .nav-group-chevron {
    transform: translateY(-50%) rotate(0deg);
}

/* Long submenu labels wrap to 2nd line */
.nav-submenu-link {
    align-items: flex-start !important;
}
.nav-submenu-link .nav-link-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.35;
    word-break: break-word;
}
.nav-submenu-link .nav-submenu-dot {
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 0.85rem 0.95rem 1rem;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.18);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 14px;
    background: var(--sidebar-surface);
    border: 1px solid var(--sidebar-border);
    margin-bottom: 0.65rem;
}

.sidebar-user-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #0ea5e9, #14b8a6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.sidebar-user-meta {
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.52);
    margin-top: 0.15rem;
}

.sidebar-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
    flex-shrink: 0;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(248, 113, 113, 0.22);
    background: rgba(239, 68, 68, 0.08);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sidebar-logout-btn:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(248, 113, 113, 0.35);
}

.sidebar-powered-by {
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.7rem;
    min-height: 28px;
    padding-top: 0.65rem;
}

.sidebar-powered-label {
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.sidebar-powered-logo {
    display: block;
    height: 18px;
    max-width: 92px;
    object-fit: contain;
    opacity: 0.9;
    width: auto;
}

.sidebar-powered-fallback {
    color: rgba(255, 255, 255, 0.78);
    display: none;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.sidebar-powered-by:hover .sidebar-powered-logo {
    opacity: 1;
}

/* Legacy sidebar markup fallback (older project pages) */
.sidebar .nav-section {
    padding: 1rem 0.75rem 0.45rem;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.34);
}
.sidebar .nav-link:not(.sidebar-link):not(.nav-group-toggle) {
    color: var(--sidebar-text);
    padding: 0.62rem 0.75rem;
    margin: 0.1rem 0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.86rem;
}
.sidebar .nav-link:not(.sidebar-link):not(.nav-group-toggle):hover,
.sidebar .nav-link:not(.sidebar-link):not(.nav-group-toggle).active {
    background: var(--sidebar-surface);
    color: #fff;
}
.sidebar .nav-link.logout {
    margin-top: 0.65rem;
    justify-content: center;
    border: 1px solid rgba(248, 113, 113, 0.22);
    background: rgba(239, 68, 68, 0.08);
}
.sidebar-user .avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #0ea5e9, #14b8a6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 14px;
    background: var(--sidebar-surface);
    border: 1px solid var(--sidebar-border);
}

/* ========== MAIN LAYOUT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--body-bg);
    transition: margin-left 0.28s ease;
}

.top-bar {
    background: var(--topbar-bg);
    padding: 1rem 1.75rem;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.top-bar .page-title {
    font-weight: 700;
    font-size: 1.15rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-bar .page-title i {
    color: var(--primary);
}

.top-bar-meta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.topbar-icon-btn:hover {
    background: var(--surface);
    color: var(--primary);
    border-color: rgba(14, 165, 233, 0.35);
}

.theme-toggle-btn .theme-icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle-btn .theme-icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle-btn .theme-icon-sun {
    display: inline;
}

.top-bar .date-badge {
    background: var(--surface-muted);
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.top-bar .welcome-text {
    font-size: 0.9rem;
    color: var(--muted);
}

.top-bar .welcome-text strong { color: var(--text); }

.page-content { padding: 1.5rem 1.75rem 2rem; }

/* Welcome banner */
.welcome-banner {
    background: linear-gradient(135deg, #0f766e 0%, #0ea5e9 100%);
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
    color: #fff;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.welcome-banner h4 { font-weight: 700; margin-bottom: 0.35rem; position: relative; z-index: 1; }
.welcome-banner p { opacity: 0.9; margin: 0; font-size: 0.9rem; position: relative; z-index: 1; }

/* Stat cards */
.stat-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s;
    background: #fff;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
}

.stat-card .card-body { padding: 1.25rem; }

.stat-card.stat-doctors { border-top: 4px solid #0ea5e9; }
.stat-card.stat-patients { border-top: 4px solid #14b8a6; }
.stat-card.stat-appointments { border-top: 4px solid #f59e0b; }
.stat-card.stat-bills { border-top: 4px solid #ef4444; }

.stat-card .icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card h3 {
    font-weight: 700;
    font-size: 1.75rem;
    color: var(--text);
}

.stat-card small { color: var(--muted); font-weight: 500; }

/* Quick action cards */
.quick-action {
    display: block;
    text-decoration: none;
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: all 0.25s;
    border: 2px solid transparent;
    color: var(--text);
}

.quick-action:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.15);
}

.quick-action i {
    font-size: 1.75rem;
    display: block;
    margin-bottom: 0.5rem;
}

.quick-action span { font-weight: 600; font-size: 0.85rem; }

/* Cards & tables */
.table-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.table-card .card-header-custom {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-card .card-header-custom i { color: var(--primary); }

.search-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.85rem 1rem;
}

.table tbody td {
    padding: 0.9rem 1rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background: #f0f9ff;
}

/* Buttons */
.btn {
    border-radius: 9px;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    border: none;
}

.btn-success { background: linear-gradient(135deg, #14b8a6, #0d9488); border: none; }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); border: none; color: #fff; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); border: none; }
.btn-info { background: linear-gradient(135deg, #06b6d4, #0891b2); border: none; color: #fff; }

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.form-control {
    padding: 0.6rem 0.9rem;
}

.form-select {
    padding: 0.6rem 2.25rem 0.6rem 0.9rem;
    background-position: right 0.75rem center;
}

.form-select.form-select-sm {
    padding: 0.35rem 2rem 0.35rem 0.65rem;
    background-position: right 0.5rem center;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
}

/* Status badges */
.badge {
    font-weight: 600;
    padding: 0.4em 0.75em;
    border-radius: 6px;
}

.badge-status-scheduled { background: #fef3c7; color: #b45309; }
.badge-status-completed { background: #d1fae5; color: #047857; }
.badge-status-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-status-pending { background: #ffedd5; color: #c2410c; }
.badge-status-paid { background: #d1fae5; color: #047857; }
.badge-status-partial { background: #e0e7ff; color: #4338ca; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
}

.empty-state i { font-size: 2.5rem; opacity: 0.4; }

/* Print */
@media print {
    .sidebar, .top-bar, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
}

@media (max-width: 992px) {
    .login-hero { display: none; }
    .login-panel { max-width: 100%; }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 0.85rem 1rem;
    }
    .top-bar .page-title {
        font-size: 1rem;
    }
    .page-content {
        padding: 1rem 1rem 1.5rem;
    }
}
