/* PREMIUM INDIGO THEME */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand Colors - Indigo/Violet Scale */
    --primary: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --primary-light: #e0e7ff;
    /* Indigo 100 */

    --sidebar-bg: #312e81;
    /* Indigo 900 - Dark Sidebar */
    --sidebar-text: #e0e7ff;

    --secondary: #64748b;
    --secondary-bg: #f1f5f9;

    /* Functional Colors */
    --success: #0ea5e9;
    /* Sky blue instead of Green for success/info */
    --danger: #ef4444;
    --warning: #f59e0b;

    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */

    --border: #e2e8f0;
    --bg-body: #f3f4f6;
    /* Gray 100 - Warmer than Slate */
    --surface: #ffffff;

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-float: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius: 12px;
    --header-height: 70px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR - Dark & Premium */
.sidebar {
    width: 252px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    height: 80px;
    /* Fixed height again but taller */
    display: flex;
    align-items: center;
    /* Center Vertically */
    gap: 12px;
    /* Gap between icon and text */
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.brand-tagline {
    font-size: 0.65rem;
    font-weight: 400;
    color: #c7d2fe;
    /* Lighter indigo */
    letter-spacing: 0.02em;
    margin-top: 2px;
}

.nav-link {
    margin: 2px 16px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(4px);
}

.nav-link.active {
    background: var(--primary);
    /* Vibrant Indigo highlight */
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.nav-link i {
    font-size: 1.1em;
    opacity: 0.9;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: var(--bg-body);
}

h1,
h2,
h3 {
    margin: 0 0 1.2rem 0;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2rem;
}

h3 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* CARDS */
.card {
    background: var(--surface);
    border-radius: 16px;
    /* Modern large radius */
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #f1f5f9;
    /* Subtle border */
    margin-bottom: 24px;
    transition: box-shadow 0.3s ease, transform 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 8px;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--secondary-bg);
    color: var(--primary);
    border-color: #cbd5e1;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f5f3ff;
}

/* FORMS - Modern Filled Style */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background: #f8fafc;
    /* Light gray fill */
    transition: all 0.2s;
    box-sizing: border-box;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.form-control:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Checkboxes & Radios */
input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Layout Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px 32px;
}

/* History Stack Adjustments */
.history-stack .form-group {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: 0.2s;
}

.history-stack .form-group:focus-within {
    background: #fff;
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

/* Utilities */
.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 12px;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* PATIENT CARD COMPACT - V3 "Slim & Elegant" */
.patient-card {
    background: #fff;
    border-radius: 12px;
    /* Slightly less rounded */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 12px;
    /* Tighter spacing between cards */
    padding: 16px 20px;
    /* MUCH Less padding */
    border: 1px solid #e2e8f0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.patient-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.patient-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    /* Better hover shadow */
    border-color: #cbd5e1;
}

.patient-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 0;
    border-bottom: none;
}

.patient-name-block {
    display: flex;
    align-items: center;
    /* Center Vertically */
    gap: 12px;
    flex: 1;
}

.patient-icon-container {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    /* Squircle */
    background: #f1f5f9;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-top: 0;
}

.patient-name-link {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
    line-height: 1.2;
    transition: color 0.15s;
    display: block;
}

.patient-name-link:hover {
    color: var(--primary);
    text-decoration: none;
    /* No underline */
}

.info-snippet {
    font-size: 0.85rem;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #f1f5f9;
}

.info-snippet i {
    font-size: 0.8em;
    color: #94a3b8;
}

/* ... existing code ... */

/* Update info-label further down in the file, targeting via ReplacementBlock is safer */

.badges-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    padding: 4px 10px;
    /* Tighter badge */
    border-radius: 6px;
    /* Rounded rect instead of pill */
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #f1f5f9;
    color: #64748b;
}

.status-deceased {
    background: #fee2e2;
    color: #991b1b;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 24px;
    /* Tighter gap */
    margin-bottom: 16px;
}

.info-grid.compact {
    display: none;
    /* Hide old grid style */
}

.info-grid.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 30px;
    margin-bottom: 12px;
}

.emergency-contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    /* Very light grey/slate */
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    border-left: 3px solid #64748b;
    /* Slate accent */
    font-size: 0.95rem;
    color: #334155;
}

.ec-label {
    font-weight: 500;
    color: #64748b;
}

.ec-value {
    font-weight: 800;
    color: #0f172a;
    font-size: 1rem;
}

.info-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Footer Layout */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Center alignment */
    gap: 16px;
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    /* Solid light grey line */
}

.footer-alerts {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.alert-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8rem;
    /* Smaller text */
    margin-bottom: 2px;
    line-height: 1.4;
}

.alert-icon {
    width: 20px;
    text-align: center;
    margin-top: 1px;
}

/* Warnings (Allergies) - Orange/Red */
.alert-row.warning .alert-icon {
    color: #f59e0b;
}

.alert-row.warning .alert-label {
    font-weight: 700;
    color: #1e293b;
}

.alert-row.warning .alert-value {
    color: #dc2626;
}

/* Red Text for value */

/* Info (Conditions) - Blue */
.alert-row.info .alert-icon {
    color: #3b82f6;
}

/* Blue Icon */
.alert-row.info .alert-label {
    font-weight: 700;
    color: #334155;
}

.alert-row.info .alert-value {
    color: #2563eb;
}

/* Blue Text for value */

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    /* Compact font */
    line-height: 1.4;
}

.info-icon {
    color: #cbd5e1;
    width: 16px;
    text-align: center;
    font-size: 0.9em;
}

.info-label {
    color: #64748b;
    font-weight: 500;
    width: 160px;
    /* Increased to fit full text */
    flex-shrink: 0;
}

.info-value {
    color: #334155;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alerts-section {
    background: #fef2f2;
    border-radius: 6px;
    padding: 8px 12px;
    /* Compact alert */
    margin-top: auto;
    /* Push to bottom if flex stretch */
    border: 1px solid #fecaca;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #991b1b;
}

.alert-label {
    font-weight: 600;
}

.text-danger {
    color: #ef4444;
}

.text-primary {
    color: var(--primary);
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.btn-card-action {
    padding: 6px 12px;
    /* Smaller button padding */
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
    color: #475569;
    background: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-card-action:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.btn-card-action.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-card-action.primary:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
}