/* =====================================================
   Grace Specialty Dental & Orthodontics Center
   Premium Medical Dashboard Theme
   Colors matched to brand logo: Purple #3b1f8e + Cyan #0891b2
   ===================================================== */

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

:root {
    --primary: #3b1f8e;
    --primary-dark: #2d1770;
    --primary-light: #5b3fbf;
    --accent: #0891b2;
    --accent-dark: #0e7490;
    --accent-light: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #6366f1;
    --sidebar-bg: #0f0a24;
    --sidebar-hover: #1a1340;
    --sidebar-active: linear-gradient(135deg, #3b1f8e, #0891b2);
    --sidebar-text: #a5a0c8;
    --sidebar-width: 260px;
    --header-height: 60px;
    --body-bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.1);
    --radius: 10px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Layout ===== */
.app-wrapper { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    width: 36px; height: 36px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 100%; height: 100%; object-fit: cover;
}

.sidebar-title {
    font-size: 17px; font-weight: 800;
    background: linear-gradient(135deg, #c4b5fd, var(--accent-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

.sidebar-toggle { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; margin-left: auto; }

.sidebar-menu { flex: 1; padding: 12px 10px; }

.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; margin: 2px 0;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 13.5px; font-weight: 500;
    transition: var(--transition);
}

.sidebar-link:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 2px 10px rgba(59,31,142,0.4);
}
.sidebar-link svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 12px 14px; }

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

.sidebar-user { display: flex; align-items: center; gap: 10px; }

.sidebar-user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px;
}

.sidebar-user-name { color: #e2e8f0; font-size: 13px; font-weight: 600; }
.sidebar-user-role { color: var(--sidebar-text); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }

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

.top-header {
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky; top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.page-title { font-size: 18px; font-weight: 700; margin: 0; color: var(--text); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.header-date { color: var(--text-muted); font-size: 13px; }

.sidebar-toggle-btn { display: none; color: var(--text); }

.content-area { flex: 1; padding: 20px 24px; }

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 0;
}

.card-header {
    padding: 14px 18px;
    background: transparent;
    border-bottom: 1px solid var(--border);
}

.card-title { font-size: 15px; font-weight: 700; }
.card-body { padding: 18px; }

/* ===== Stat Cards ===== */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card-primary::before { background: linear-gradient(180deg, var(--primary), var(--accent)); }
.stat-card-success::before { background: var(--success); }
.stat-card-warning::before { background: var(--warning); }
.stat-card-info::before { background: var(--info); }

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

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

.stat-card-primary .stat-icon { background: rgba(59,31,142,0.08); color: var(--primary); }
.stat-card-success .stat-icon { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-card-warning .stat-icon { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-card-info .stat-icon { background: rgba(99,102,241,0.1); color: var(--info); }

.stat-value { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ===== Tables ===== */
.table { font-size: 13px; }
.table th { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-top: none; background: #f8fafc; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f5f3ff; }

/* ===== Buttons ===== */
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); border: none; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--accent-dark)); box-shadow: 0 2px 8px rgba(59,31,142,0.3); }
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(59,31,142,0.2); }
.btn { border-radius: 8px; font-weight: 500; font-size: 13px; padding: 6px 14px; transition: var(--transition); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

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

/* ===== Forms ===== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
    padding: 8px 12px;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,31,142,0.1); }
.form-label { font-weight: 600; font-size: 12.5px; color: var(--text); margin-bottom: 4px; }

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

/* ===== Alerts ===== */
.alert { border-radius: 8px; font-size: 13px; }
.alert-sm { padding: 8px 12px; font-size: 12px; }

/* ===== Patient Profile ===== */
.patient-avatar {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 28px; font-weight: 800;
}

/* ===== Auth Page ===== */
.auth-body {
    background: linear-gradient(135deg, #0f0a24 0%, #1e1b4b 40%, #0e7490 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
}

.auth-wrapper { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.35);
    text-align: center;
}

.auth-logo { margin-bottom: 14px; }
.auth-title { font-size: 26px; font-weight: 800; color: var(--primary); margin-bottom: 2px; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.auth-form { text-align: left; }
.auth-form .form-control { padding: 10px 14px; }
.btn-login { padding: 11px; font-weight: 700; font-size: 15px; margin-top: 6px; }
.auth-hint { text-align: center; margin-top: 16px; }
.auth-footer { text-align: center; color: rgba(255,255,255,0.35); font-size: 12px; margin-top: 20px; }

/* ===== Dental Chart ===== */
.dental-chart-container { text-align: center; padding: 10px 0; }
.jaw-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin: 8px 0; }

.dental-row { display: flex; justify-content: center; align-items: center; gap: 2px; margin: 4px 0; }
.quadrant { display: flex; gap: 2px; }
.jaw-divider { padding: 0 8px; font-size: 20px; color: var(--border); font-weight: 300; }

.tooth-cell {
    cursor: pointer;
    width: 44px;
    transition: var(--transition);
    border-radius: 6px;
    padding: 2px;
}

.tooth-cell:hover { background: rgba(59,31,142,0.08); transform: scale(1.1); }
.tooth-cell.selected { background: rgba(59,31,142,0.15); outline: 2px solid var(--primary); }
.tooth-svg { width: 100%; height: auto; }
.tooth-shape { transition: var(--transition); }

/* ===== Calendar ===== */
.calendar-grid { }
.cal-header { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; margin-bottom: 4px; }
.cal-day-name { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); padding: 6px; text-transform: uppercase; }
.cal-body { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-cell { min-height: 80px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 4px; padding: 4px; }
.cal-empty { background: #f8fafc; border-color: transparent; }
.cal-today { background: #f5f3ff; border-color: var(--primary); }
.cal-date { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.cal-today .cal-date { color: var(--primary); }
.cal-event { display: block; font-size: 10px; color: #fff; padding: 1px 4px; border-radius: 3px; margin: 1px 0; text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-event:hover { opacity: 0.8; color: #fff; }

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .sidebar-toggle-btn { display: block; }
    .main-content { margin-left: 0; }
}

@media (max-width: 767.98px) {
    .content-area { padding: 12px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 18px; }
    .tooth-cell { width: 32px; }
    .cal-cell { min-height: 50px; }
}

/* ===== Print Styles ===== */
@media print {
    .sidebar, .top-header, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .content-area { padding: 0; }
    .card { border: none; box-shadow: none; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Nav Tabs ===== */
.nav-tabs .nav-link { font-size: 13px; font-weight: 600; color: var(--text-muted); border: none; padding: 10px 16px; }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom: 2px solid var(--primary); background: transparent; }

/* ===== Gradient Text ===== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Smooth Loading ===== */
.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
