/* ==========================================================================
   Puritas Health Redesign: Minimalist Clinical Light Theme CSS
   ========================================================================== */

:root {
    /* Color Palette (3-4 Core Clinical Colors) */
    --bg-primary: #f8fafc;        /* Soft Slate Off-White */
    --bg-secondary: #ffffff;      /* Crisp Solid White */
    --border-color: #e2e8f0;      /* Thin Muted Grey */
    --border-hover: #cbd5e1;      
    
    --primary: #4f46e5;           /* Royal Indigo (Consistent with switcher) */
    --primary-hover: #4338ca;     /* Deep Indigo */
    --primary-light: #e0e7ff;     /* Soft Indigo Highlight */
    
    --success: #10b981;           /* Clinical Safe Green */
    --success-light: #ecfdf5;
    
    --warning: #f59e0b;           /* Warning Amber */
    --warning-light: #fffbeb;
    
    --danger: #ef4444;            /* Critical Rose Red */
    --danger-light: #fef2f2;
    
    --text-main: #0f172a;         /* High-contrast Slate Dark */
    --text-secondary: #475569;    /* Muted Slate Grey */
    --text-muted: #94a3b8;        /* Light slate for labels */
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Legacy variables mapping for maximum page compatibility */
    --accent-indigo: var(--primary);
    --accent-indigo-hover: var(--primary-hover);
    --accent-indigo-gradient: var(--primary);
    --accent-cyan: var(--primary);
    --accent-emerald: var(--success);
    --accent-rose: var(--danger);
    --accent-amber: var(--warning);
    
    --glass-bg: var(--bg-secondary);
    --glass-border: var(--border-color);
    --glass-border-hover: var(--border-hover);
    
    /* Layout Constants */
    --border-radius-lg: 12px;
    --border-radius-md: 8px;
    --border-radius-sm: 6px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* App Layout Grid */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    background: var(--bg-primary);
}

/* Glow Orbs Removed (Not needed for clinical application) */
.glow-orb {
    display: none !important;
}

/* Sidebar (Crisp White Minimalist Panel) */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 50;
    flex-shrink: 0;
}

.brand-section {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.brand-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Nav Menu and Accessible Groups */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 12px;
}

.nav-group-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 18px 0 6px 12px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.nav-item a:hover {
    background: var(--bg-primary);
    color: var(--text-main);
}

.nav-item.active a,
.nav-item a.active-link {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item a .menu-icons {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item.active a .menu-icons,
.nav-item a.active-link .menu-icons {
    color: var(--primary);
}

/* User Profile footer on sidebar */
.user-profile-section {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.user-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.logout-btn:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* Main Content Workspace */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
}

.top-header {
    height: 70px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

.page-title-section h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.page-title-section p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Scrollable body */
.content-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 32px;
}

/* Crisp Minimal Cards (Replacing glass-card) */
.glass-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
    margin-bottom: 24px;
    backdrop-filter: none !important;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
}

/* Grid Layouts */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.section-grid-2-3 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.section-grid-3-2 {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .section-grid-2-3, .section-grid-3-2 {
        grid-template-columns: 1fr;
    }
}

/* Metric Display Cards */
.metric-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.metric-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.metric-icon-box {
    color: var(--primary);
    font-size: 16px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.metric-footer {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Table Design */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background: var(--bg-primary);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.custom-table tbody tr:hover {
    background: var(--bg-primary);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-active {
    background: var(--success-light);
    color: var(--success);
}

.badge-pending {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-suspended {
    background: var(--danger-light);
    color: var(--danger);
}

/* Forms controls */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 14px;
    transition: var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: var(--bg-primary);
    color: var(--text-main);
    border-color: var(--border-hover);
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 4px;
}

/* Utility filtering bar */
.utility-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-wrapper svg {
    position: absolute;
    left: 12px;
    top: 11px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    color: var(--text-main);
    font-size: 13.5px;
    outline: none;
    font-family: var(--font-family);
}

.search-input:focus {
    border-color: var(--primary);
}

.filter-group {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 3px;
    gap: 2px;
}

.filter-tab {
    background: none;
    border: none;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.filter-tab.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* Modal overlays (Solid clean dialog block) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 550px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.close-modal-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 70vh;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Slide-out details drawer overlay */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 900;
    display: none;
}

.drawer-overlay.active {
    display: block;
}

.drawer-container {
    position: fixed;
    top: 0;
    right: -460px;
    width: 440px;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 950;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.drawer-container.active {
    right: 0;
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.drawer-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.drawer-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.drawer-body {
    padding: 24px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Submenu layout overrides for flat categories */
.sub-menu {
    max-height: none !important;
    overflow: visible !important;
    padding-left: 0 !important;
    border-left: none !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.has-sub-menu > .link-block, .has-sub-menu > div {
    display: none !important; /* Hide category dropdown tags, list items flat under section title */
}

/* Pre-Login Layout (Minimalist Clinical Style) */
.pre-login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    padding: 20px;
}

.login-card-container {
    display: flex;
    width: 860px;
    min-height: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.login-graphics-panel {
    width: 42%;
    background: var(--primary-light);
    border-right: 1px solid var(--border-color);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-brand-logo {
    width: 28px;
    height: 28px;
    border-radius: var(--border-radius-sm);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.login-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.login-graphic-center {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 40px 0;
}

.pulse-wave-svg {
    width: 140px;
    height: 60px;
}

.pulse-wave-svg path {
    stroke: var(--primary);
}

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

.login-graphic-sub {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.login-graphic-footer {
    font-size: 11px;
    color: var(--text-muted);
}

.login-forms-panel {
    width: 58%;
    padding: 48px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-state-panel {
    display: none;
    animation: auth-fade-in 0.3s ease forwards;
}

.auth-state-panel.active {
    display: block;
}

@keyframes auth-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-state-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.auth-state-subtitle {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-helper-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 13px;
}

.auth-link {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

/* Password eye wrap */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-toggle-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
}

.password-toggle-icon:hover {
    color: var(--text-secondary);
}

/* MFA Code inputs */
.mfa-code-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.mfa-code-input {
    height: 48px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-main);
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    outline: none;
    transition: var(--transition-fast);
}

.mfa-code-input:focus {
    border-color: var(--primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Redesign simulator styling in login gate */
.simulation-pill-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    margin-bottom: 24px;
}

.simulation-pill-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.simulation-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.simulation-radio-item {
    font-size: 12.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.simulation-radio-item input {
    accent-color: var(--primary);
}

/* Global Clinical Override for Dropdowns, Selects, and Filters */
.row-actions-dropdown {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}

.dropdown-action-btn {
    color: var(--text-secondary) !important;
    background: none !important;
}

.dropdown-action-btn:hover {
    background: var(--bg-primary) !important;
    color: var(--text-main) !important;
}

/* Dashboard controls block override */
.dashboard-controls {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Select element styling inside forms and control panels */
select.form-control {
    background-color: var(--bg-secondary) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
}

/* Filter group container background override */
.filter-group {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
}

.filter-tab {
    color: var(--text-secondary) !important;
    background: none !important;
}

.filter-tab.active {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

/* Checkbox and toggle wraps */
.row-actions-dropdown div {
    border-top: 1px solid var(--border-color) !important;
}


