/* style.css - Premium Glassmorphism Design System for Doctor Record Register */

/* --- ROOT VARIABLES --- */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131a2b;
    --glass-bg: rgba(22, 30, 49, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover-border: rgba(255, 255, 255, 0.15);
    --glass-glow: rgba(99, 102, 241, 0.15);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #6366f1; /* Indigo */
    --accent-primary-hover: #4f46e5;
    --accent-primary-glow: rgba(99, 102, 241, 0.4);
    
    --accent-success: #10b981; /* Emerald */
    --accent-success-glow: rgba(16, 185, 129, 0.3);
    
    --accent-danger: #ef4444; /* Red */
    --accent-danger-hover: #dc2626;
    
    --accent-warning: #f59e0b; /* Amber */
    --accent-warning-bg: rgba(245, 158, 11, 0.12);
    --accent-warning-border: rgba(245, 158, 11, 0.25);
    
    --accent-info: #38bdf8; /* Light Sky Blue */
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 70px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

/* --- RESET & BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

/* --- DECORATIVE GLOWING BLOBS --- */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.4;
}
.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #4f46e5 0%, rgba(79, 70, 229, 0) 70%);
    top: -100px;
    left: -100px;
}
.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #db2777 0%, rgba(219, 39, 119, 0) 70%);
    bottom: -150px;
    right: -150px;
}

/* --- GLASS CONTAINER STYLING --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(3, 7, 18, 0.45);
    padding: 24px;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    border-color: var(--glass-hover-border);
    box-shadow: 0 12px 40px 0 rgba(3, 7, 18, 0.6), 0 0 15px var(--glass-glow);
}

/* --- UTILITIES --- */
.hidden {
    display: none !important;
}

.relative {
    position: relative;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.pb-1 { padding-bottom: 4px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* --- BUTTONS --- */
.btn {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    outline: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px var(--accent-primary-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed 0%, var(--accent-primary) 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--glass-hover-border);
}

.btn-secondary-sm {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-secondary-sm:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-hover-border);
    color: var(--text-primary);
}

.btn-danger-sm {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-danger-sm:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ffffff;
}

/* --- FORMS & INPUTS --- */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    gap: 6px;
}

.form-group-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.form-row {
    display: flex;
    gap: 12px;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.025em;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 12px 14px;
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.25), inset 0 1px 2px rgba(0,0,0,0.5);
    background: rgba(15, 23, 42, 0.8);
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

textarea {
    resize: none;
}

/* Custom Checkbox/Toggle Switch */
.toggle-control {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    user-select: none;
    gap: 10px;
    margin-bottom: 12px;
}

.toggle-control input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 34px;
    transition: .3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
}

.toggle-control input:checked + .toggle-slider {
    background-color: var(--accent-primary);
}

.toggle-control input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.status-indicator {
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 2px;
}

/* --- AUTOCOMPLETE DROPDOWN --- */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    right: 0;
    background: #182235;
    border: 1px solid var(--accent-primary);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    max-height: 180px;
    overflow-y: auto;
    z-index: 100;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.autocomplete-item:hover {
    background: var(--accent-primary);
    color: #ffffff;
}

/* --- AUTH PAGE CONTAINER --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    min-height: 100vh;
    padding: 40px 20px;
    overflow-y: auto;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    animation: fadeIn 0.4s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.auth-actions .btn {
    flex: 1;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* --- APP MAIN DASHBOARD LAYOUT --- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
    position: relative;
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100%;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 10;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    margin-bottom: 32px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    transition: gap 0.3s ease, justify-content 0.3s ease;
}

.logo-container span,
.menu-item span {
    transition: opacity 0.2s ease, width 0.2s ease, margin 0.2s ease;
    opacity: 1;
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.menu-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.menu-item:hover .menu-icon {
    transform: translateX(2px);
}

.menu-item.active {
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: #ffffff;
    font-weight: 600;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.logout-btn {
    color: #fca5a5;
}
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

/* --- SIDEBAR COLLAPSED STATES --- */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding: 24px 12px;
}

.sidebar-collapsed .sidebar .logo-container {
    gap: 0;
    justify-content: center;
}

.sidebar-collapsed .sidebar .logo-container span,
.sidebar-collapsed .sidebar .menu-item span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    margin: 0;
    pointer-events: none;
}

.sidebar-collapsed .sidebar .menu-item {
    gap: 0;
    justify-content: center;
    padding: 12px 0;
    border-radius: var(--radius-md);
}

.sidebar-collapsed .sidebar .menu-item.active {
    border-left-width: 0;
}

.sidebar-collapsed .sidebar .menu-item:hover .menu-icon {
    transform: scale(1.15);
}

/* --- SIDEBAR TOGGLE BUTTON --- */
.btn-sidebar-toggle {
    position: absolute;
    right: -13px;
    top: 24px;
    z-index: 100;
    background: #0f172a;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

.btn-sidebar-toggle:active {
    transform: scale(0.9);
}

.btn-sidebar-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.sidebar-collapsed .btn-sidebar-toggle svg {
    transform: rotate(180deg);
}

/* --- MAIN CONTENT & TOPBAR --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.topbar {
    height: var(--topbar-height);
    width: 100%;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    flex-shrink: 0;
}

.topbar h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    color: #ffffff;
}

.doctor-welcome {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
}

.view-panel-container {
    flex-grow: 1;
    padding: 24px;
    overflow-y: auto;
    position: relative;
}

.view-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100%;
    animation: slideIn 0.35s ease;
}

/* --- VIEW 1: DASHBOARD STATS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: #ffffff;
}
.stat-icon svg {
    width: 24px;
    height: 24px;
}

.purple-glow {
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-primary);
}
.green-glow {
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-success);
}
.blue-glow {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.stat-content h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    margin-top: 4px;
}

.dashboard-recent {
    flex-grow: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
}

/* --- DATA TABLE --- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.3);
}

.table-container.expand-height {
    flex-grow: 1;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background: rgba(19, 26, 43, 0.85);
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Patient Row Alert (0 Visits highlight) */
.row-no-visits {
    background: var(--accent-warning-bg);
    border-left: 3px solid var(--accent-warning);
}

.row-no-visits:hover {
    background: rgba(245, 158, 11, 0.18) !important;
}

.row-no-visits td {
    color: #ffedd5;
}

.badge-warning-glass {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--accent-warning);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-danger-glass {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--accent-danger);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success-glass {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--accent-success);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.patient-name-link {
    cursor: pointer;
    text-decoration: none;
    color: var(--accent-info);
    font-weight: 600;
    transition: all 0.2s ease;
}

.patient-name-link:hover {
    text-decoration: underline !important;
    filter: brightness(1.2);
}

/* --- SPLIT LAYOUT (Patients & Visits logs) --- */
.split-layout {
    display: flex;
    gap: 24px;
    flex-grow: 1;
    height: 100%;
    align-items: stretch;
}

.form-panel {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-panel h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffffff;
}

.list-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.list-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.search-box {
    width: 320px;
}

.search-box input {
    padding-left: 40px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.list-links {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.list-links a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.list-links a:hover {
    text-decoration: underline;
}

.list-links .divider {
    color: var(--text-muted);
}

.list-stats-bar {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-actions {
    display: flex;
    gap: 12px;
}

.flex-grow {
    flex-grow: 1;
}
.max-w-md {
    max-width: 28rem;
}

/* --- PATIENT VISITS BANNER --- */
.patient-summary-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    gap: 16px;
}

.back-link-btn {
    background: transparent;
    border: none;
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--accent-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.back-link-btn:hover {
    color: #818cf8;
}

.back-icon {
    width: 18px;
    height: 18px;
}

.summary-details {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}

.summary-field {
    display: flex;
    gap: 8px;
    font-size: 0.95rem;
}

.summary-field .label {
    color: var(--text-secondary);
}

.summary-field .value {
    color: #ffffff;
    font-weight: 600;
}

.input-helper-links {
    margin-top: 4px;
    text-align: right;
}

.manage-sug-link {
    font-size: 0.78rem;
    color: var(--accent-primary);
    text-decoration: none;
}

.manage-sug-link:hover {
    text-decoration: underline;
}

.follow-date-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: block;
}

.follow-date-value {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--accent-success);
    display: block;
    margin-top: 4px;
}

/* Action links inside grid */
.grid-action-link {
    text-decoration: none;
    font-weight: 500;
    margin-right: 12px;
    cursor: pointer;
}

.grid-action-link.visit-link {
    color: var(--accent-success);
}
.grid-action-link.edit-link {
    color: var(--accent-primary);
}
.grid-action-link.delete-link {
    color: var(--accent-danger);
}
.grid-action-link:hover {
    text-decoration: underline;
}

/* --- VISITED PATIENTS TAB --- */
.filter-header-bar {
    margin-bottom: 8px;
}

.filter-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

/* --- SETTINGS VIEWS --- */
.settings-card {
    width: 100%;
}

.settings-header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 16px;
}

.settings-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: #ffffff;
}

.settings-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .split-layout {
        flex-direction: column;
    }
    .form-panel {
        width: 100%;
    }
}

.settings-section h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 16px;
    border-left: 3px solid var(--accent-primary);
    padding-left: 10px;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
}

.max-w-lg {
    max-width: 32rem;
}

/* --- MODAL SYSTEM --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-card {
    width: 90%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: #ffffff;
}

.btn-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.btn-modal-close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.suggestion-entry-row {
    display: flex;
    gap: 10px;
}

.suggestion-list-box-container {
    height: 200px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.6);
    overflow-y: auto;
}

#list-suggestions-items {
    list-style: none;
}

.suggestion-list-item {
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.15s ease;
}

.suggestion-list-item:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.suggestion-list-item.selected {
    background: rgba(99, 102, 241, 0.2);
    color: #ffffff;
    border-left: 3px solid var(--accent-primary);
}

.modal-stats-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- MOBILE & WEBVIEW LAYOUT OPTIMIZATIONS --- */

/* Desktop hides by default */
.mobile-logo {
    display: none !important;
}

.mobile-logout {
    display: none !important;
}

.mobile-nav {
    display: none !important;
}

/* Premium Logout Button for Mobile Header */
.btn-icon-logout {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    transition: all 0.2s ease;
}

.btn-icon-logout:active {
    transform: scale(0.92);
}

.btn-icon-logout svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    body {
        padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
        overflow-y: auto;
    }

    .app-container {
        flex-direction: column;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
    }

    /* Hide Desktop Toggle and Sidebar on Mobile */
    .btn-sidebar-toggle,
    .sidebar {
        display: none !important;
    }

    /* Mobile Sticky Topbar styling */
    .topbar {
        height: 60px;
        padding: 0 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(11, 15, 25, 0.8);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--glass-border);
        border-top: none;
        border-left: none;
        border-right: none;
        z-index: 100;
        position: relative;
    }

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

    .topbar h1 {
        font-size: 1.15rem;
        font-weight: 600;
    }

    .mobile-logo {
        display: block !important;
        width: 24px;
        height: 24px;
        color: var(--accent-primary);
    }

    .doctor-welcome {
        display: none !important;
    }

    .mobile-logout {
        display: flex !important;
    }

    /* Main view panel container scrolling adjustments */
    .view-panel-container {
        padding: 16px 12px 90px 12px;
        height: calc(100vh - 60px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* MOBILE BOTTOM NAVIGATION BAR */
    .mobile-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(19, 26, 43, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--glass-border);
        border-left: none;
        border-right: none;
        border-bottom: none;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        z-index: 999;
        justify-content: space-around;
        align-items: center;
        border-radius: 0;
    }

    .mobile-menu-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        font-family: var(--font-sans);
        font-size: 0.72rem;
        font-weight: 500;
        gap: 4px;
        cursor: pointer;
        height: 100%;
        transition: all 0.2s ease;
        padding: 4px 0;
    }

    .mobile-menu-item:active {
        transform: scale(0.92);
    }

    .mobile-menu-icon {
        width: 18px;
        height: 18px;
        color: var(--text-secondary);
        transition: all 0.2s ease;
    }

    .mobile-menu-item.active {
        color: var(--accent-primary);
        font-weight: 600;
    }

    .mobile-menu-item.active .mobile-menu-icon {
        color: var(--accent-primary);
        filter: drop-shadow(0 0 5px var(--accent-primary-glow));
        transform: translateY(-1px);
    }

    /* TABLE TO CARDS COLLAPSE FOR MOBILE APP EXPERIENCE */
    .table-container {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        overflow-x: visible !important;
    }

    .table-container.expand-height {
        overflow-y: visible !important;
    }

    .data-table, 
    .data-table thead, 
    .data-table tbody, 
    .data-table th, 
    .data-table td, 
    .data-table tr {
        display: block;
    }

    /* Hide standard headers */
    .data-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .data-table tbody tr {
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-lg);
        margin-bottom: 16px;
        padding: 16px;
        box-shadow: 0 4px 15px rgba(3, 7, 18, 0.4);
        transition: transform 0.2s ease, border-color 0.2s ease;
    }

    .data-table tbody tr:hover {
        border-color: var(--glass-hover-border);
        transform: translateY(-2px);
    }

    .data-table td {
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding: 10px 0;
        position: relative;
        padding-left: 45%;
        text-align: right;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        font-size: 0.9rem;
    }

    .data-table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
        margin-top: 6px;
        justify-content: space-between; /* Space out action buttons */
    }

    .data-table td:first-child {
        padding-top: 0;
        justify-content: space-between;
    }

    /* Inject dynamic column labels on mobile cards */
    .data-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 40%;
        text-align: left;
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    /* No visits patient card border warning */
    .row-no-visits {
        border-left: 4px solid var(--accent-warning) !important;
        background: rgba(245, 158, 11, 0.08) !important;
    }

    /* FORM & SPLIT LAYOUT STACKING */
    .split-layout {
        flex-direction: column;
        gap: 20px;
    }

    .form-panel {
        width: 100% !important;
        padding: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0px;
    }

    .form-row .flex-1,
    .form-row .flex-2,
    .form-row .flex-3 {
        width: 100%;
        flex: none;
    }

    /* visited list filter controls on mobile */
    .filter-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .filter-row .form-group {
        width: 100% !important;
        max-width: 100% !important;
    }

    .filter-row .form-group-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filter-row button {
        width: 100%;
        margin-top: 4px;
    }

    .search-box {
        width: 100%;
    }

    .list-header-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .list-links {
        justify-content: space-between;
        font-size: 0.9rem;
    }

    /* Patient visit summary banner */
    .patient-summary-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    .summary-details {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .summary-field {
        justify-content: space-between;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        padding-bottom: 6px;
    }

    .summary-field:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    /* Autocomplete dropdown size limit for smaller screens */
    .autocomplete-dropdown {
        max-height: 140px;
    }

    /* Mobile settings checkbox spacing */
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* suggestion lists modal overlay */
    .modal-card {
        width: 92%;
        max-height: 90vh;
    }

    .suggestion-entry-row {
        flex-direction: column;
        gap: 8px;
    }

    .suggestion-entry-row button {
        width: 100%;
    }

    /* Larger touch targets for buttons and links */
    .btn, select, input, textarea {
        min-height: 48px;
    }

    .grid-action-link {
        font-size: 0.95rem;
        padding: 6px 12px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-sm);
        display: inline-block;
        margin-right: 0;
    }

    .grid-action-link:active {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* --- PAGINATION STYLING --- */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-hover-border);
    color: var(--text-primary);
}

.page-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
