/* ============================================================
   DENTAL CARE MANAGEMENT SYSTEM — STYLES
   Clean Medical Professional Theme
   ============================================================ */

:root {
    --primary: #0b6e4f;
    --primary-light: #e8f5f0;
    --primary-mid: #1a9970;
    --accent: #f0a500;
    --accent-light: #fff8e6;
    --danger: #dc3545;
    --danger-light: #fdf0f0;
    --warning: #fd7e14;
    --info: #0dcaf0;
    --success: #198754;
    --bg: #f4f7f9;
    --sidebar-bg: #0a1628;
    --sidebar-width: 260px;
    --topbar-h: 64px;
    --card-shadow: 0 2px 12px rgba(0,0,0,.06);
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --white: #ffffff;
    --radius: 12px;
    --transition: .2s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

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

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

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

.brand-text { display: flex; flex-direction: column; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { color: rgba(255,255,255,.4); font-size: 10px; text-transform: uppercase; letter-spacing: .8px; }

.sidebar-close {
    background: none; border: none; color: rgba(255,255,255,.5);
    font-size: 18px; cursor: pointer; padding: 4px;
}

.clinic-badge {
    margin: 12px 16px;
    padding: 8px 12px;
    background: rgba(11,110,79,.3);
    border: 1px solid rgba(11,110,79,.4);
    border-radius: 8px;
    color: #7de0bf;
    font-size: 11px;
    font-weight: 600;
    display: flex; align-items: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sidebar-menu {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
}

.menu-label {
    color: rgba(255,255,255,.3);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    padding: 16px 8px 6px;
    text-transform: uppercase;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.6);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.menu-item i { width: 18px; text-align: center; font-size: 14px; }

.menu-item:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}

.menu-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-mid));
    color: #fff;
    box-shadow: 0 4px 12px rgba(11,110,79,.4);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    text-decoration: none;
    min-width: 0;
}

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-mid));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.4); font-size: 11px; }

.btn-logout {
    width: 34px; height: 34px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.5);
    text-decoration: none;
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-logout:hover { background: rgba(220,53,69,.2); color: #ff6b7a; border-color: rgba(220,53,69,.3); }

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

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

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

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

.btn-hamburger {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--transition);
    display: none;
}
.btn-hamburger:hover { background: var(--bg); color: var(--text); }

.topbar-btn {
    width: 38px; height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
    position: relative;
    text-decoration: none;
}
.topbar-btn:hover { background: var(--bg); color: var(--text); }
.topbar-btn.dropdown-toggle::after { display: none; }

.notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.user-avatar-sm {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-mid));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 11px;
}

.clinic-switcher .dropdown-toggle {
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap;
    width: auto; padding: 0 12px;
    font-size: 13px; font-weight: 600; color: var(--primary);
    border-color: var(--primary-light);
    background: var(--primary-light);
}

/* ============================================================
   CONTENT BODY
   ============================================================ */
.content-body {
    padding: 24px;
    flex: 1;
}

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

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

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex; align-items: center; gap: 8px;
}

.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(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.green  { background: var(--primary-light); color: var(--primary); }
.stat-icon.orange { background: #fff3e0; color: #f57c00; }
.stat-icon.blue   { background: #e3f2fd; color: #1976d2; }
.stat-icon.red    { background: #fce4ec; color: #c62828; }
.stat-icon.purple { background: #f3e5f5; color: #7b1fa2; }
.stat-icon.teal   { background: #e0f2f1; color: #00695c; }

.stat-info .stat-value {
    font-size: 26px; font-weight: 800; color: var(--text); line-height: 1;
}
.stat-info .stat-label {
    font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 4px;
}
.stat-info .stat-change {
    font-size: 11px; font-weight: 600; margin-top: 4px;
    display: flex; align-items: center; gap: 3px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .7;
}

.status-scheduled  { background: #e3f2fd; color: #1565c0; }
.status-confirmed  { background: #e8f5e9; color: #2e7d32; }
.status-inprogress { background: #fff8e1; color: #f57f17; }
.status-completed  { background: #e8f5e9; color: var(--primary); }
.status-cancelled  { background: #fce4ec; color: #c62828; }
.status-noshow     { background: #ede7f6; color: #4527a0; }
.status-pending    { background: #fff3e0; color: #e65100; }
.status-paid       { background: #e8f5e9; color: #2e7d32; }
.status-partial    { background: #fff8e1; color: #f57f17; }
.status-overdue    { background: #fce4ec; color: #c62828; }

/* ============================================================
   FORMS
   ============================================================ */
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13.5px;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11,110,79,.12);
    outline: none;
}
textarea.form-control { resize: vertical; min-height: 90px; }
.input-group-text { background: var(--bg); border-color: var(--border); font-size: 13px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    border-radius: 8px;
    padding: 8px 16px;
    transition: all var(--transition);
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #085b40; border-color: #085b40; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============================================================
   TABLES
   ============================================================ */
.table { font-size: 13.5px; }
.table th {
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    padding: 12px 16px;
}
.table td { padding: 12px 16px; vertical-align: middle; border-color: var(--border); }
.table tbody tr:hover { background: var(--primary-light); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination .page-link { font-size: 13px; border-radius: 6px; margin: 0 2px; color: var(--primary); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ============================================================
   TOOTH CHART
   ============================================================ */
.tooth-chart { display: grid; gap: 4px; max-width: 600px; margin: 0 auto; }
.tooth-row { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.tooth {
    width: 38px; height: 44px;
    border: 2px solid var(--border);
    border-radius: 8px 8px 12px 12px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--white);
    position: relative;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}
.tooth:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.tooth.has-treatment { background: #fff8e1; border-color: var(--accent); color: var(--accent); }
.tooth.completed    { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.tooth.selected     { background: var(--primary); border-color: var(--primary); color: #fff; }
.tooth.problem      { background: #fce4ec; border-color: #e91e63; color: #c62828; }
.tooth-num { font-size: 9px; line-height: 1; }
.tooth-icon { font-size: 14px; line-height: 1; }

/* ============================================================
   VOICE ASSISTANT
   ============================================================ */
.voice-container {
    background: linear-gradient(135deg, #0a1628, #0d2040);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    color: #fff;
}

.voice-orb {
    width: 120px; height: 120px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-mid));
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
    cursor: pointer;
    transition: all .3s ease;
    box-shadow: 0 0 0 0 rgba(11,110,79,.4);
    position: relative;
}

.voice-orb.listening {
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(11,110,79,.6); }
    70%  { box-shadow: 0 0 0 30px rgba(11,110,79,0); }
    100% { box-shadow: 0 0 0 0 rgba(11,110,79,0); }
}

.voice-wave {
    display: flex; gap: 4px; align-items: center; justify-content: center; height: 30px;
    margin: 12px 0;
}
.voice-wave span {
    display: block;
    width: 4px;
    background: var(--primary-mid);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}
.voice-wave span:nth-child(2) { animation-delay: .1s; }
.voice-wave span:nth-child(3) { animation-delay: .2s; }
.voice-wave span:nth-child(4) { animation-delay: .3s; }
.voice-wave span:nth-child(5) { animation-delay: .4s; }

@keyframes wave {
    0%, 100% { height: 6px; }
    50%       { height: 28px; }
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-content { border-radius: var(--radius); border: none; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 20px; border-top: 1px solid var(--border); }

/* ============================================================
   UTILITIES
   ============================================================ */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

.section-title {
    font-size: 18px; font-weight: 800; color: var(--text);
    display: flex; align-items: center; gap: 8px;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; opacity: .25; margin-bottom: 12px; }
.empty-state p { font-size: 15px; font-weight: 600; }

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

/* progress bars */
.progress { height: 8px; border-radius: 99px; }
.progress-bar { border-radius: 99px; background: var(--primary); }

/* invoice print */
.invoice-print { background: #fff; padding: 40px; max-width: 800px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .btn-hamburger { display: flex; }
    .content-body { padding: 16px; }
    .topbar { padding: 0 16px; }
    .page-title { font-size: 14px; }
}

@media (max-width: 575px) {
    .stat-card { padding: 14px; }
    .stat-icon { width: 44px; height: 44px; font-size: 18px; }
    .stat-info .stat-value { font-size: 22px; }
    .tooth { width: 30px; height: 36px; }
    .tooth-icon { font-size: 11px; }
    .voice-container { padding: 24px 16px; }
    .voice-orb { width: 90px; height: 90px; font-size: 30px; }
    .card-body { padding: 14px; }
    .modal-body { padding: 16px; }
}

/* ============================================================
   DATATABLES OVERRIDES
   ============================================================ */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
}
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
}
.dataTables_wrapper .dataTables_info { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   CHART CONTAINERS
   ============================================================ */
.chart-container { position: relative; height: 280px; }

/* ============================================================
   FLATPICKR OVERRIDES
   ============================================================ */
.flatpickr-calendar { font-family: inherit; border-radius: var(--radius); }
.flatpickr-day.selected { background: var(--primary); border-color: var(--primary); }
.flatpickr-day.selected:hover { background: #085b40; border-color: #085b40; }

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }

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

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 80px rgba(0,0,0,.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .brand-icon {
    width: 60px; height: 60px; font-size: 26px;
    margin: 0 auto 12px;
}

.login-logo h2 {
    font-size: 22px; font-weight: 800; color: var(--text);
}

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

@media print {
    .sidebar, .topbar, .btn, .no-print { display: none !important; }
    .main-content { margin: 0; }
    .invoice-print { box-shadow: none; }
}
