/* ============================================================
   CLINIC MANAGEMENT SYSTEM - STYLESHEET
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
    --primary: #0f766e;
    --primary-dark: #0d5c56;
    --primary-light: #e6f7f6;
    --accent: #f59e0b;
    --sidebar-bg: #0f1923;
    --sidebar-text: #94a3b8;
    --sidebar-active: #0f766e;
    --sidebar-hover: #1e2d3d;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --info: #0284c7;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

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

.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-size: 16px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    font-size: 11px;
    color: var(--sidebar-text);
    font-weight: 400;
}

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

.nav-section-title {
    padding: 8px 24px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(148,163,184,0.5);
    margin-top: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.15s ease;
    position: relative;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-nav a.active {
    background: rgba(15,118,110,0.2);
    color: #5eead4;
    border-right: 3px solid var(--primary);
}

.sidebar-nav a .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-user {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info .user-name { font-size: 13px; font-weight: 600; color: white; }
.user-info .user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }

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

.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

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

.page-content {
    padding: 28px;
    flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0 !important;
}

.card-header h5, .card-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--text-main);
}

.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.teal    { background: #e6f7f6; color: var(--primary); }
.stat-icon.amber   { background: #fef3c7; color: var(--accent); }
.stat-icon.blue    { background: #dbeafe; color: var(--info); }
.stat-icon.green   { background: #dcfce7; color: var(--success); }
.stat-icon.red     { background: #fee2e2; color: var(--danger); }
.stat-icon.purple  { background: #ede9fe; color: #7c3aed; }

.stat-info .stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-main);
}

.stat-info .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    overflow-x: auto;
    border-radius: 0 0 12px 12px;
}

.table { margin: 0; font-size: 14px; }
.table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    white-space: nowrap;
}
.table td {
    padding: 13px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f8fafc; }

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,118,110,0.1);
    outline: none;
}

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

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    border-radius: 8px;
    padding: 8px 16px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1a3a4a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    color: white;
}

.login-logo .logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.login-logo .logo-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    font-family: 'Instrument Serif', serif;
}

.login-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { border-radius: 10px; font-size: 14px; border: none; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-danger  { background: #fee2e2; color: #b91c1c; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #dbeafe; color: #1d4ed8; }

/* ============================================================
   MISC
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h4 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.breadcrumb { font-size: 13px; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

.search-bar {
    position: relative;
}
.search-bar .search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-bar input { padding-left: 36px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* Invoice print styles */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { box-shadow: none !important; border: none !important; }
}
