/* ═══════════════════════════════════════════════════════════
   Kaizen Dental App — Global Stylesheet  (mobile-first)
   Breakpoints: xs <600px | sm 600-960px | md 960px+
   ═══════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Tai Lue';
    src: url('../fonts/ntailu.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* ── CSS Variables ─────────────────────────────────────── */
:root {
    --df-navy: #0A1F44;
    --df-gold: #D4AF37;
    --df-bg: #F5F5F5;
    --df-surface: #FFFFFF;
    --df-border: #eaecf0;
    --df-muted: #9ca3af;
    --mud-palette-primary: #0A1F44;
    --mud-palette-secondary: #D4AF37;
    --mud-palette-background: #F5F5F5;
    --mud-palette-surface: #FFFFFF;
    --appbar-height: 56px;
    --bottom-nav-height: 60px;
}

/* ── Base ──────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--df-bg);
    font-family: 'Tai Lue',Roboto,Helvetica,Arial,sans-serif;
    overscroll-behavior: none;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--df-bg);
}

::-webkit-scrollbar-thumb {
    background: rgba(10,31,68,.25);
    border-radius: 3px;
}

/* ── App Bar ───────────────────────────────────────────── */
.appbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.brand-name {
    font-size: 17px;
    font-weight: 800;
    color: #D4AF37;
    white-space: nowrap;
}
/* ── User menu ─────────────────────────────────────────── */
/* ── User area in appbar (logout via sidebar nav) ─────── */
.appbar-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.appbar-username {
    font-size: 13px;
    color: rgba(255,255,255,.9);
    display: none;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media(min-width:480px) {
    .appbar-username {
        display: inline;
    }
}

.appbar-page-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.6);
    display: none;
}

@media(max-width:959px) {
    .appbar-page-title {
        display: inline;
    }
}

/* ── Drawer ────────────────────────────────────────────── */
.drawer-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    min-height: 56px;
}

@media(max-width:959px) {
    .drawer-header {
        display: flex;
    }
}

.mud-nav-link {
    min-height: 44px !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    margin-bottom: 2px !important;
}

    .mud-nav-link:hover {
        background-color: rgba(255,255,255,.1) !important;
    }

    .mud-nav-link.active {
        background-color: rgba(212,175,55,.18) !important;
        border-left: 3px solid #D4AF37 !important;
    }

/* ── Main Content ──────────────────────────────────────── */
/* MudMainContent auto-handles AppBar offset via --mud-appbar-height */
/* MudMainContent automatically pads for AppBar height — no override needed */
.page-wrapper {
    padding: 16px 12px calc(var(--bottom-nav-height) + 16px);
    max-width: 1600px;
    margin: 0 auto;
}

@media (min-width: 600px) {
    .page-wrapper {
        padding: 16px 16px calc(var(--bottom-nav-height) + 16px);
    }
}

@media (min-width: 960px) {
    .page-wrapper {
        padding: 20px 24px 24px;
    }
}

/* ── Bottom Nav Bar (mobile only) ──────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: #fff;
    border-top: 1px solid var(--df-border);
    display: flex;
    align-items: stretch;
    z-index: 1200;
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media(min-width:960px) {
    .bottom-nav {
        display: none;
    }
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    color: var(--df-muted);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 4px;
    transition: color .14s;
    -webkit-tap-highlight-color: transparent;
}

    .bottom-nav-item.active, .bottom-nav-item:active {
        color: var(--df-navy);
    }

        .bottom-nav-item.active .bottom-nav-icon {
            background: rgba(10,31,68,.1);
            border-radius: 14px;
            padding: 2px 14px;
        }

.bottom-nav-icon {
    font-size: 22px !important;
    transition: all .14s;
}

/* ── Cards / Paper ─────────────────────────────────────── */
@media(max-width:599px) {
    .mud-card, .mud-paper {
        border-radius: 12px !important;
    }

    .mud-card-content {
        padding: 14px !important;
    }
}

/* ── Tables ────────────────────────────────────────────── */
.mud-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mud-table-row:hover {
    background-color: rgba(10,31,68,.04) !important;
    cursor: pointer;
}

@media(max-width:599px) {
    .mud-table-cell {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }

    .mud-table-head .mud-table-cell {
        font-size: 10px !important;
    }
}

/* ── Forms ─────────────────────────────────────────────── */
@media(max-width:959px) {
    .mud-input-control {
        margin-bottom: 4px;
    }

    .mud-input.mud-input-outlined .mud-input-slot {
        padding-top: 14px !important;
        padding-bottom: 14px !important;
    }
}

/* ── Buttons / Icon Buttons ────────────────────────────── */
@media(max-width:959px) {
    .mud-button-root {
        min-height: 40px;
    }

    .mud-icon-button {
        padding: 10px !important;
        min-width: 44px;
        min-height: 44px;
    }
}

/* ── Dialogs ───────────────────────────────────────────── */
@media(max-width:480px) {
    .mud-dialog {
        margin: 8px !important;
        max-height: calc(100vh - 16px) !important;
    }

    .mud-dialog-content {
        padding: 12px 16px !important;
    }
}

/* ── Typography ────────────────────────────────────────── */
@media(max-width:599px) {
    .mud-typography-h4 {
        font-size: 1.4rem !important;
    }

    .mud-typography-h5 {
        font-size: 1.15rem !important;
    }

    .mud-typography-h6 {
        font-size: 1rem !important;
    }
}

/* ── Chips ─────────────────────────────────────────────── */
.mud-chip {
    height: 22px !important;
}

/* ── Utilities ─────────────────────────────────────────── */
.scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media(max-width:599px) {
    .hide-xs {
        display: none !important;
    }
}

@media(max-width:959px) {
    .hide-sm {
        display: none !important;
    }
}

/* ── Dental Chart ──────────────────────────────────────── */
.tooth-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

@media(max-width:599px) {
    .tooth-grid {
        gap: 2px;
    }
}

/* ── KPI Cards ─────────────────────────────────────────── */
.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
}

@media(max-width:599px) {
    .kpi-value {
        font-size: 1.4rem;
    }
}

/* ── Print ─────────────────────────────────────────────── */
@media print {
    .bottom-nav, .mud-appbar, .mud-drawer {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* ── Utility: full width on extra-small screens ────────── */
@media(max-width:599px) {
    .w-100-xs {
        width: 100% !important;
    }

    .text-center-xs {
        text-align: center !important;
    }

    .hide-label-xs .mud-button-label {
        display: none !important;
    }
}

/* ── PatientDetail: mobile tab strip ───────────────────── */
@media(max-width:959px) {
    .pt-layout {
        grid-template-columns: 1fr !important;
    }

    .pt-sidebar {
        position: sticky;
        top: 0;
        z-index: 10;
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto;
        overflow-y: hidden;
        width: 100%;
        background: #0A1F44;
        border-radius: 0 !important;
        padding: 6px 8px !important;
        gap: 4px;
        scrollbar-width: none;
    }

        .pt-sidebar::-webkit-scrollbar {
            display: none;
        }

    .pt-tab {
        flex-direction: row !important;
        white-space: nowrap;
        flex-shrink: 0;
        padding: 8px 12px !important;
        border-radius: 8px !important;
        border-left: none !important;
        border-bottom: 2px solid transparent !important;
        min-height: 40px !important;
    }

    .pt-tab--active {
        background: rgba(212,175,55,.2) !important;
        border-bottom-color: #D4AF37 !important;
    }

    .pt-tab-bar {
        display: none !important;
    }

    .pt-tab-sub {
        display: none !important;
    }

    .pt-tab-icon {
        width: 22px !important;
        height: 22px !important;
    }
}

/* ── Page wrapper extra bottom space for FAB + bottom nav ─ */
@media(max-width:959px) {
    .page-wrapper {
        padding-bottom: calc(var(--bottom-nav-height) + 72px) !important;
    }
}
