@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Lexend:wght@300;400;500;600&family=Inter:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&family=Outfit:wght@300;400;500;600;700&family=Poppins:wght@300;400;500;600;700&display=swap');

/* Global Native Splash Screen Hide (Desktop) */
.native-splash-screen {
    display: none;
}

/* Brand Logo Utility - Mask technique to allow theme-tinting of PNG */
.brand-logo-tint,
.brand-logo-img {
    display: inline-block;
    width: 150px;
    height: 40px;
    background-color: var(--primary);
    -webkit-mask-image: url('../logo/logo.svg');
    mask-image: url('../logo/logo.svg');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center left;
    mask-position: center left;
    transition: var(--transition-standard);
}

:root {
    /* Color Seeds - To be updated via JS */
    --primary-seed: #0061a4;

    /* Light Theme - Tinted by primary-seed */
    --primary: var(--primary-seed);
    --on-primary: #ffffff;
    --primary-container: color-mix(in srgb, var(--primary-seed) 20%, #ffffff);
    --on-primary-container: color-mix(in srgb, var(--primary-seed) 80%, #000000);

    --surface: color-mix(in srgb, var(--primary-seed) 5%, #fdfcff);
    --on-surface: #1a1c1e;
    --surface-variant: color-mix(in srgb, var(--primary-seed) 10%, #dfe2eb);
    --on-surface-variant: #43474e;
    --outline: #73777f;

    --surface-container-low: color-mix(in srgb, var(--primary-seed) 5%, #f7f9fc);
    --surface-container: color-mix(in srgb, var(--primary-seed) 8%, #f3f5f9);
    --surface-container-high: color-mix(in srgb, var(--primary-seed) 11%, #eceef4);
    --surface-container-highest: color-mix(in srgb, var(--primary-seed) 12%, #e2e8f0);

    --secondary-container: color-mix(in srgb, var(--primary-seed) 15%, #f4f4f4);
    --on-secondary-container: #1a1c1e;
    --tertiary-container: #f7ebff;
    --on-tertiary-container: #250059;
    --error-container: #ffdad6;
    --on-error-container: #410002;
    --on-error: #ffffff;
    --error: #ba1a1a;

    /* Spacing & Borders */
    --radius-xs: 8px;
    --radius-s: 12px;
    --radius-m: 16px;
    --radius-l: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    --transition-standard: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-emphasized: all 0.7s cubic-bezier(0.2, 0, 0, 1);

    /* Font Settings */
    --font-main: 'Lexend', sans-serif;
    --font-weight-base: 400;
    /* Default weight */

    accent-color: var(--primary);
}

[data-theme="dark"] {
    /* True Tinted Dark Mode - Surfaces are clearly influenced by primary-seed */
    --primary: color-mix(in srgb, var(--primary-seed) 60%, #ffffff);
    --on-primary: color-mix(in srgb, var(--primary-seed) 80%, #000000);
    --primary-container: color-mix(in srgb, var(--primary-seed) 25%, #000000);
    --on-primary-container: color-mix(in srgb, var(--primary-seed) 30%, #ffffff);

    --surface: color-mix(in srgb, var(--primary-seed) 10%, #080808);
    --on-surface: #e2e2e6;
    --surface-variant: color-mix(in srgb, var(--primary-seed) 15%, #232529);
    --on-surface-variant: #c3c7cf;
    --outline: #8d9199;

    --surface-container-low: color-mix(in srgb, var(--primary-seed) 8%, #0f1115);
    --surface-container: color-mix(in srgb, var(--primary-seed) 10%, #14161a);
    --surface-container-high: color-mix(in srgb, var(--primary-seed) 12%, #1a1c21);
    --surface-container-highest: color-mix(in srgb, var(--primary-seed) 15%, #23252a);

    --secondary-container: color-mix(in srgb, var(--primary-seed) 10%, #1e2024);
    --on-secondary-container: #ffffff;
    --tertiary-container: color-mix(in srgb, #9c41ff 20%, #000000);
    --on-tertiary-container: #eaddff;
    --error-container: color-mix(in srgb, #ffb4ab 20%, #000000);
    --on-error-container: #ffdad6;
    --on-error: #000000;
    --error: #ffb4ab;
}

/* Theme Toggle Icon Logic */
.theme-icon-sun,
.theme-icon-moon,
#themeIcon,
#mobileThemeIcon,
#sidebarThemeIcon {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, color 0.3s ease;
}

/* Light Mode: Showing Moon icon */
[data-theme="light"] #themeIcon,
[data-theme="light"] #mobileThemeIcon,
[data-theme="light"] #sidebarThemeIcon {
    color: var(--on-surface-variant);
}

/* Dark Mode: Showing Sun icon */
[data-theme="dark"] #themeIcon,
[data-theme="dark"] #mobileThemeIcon,
[data-theme="dark"] #sidebarThemeIcon {
    color: #ffdb58 !important;
    /* Sun yellow */
    transform: rotate(45deg) scale(1.1);
}

/* Sidebar Theme Toggle mobile styling */
.theme-toggle-nav .nav-icon {
    background: var(--surface-container-high) !important;
    color: var(--primary) !important;
}

[data-theme="dark"] .nav-item.active {
    background: var(--primary-container);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}

[data-theme="dark"] .card-header {
    background: var(--surface-container-high);
    border-bottom: 1px solid var(--surface-variant);
    color: var(--on-surface);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeScaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(1.1);
    }
}

@keyframes pageEntrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: var(--transition-emphasized);
}

[data-theme="light"] .loader-logo {
    background-color: var(--primary);
}

.loader-wrapper.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 200px;
}

.loader-logo {
    width: 200px;
    height: 84px;
    background-color: #ffffff;
    -webkit-mask: url('../logo/logo.svg') no-repeat center;
    mask: url('../logo/logo.svg') no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
    animation: pulse 2s infinite ease-in-out;
}

[data-theme="dark"] .loader-logo,
body.compact-mode .loader-logo {
    background-color: #ffffff;
}

.loader-progress-container {
    width: 100%;
    height: 6px;
    background: var(--surface-variant);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loader-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    animation: progress-load 2s infinite ease-in-out;
}

[data-theme="dark"] .loader-progress-container {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .loader-progress-bar {
    background: #ffffff;
}

@keyframes progress-load {
    0% {
        width: 0%;
        transform: translateX(-100%);
    }

    50% {
        width: 100%;
        transform: translateX(0);
    }

    100% {
        width: 0%;
        transform: translateX(100%);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.animate-page-entrance {
    animation: pageEntrance 0.6s cubic-bezier(0.2, 0, 0, 1) forwards;
}

.animate-in {
    animation: slideUpFade 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

.mobile-only {
    display: none !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--surface-container);
    color: var(--on-surface);
    line-height: 1.5;
    overflow: hidden;
    /* Aside and Main will scroll independently */
    height: 100vh;
    display: flex;
    font-weight: var(--font-weight-base);
}

/* Global Themed Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
    opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-seed);
}

/* Main Scrollable Area */
.main-content-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 24px;
}

.main-content-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Breadcrumbs & Page Headers */
.page-header-container {
    margin-bottom: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 500;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-wrapper {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.breadcrumb li a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb li a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.breadcrumb li span {
    color: var(--on-surface-variant);
}

.page-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 20%, transparent);
    flex-shrink: 0;
    border: 1px solid color-mix(in srgb, var(--primary) 30%, white);
    transition: var(--transition-standard);
}

[data-theme="dark"] .page-header-icon {
    border-color: color-mix(in srgb, var(--primary) 30%, black);
}

.page-header-icon i {
    width: 20px;
    height: 20px;
}

.page-title-group .headline-medium {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--on-surface);
}

.breadcrumb li:not(:last-child)::after {
    content: '/';
    display: inline-block;
    color: var(--on-surface-variant);
    opacity: 0.4;
    font-weight: 400;
    margin-left: 4px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-standard);
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb li:last-child {
    color: var(--on-surface);
    font-weight: 500;
}

.title-large {
    font-family: 'Google Sans', sans-serif;
    font-size: 28px;
    font-weight: 500;
    color: var(--on-surface);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--outline);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--on-surface-variant);
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
    transition: var(--transition-emphasized);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 38px;
    border-radius: 10px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-standard);
    gap: 8px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.12);
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.96) translateY(0);
}

.card {
    background: var(--surface);
    border-radius: var(--radius-l);
    padding: 24px;
    border: 1px solid var(--surface-variant);
    transition: var(--transition-emphasized);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card:hover {
    border-color: transparent;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: var(--surface-container-high);
    border-bottom: 1px solid var(--surface-variant);
    gap: 16px;
    flex-wrap: wrap;
    color: var(--on-surface);
    margin-bottom: 24px;
}

[data-theme="dark"] .card-header {
    background: var(--surface-container-high);
    color: var(--on-surface);
}

.card>.card-header {
    margin: -24px -24px 24px -24px;
    border-radius: var(--radius-l) var(--radius-l) 0 0;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: inherit;
}

.data-table-search {
    width: 240px;
    height: 40px;
    background: var(--surface-container-highest);
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 12px;
    }

    .card-header>div[style*="flex"] {
        flex-direction: column !important;

        width: 100%;
        gap: 8px !important;
    }

    .data-table-search {
        width: 100% !important;
    }

    .card-title {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }
}


/* Responsive Overrides */
@media (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }

    body {
        overflow-y: auto;
        height: auto;
    }

    .app-container {
        flex-direction: column;
    }

    main {
        padding: 0;
    }

    .content-wrapper {
        padding: 16px;
        gap: 16px;
    }

    .card {
        padding: 16px;
    }

    .page-header-container {
        margin-bottom: 4px;
    }

    .breadcrumb {
        margin-bottom: 8px;
        font-size: 11px;
    }

    .page-title-group .headline-medium {
        font-size: 1.5rem;
    }
}

/* Theme Palette 6-Slots */
.theme-palette.palette-6-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
}

.color-slot-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
}

.color-dot {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 3px solid var(--surface);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-dot:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-dot.active {
    border-color: var(--on-surface);
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
    transform: scale(0.9);
}

.setting-hint {
    font-size: 12px;
    color: var(--on-surface-variant);
    margin-top: 8px;
    opacity: 0.8;
}

/* Compact Mode - Deep Black & Gray Aesthetic (No Theme Influence) */
body.compact-mode {
    --primary: #444444;
    --on-primary: #ffffff;
    --primary-container: #222222;
    --on-primary-container: #888888;

    --surface: #000000;
    --on-surface: #888888;
    --surface-variant: #111111;
    --on-surface-variant: #666666;
    --outline: #222222;

    --surface-container-low: #080808;
    --surface-container: #0a0a0a;
    --surface-container-high: #111111;
    --surface-container-highest: #1a1a1a;

    --secondary-container: #111111;
    --on-secondary-container: #888888;

    background: #000000 !important;
}

body.compact-mode .card,
body.compact-mode aside,
body.compact-mode header,
body.compact-mode .card-header,
body.compact-mode .select-dropdown,
body.compact-mode .topbar-actions,
body.compact-mode .search-bar,
body.compact-mode .profile-dropdown,
body.compact-mode .profile-dropdown-menu,
body.compact-mode .palette-selector {
    background: #000000 !important;
    border: 1px solid #222 !important;
    box-shadow: none !important;
    color: #888888 !important;
}

body.compact-mode .nav-item.active {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border: 1px solid #333 !important;
}

body.compact-mode .nav-item:not(.active) {
    color: #666666 !important;
}

body.compact-mode h1,
body.compact-mode h2,
body.compact-mode h3,
body.compact-mode h4,
body.compact-mode p,
body.compact-mode span:not(.badge),
body.compact-mode label,
body.compact-mode .clock-time,
body.compact-mode .clock-date,
body.compact-mode i,
body.compact-mode svg {
    color: #888888 !important;
}

body.compact-mode .btn-primary {
    background: #222222 !important;
    color: #ffffff !important;
    border: 1px solid #333 !important;
}

body.compact-mode input,
body.compact-mode select,
body.compact-mode textarea {
    background: #000000 !important;
    color: #888888 !important;
    border-color: #222 !important;
}

/* Base Compact Mode Padding Reduction */
body.compact-mode main {
    padding: 12px 16px !important;
}

body.compact-mode .card {
    padding: 16px !important;
    gap: 12px !important;
}

body.compact-mode .nav-item {
    padding: 8px 12px !important;
    margin: 2px 8px !important;
}

/* Utility Classes for Doctor + UI (Restored) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--on-surface-variant);
    transition: var(--transition-standard);
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    border: none;
}

.btn-icon:hover {
    background-color: var(--surface-variant);
    color: var(--on-surface);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

/* Typography Utilities */
.display-small {
    font-family: 'Google Sans', sans-serif;
    font-size: 36px;
    line-height: 44px;
    font-weight: 400;
}

.title-large {
    font-family: 'Google Sans', sans-serif;
    font-size: 22px;
    line-height: 28px;
    font-weight: 400;
}

.label-large {
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
}

.body-large {
    font-family: 'Lexend', sans-serif;
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
}

.body-medium {
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
}

.body-small {
    font-family: 'Lexend', sans-serif;
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
}

/* Responsive Page Header */
.page-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

@media (max-width: 768px) {
    .page-header-flex {
        flex-direction: column;
        align-items: flex-start;
        /* Title on top-left */
    }

    .page-header-flex .btn {
        width: 100%;
        /* Full width button on mobile */
        margin-top: 8px;
    }
}

/* Table Enhancements */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hover-lift-row:hover {
    background-color: var(--surface-container-highest) !important;
}


.table th {
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface-variant);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--outline);
    color: var(--primary);
}


.btn-outline:hover {
    background: var(--surface-container-highest);
    border-color: var(--primary);
}

/* Responsive Main Body Spacing */
.main-body {
    padding: 24px;
}

@media (max-width: 768px) {
    .main-body {
        padding: 16px;
        /* Reduced padding on mobile */
    }
}