/* static/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Brand colours */
    --brand-primary: #A14B3C;
    --brand-secondary: #C98F62;
    --brand-accent: #00D4B2;

    /* Backgrounds */
    --bg-main: #FDFBFA;
    --bg-glass: rgba(255, 255, 255, 0.92);
    --border-soft: #EEDCD3;
    --dark-bg: #FFFFFF;
    --slate-bg: #F8F5F2;
    --slate-light: #E0CFC5;

    /* Text */
    --text-main: #461C1D;
    --text-muted: #A14B3C;
    --text-primary: #461C1D;
    --text-secondary: #A14B3C;

    /* Aliases for legacy references */
    --teal-primary: #A14B3C;
    --teal-secondary: #C98F62;

    /* Status */
    --success-color: #2D9D78;
    --error-color: #D93025;
    --warning-color: #E88C30;

    /* Fonts & Shadows */
    --font-dm: 'DM Sans', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-heading: 'DM Sans', sans-serif;
    --shadow-premium: 0 12px 40px rgba(161, 75, 60, 0.08);
}

body {
    font-family: var(--font-dm);
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
}

.background-gradient {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background: radial-gradient(circle at top left, rgba(161, 75, 60, 0.05), transparent 40%),
                radial-gradient(circle at bottom right, rgba(201, 143, 98, 0.05), transparent 40%);
}

.main-container {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    min-height: 100vh; padding: 2rem; width: 100%;
}

.page-content, .content-wrapper {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-soft);
    border-radius: 28px;
    box-shadow: var(--shadow-premium);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-sizing: border-box;
}

.logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    margin: 0 auto 1.5rem auto;
    display: block;
}

.login-header, .admin-header, .welcome-header {
    text-align: center;
    margin-bottom: 2rem;
}

.subtitle {
    color: var(--brand-secondary);
    font-size: 1rem;
    opacity: 0.8;
}
.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 0.25rem;
}

/* --- Landing Page --- */
.landing-page {
    max-width: 480px;
    text-align: center;
    padding: 2.5rem 2rem;
}
.landing-header { margin-bottom: 2.5rem; }
.landing-tagline {
    color: var(--brand-secondary);
    font-size: 1.05rem;
    margin-top: 0.5rem;
    opacity: 0.85;
}

.landing-portals { display: flex; flex-direction: column; gap: 0; }

.portal-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1.5px solid var(--border-soft);
    background: #FFFFFF;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    margin-bottom: 0.5rem;
}
.portal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(161, 75, 60, 0.12);
    border-color: var(--brand-primary);
}

.portal-patient { border-left: 4px solid var(--brand-accent); }
.portal-admin   { border-left: 4px solid var(--brand-primary); }

.portal-icon {
    width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.portal-patient .portal-icon {
    background: rgba(0, 212, 178, 0.1);
    color: var(--brand-accent);
}
.portal-admin .portal-icon {
    background: rgba(161, 75, 60, 0.08);
    color: var(--brand-primary);
}
.portal-icon .material-symbols-outlined { font-size: 28px; }

.portal-text { flex: 1; }
.portal-text h2 {
    font-size: 1.1rem; font-weight: 700; margin: 0 0 4px 0;
    color: var(--text-main);
}
.portal-text p {
    font-size: 0.875rem; color: var(--text-secondary); margin: 0; line-height: 1.4;
}

.portal-arrow {
    font-size: 20px;
    color: var(--border-soft);
    transition: color 0.3s, transform 0.3s;
    flex-shrink: 0;
}
.portal-card:hover .portal-arrow {
    color: var(--brand-primary);
    transform: translateX(4px);
}

.portal-divider {
    display: flex; align-items: center; gap: 1rem; margin: 0.5rem 0;
    color: var(--text-secondary); font-size: 0.85rem; font-weight: 600;
}
.portal-divider::before, .portal-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border-soft);
}

.username-highlight {
    color: var(--teal-primary);
    font-weight: 700;
}
/* --- Logout Button --- */
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 50px;
    background: rgba(217, 48, 37, 0.07);
    border: 1.5px solid rgba(217, 48, 37, 0.2);
    color: #b52d1f;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-dm);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
}
.btn-logout .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}
.btn-logout:hover {
    background: rgba(217, 48, 37, 0.12);
    border-color: rgba(217, 48, 37, 0.4);
    color: #D93025;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 48, 37, 0.15);
}
/* Legacy alias — keep for any remaining uses */
.logout-link { display: none; }


/* --- Forms & Inputs --- */
.page-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.input-group {
    position: relative;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}
.input-group input, .input-group textarea, .input-group select {
    width: 100%;
    box-sizing: border-box;
    padding: 18px 16px 10px 16px;
    background: #FFFFFF;
    border: 1.5px solid var(--border-soft);
    border-radius: 16px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: var(--font-dm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-appearance: none;
    appearance: none;
}
.input-group label {
    position: absolute;
    top: 14px;
    left: 16px;
    color: var(--brand-secondary);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
}
.input-group input:focus, .input-group textarea:focus, .input-group select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(161, 75, 60, 0.05);
}
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group textarea:focus + label,
.input-group textarea:not(:placeholder-shown) + label,
.input-group select:focus + label,
.input-group select:valid + label { 
    top: 6px;
    left: 16px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #FFFFFF;
    padding: 0 4px;
}

button, .button-link {
    padding: 16px 24px;
    font-family: var(--font-dm);
    font-size: 1rem;
    font-weight: 700;
    color: #FFFFFF;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(161, 75, 60, 0.2);
}

button:hover, .button-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(161, 75, 60, 0.3);
    filter: brightness(1.1);
}

.button-link-alt {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    color: var(--brand-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s;
}
.button-link-alt:hover { color: var(--brand-primary); }

/* --- Flash Messages --- */
.flash-message {
    padding: 1rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.flash-message.success {
    background-color: rgba(45, 157, 120, 0.1);
    color: #1a7a5e;
    border-color: rgba(45, 157, 120, 0.3);
}
.flash-message.error {
    background-color: rgba(217, 48, 37, 0.08);
    color: #b52d1f;
    border-color: rgba(217, 48, 37, 0.25);
}
.flash-message.warning {
    background-color: rgba(232, 140, 48, 0.1);
    color: #9a5a0a;
    border-color: rgba(232, 140, 48, 0.3);
}
.flash-message.info {
    background-color: rgba(161, 75, 60, 0.08);
    color: var(--brand-primary);
    border-color: var(--border-soft);
}

/* --- Timeline (Zigzag) --- */
.timeline-container-zigzag {
    position: relative;
    padding: 2rem 0;
    max-width: 320px;
    margin: 0 auto;
}
.timeline-container-zigzag::before {
    content: ''; position: absolute; top: 0; left: 50%; width: 2px; height: 100%;
    background: linear-gradient(to bottom, transparent, var(--border-soft), transparent);
    transform: translateX(-50%);
}
.timeline-item-zigzag {
    display: flex; align-items: center; margin-bottom: 2.5rem; position: relative;
    width: 100%; justify-content: center;
}
.timeline-item-zigzag.left { justify-content: flex-start; padding-left: calc(50% - 27px); }
.timeline-item-zigzag.right { justify-content: flex-end; padding-right: calc(50% - 27px); flex-direction: row-reverse; }

.timeline-node {
    width: 54px; height: 54px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #FFFFFF; border: 2px solid var(--border-soft); color: var(--text-main);
    z-index: 2; position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.timeline-node.past { 
    background: var(--brand-primary); border-color: var(--brand-primary); color: #FFFFFF;
}
.timeline-node.current {
    background: var(--brand-accent); border-color: var(--brand-accent); color: #FFFFFF;
    box-shadow: 0 0 0 6px rgba(0, 212, 178, 0.2);
    transform: scale(1.1);
}
.timeline-node:hover { transform: scale(1.15); box-shadow: 0 8px 20px rgba(161, 75, 60, 0.15); }

.timeline-day-label {
    position: absolute; width: 100px; font-weight: 700; font-size: 0.9rem;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px;
}
.timeline-item-zigzag.left .timeline-day-label { right: calc(50% + 40px); text-align: right; }
.timeline-item-zigzag.right .timeline-day-label { left: calc(50% + 40px); text-align: left; }

.timeline-node.future { background: var(--dark-bg); border-color: var(--slate-light); color: var(--text-secondary); }
.timeline-node:hover { transform: scale(1.2); }

/* --- Feeling / Chat Page --- */
/* --- Chat UI --- */
.chat-container { margin-bottom: 2rem; }
.chat-message { display: flex; gap: 1rem; align-items: flex-start; }
.chat-message.ai-message { flex-direction: row; }

.avatar {
    width: 44px; height: 44px; border-radius: 14px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #FFFFFF; display: flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(161, 75, 60, 0.15);
}

.message-bubble {
    background: #FFFFFF;
    padding: 18px 20px;
    border-radius: 4px 20px 20px 20px;
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.5;
    border: 1.5px solid var(--border-soft);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    position: relative;
}
.message-bubble::before {
    content: ''; position: absolute; top: 0; left: -8px; width: 8px; height: 8px;
    background: #FFFFFF; clip-path: polygon(100% 0, 0 0, 100% 100%);
    border-left: 1.5px solid var(--border-soft); border-top: 1.5px solid var(--border-soft);
}
.feeling-form { margin-top: 1rem; }

/* --- Result Page --- */
.result-card { text-align: center; }
.result-logo-wrapper { margin-bottom: 1.5rem; }
.result-section { margin-bottom: 2.5rem; text-align: center; }
.result-section h3 { 
    font-family: var(--font-heading); 
    color: var(--teal-primary); 
    margin-bottom: 1.25rem; 
    font-size: 1.3rem;
    position: relative;
    display: inline-block;
}
.result-section h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 25%;
    width: 50%;
    height: 2px;
    background: var(--slate-light);
    border-radius: 2px;
}
.report-table { width: 100%; border-collapse: collapse; margin-top: 1rem; background-color: var(--dark-bg); border-radius: 12px; overflow: hidden; }
.report-table th, .report-table td { padding: 14px 15px; border-bottom: 1px solid var(--slate-light); }
.report-table th { font-family: var(--font-heading); color: var(--text-secondary); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1.5px; text-align: center; background-color: rgba(201, 143, 98, 0.05); }
.report-table td { color: var(--text-primary); text-align: center; }
.status-expected { color: var(--success-color); font-weight: 700; }
.status-unexpected { color: var(--error-color); font-weight: 700; }
.analysis-points { list-style-type: none; padding-left: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.analysis-points li { 
    background-color: var(--dark-bg); 
    padding: 16px; 
    border-radius: 16px; 
    border: 1px solid var(--slate-light);
    border-left: 4px solid var(--teal-primary); 
    text-align: left;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.result-disclaimer {
    font-size: 0.85rem; color: var(--text-secondary); opacity: 0.9; margin: 2rem 0; padding: 1.25rem;
    background-color: rgba(201, 143, 98, 0.05); border-radius: 16px;
    line-height: 1.5; text-align: center;
}
.result-actions { display: flex; justify-content: center; margin-top: 2rem; }
.result-actions .button-link { display: inline-block; width: auto; padding: 16px 40px; margin: 0; }

/* --- Admin Portal --- */
.admin-wrapper { max-width: 680px; }
.search-bar-wrapper { margin-bottom: 2rem; }
#patientSearch {
    width: 100%; padding: 18px 20px; background: #FFFFFF;
    border: 1.5px solid var(--border-soft); border-radius: 18px;
    color: var(--text-main); font-size: 1rem; font-family: var(--font-dm);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
#patientSearch:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 4px rgba(161, 75, 60, 0.05); }

.patient-list { display: flex; flex-direction: column; gap: 1rem; }
.patient-list-item {
    display: flex; align-items: center; gap: 1.25rem; background: #FFFFFF;
    padding: 1.25rem; border-radius: 20px; text-decoration: none; 
    border: 1px solid var(--border-soft);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.patient-list-item:hover { 
    transform: translateX(8px); 
    border-color: var(--brand-primary);
    box-shadow: 0 8px 20px rgba(161, 75, 60, 0.08);
}
.patient-item-avatar {
    width: 48px; height: 48px; border-radius: 16px; 
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #FFFFFF; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.2rem; flex-shrink: 0;
}
.patient-item-info h4 { margin: 0 0 4px 0; color: var(--text-main); font-size: 1.1rem; }
.patient-item-info p { color: var(--brand-secondary); font-size: 0.85rem; margin: 0; font-weight: 500; }
.patient-item-arrow { color: var(--border-soft); transition: color 0.3s; }
.patient-list-item:hover .patient-item-arrow { color: var(--brand-primary); }

/* Admin Patient Detail Page */
.day-group-card {
    background-color: var(--dark-bg);
    border: 1px solid var(--slate-light);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.day-group-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--slate-light);
    background-color: var(--slate-bg);
}
.day-group-header h2 { margin: 0; font-size: 1.5rem; color: var(--teal-primary); }
.day-group-content { padding: 1.5rem; }

.log-entry-card {
    background-color: var(--slate-bg);
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--slate-light);
}
.log-entry-card:last-child { margin-bottom: 0; }
.log-header { display: flex; justify-content: space-between; align-items: center; background-color: var(--slate-light); padding: 0.75rem 1rem; }
.log-header h4 { margin: 0; color: var(--text-primary); font-family: var(--font-body); font-size: 1rem; }
.log-body { padding: 1rem; }
.log-body p { margin-bottom: 0.5rem; }
.log-body ul { padding-left: 20px; color: var(--text-secondary); }
.alert-level { font-size: 0.8rem; font-weight: 600; padding: 4px 8px; border-radius: 20px; }
.alert-normal { background-color: var(--success-color); color: var(--dark-bg); }
.alert-low-alert { background-color: var(--warning-color); color: var(--dark-bg); }
.alert-high-alert { background-color: var(--error-color); color: var(--text-primary); }

.clinical-summary-content {
    background-color: var(--dark-bg); padding: 1rem 1.5rem; border-radius: 12px;
    border-left: 4px solid var(--teal-primary); text-align: left;
}
.clinical-summary-content ul { list-style-type: none; padding-left: 0; }
.clinical-summary-content li { line-height: 1.6; margin-bottom: 0.5rem; }

/* Admin Vitals Form */
.vitals-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.25rem;
    align-items: end;
}
.vitals-form-grid .input-group {
    display: flex !important;
    flex-direction: column !important;
    position: static !important;
    gap: 0.4rem;
}
.vitals-form-grid .input-group label {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    background: none !important;
    padding: 0 !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: var(--brand-secondary) !important;
    opacity: 1 !important;
}
.vitals-form-grid .input-group input,
.vitals-form-grid .input-group select {
    padding: 12px 14px !important;
    border-radius: 12px !important;
    border: 1.5px solid var(--border-soft) !important;
    background: #FFFFFF !important;
    color: var(--text-main) !important;
    font-size: 0.95rem !important;
    font-family: var(--font-dm) !important;
    width: 100% !important;
}
.vitals-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.vitals-table th, .vitals-table td { padding: 8px 10px; border: 1px solid var(--slate-light); text-align: center; }
.vitals-table th { font-size: 0.8rem; }

/* --- Modal --- */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px;
    opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.modal-backdrop.visible {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: var(--slate-bg); padding: 2rem; border-radius: 15px; width: 100%;
    max-width: 400px; max-height: 80vh; overflow-y: auto; position: relative;
    border: 1px solid var(--slate-light); box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.modal-backdrop.visible .modal-content {
    transform: translateY(0);
}
.modal-close-btn {
    position: absolute; top: 15px; right: 20px; font-size: 2rem;
    font-weight: bold; color: var(--text-secondary); cursor: pointer; transition: color 0.3s;
}
.modal-close-btn:hover { color: var(--text-primary); }
#modalTitle { color: var(--teal-primary); margin-bottom: 1.5rem; text-align: left;}
#modalBody { text-align: left; line-height: 1.6; }
#modalBody h4 { color: var(--text-secondary); margin-top: 1rem; margin-bottom: 0.5rem; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px;}
#modalBody hr { border: 0; height: 1px; background-color: var(--slate-light); margin: 1.5rem 0; }
.history-text { background-color: var(--dark-bg); padding: 1rem; border-radius: 8px; font-style: italic; }
.modal-analysis-points { list-style: none; padding: 0; margin-top: 1rem; }
.modal-analysis-points li { background: var(--dark-bg); padding: 10px; border-radius: 8px; margin-bottom: 5px; border-left: 2px solid var(--teal-primary); font-size: 0.9rem; }

/* --- ANIMATIONS --- */
@keyframes slow-pan { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in-down { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }

/* --- Styles for Symptom Rating Page --- */
.symptom-rating-container { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 2rem; }
.symptom-rating-card { background-color: var(--dark-bg); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--slate-light); }
.symptom-rating-card h3 { text-align: center; margin-top: 0; color: var(--text-primary); font-size: 1.3rem; }
.severity-selector { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 10px; margin-top: 1.5rem; }
.severity-label { cursor: pointer; text-align: center; transition: transform 0.2s ease; flex: 1; min-width: 80px; }
.severity-label:hover { transform: scale(1.1); }
.severity-label input[type="radio"] { display: none; }
.severity-label .severity-icon {
    width: 60px; height: 60px; margin: 0 auto;
    border: 2px solid var(--slate-light); border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; justify-content: center;
    background-color: var(--dark-bg);
}
.severity-icon span { font-size: 32px; color: var(--text-secondary); }
.sev-mild span { color: #00D4B2; }
.sev-mod span { color: #FFA421; }
.sev-sev span { color: #FF4B4B; }

.severity-label input[type="radio"]:checked + .severity-icon {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(161, 75, 60, 0.15);
}
.severity-label input[type="radio"]:checked + .sev-mild { border-color: #00D4B2; background-color: rgba(0, 212, 178, 0.05); }
.severity-label input[type="radio"]:checked + .sev-mod { border-color: #FFA421; background-color: rgba(255, 164, 33, 0.05); }
.severity-label input[type="radio"]:checked + .sev-sev { border-color: #FF4B4B; background-color: rgba(255, 75, 75, 0.05); }

/* --- Styles for Updated Result Page --- */
.severity-level-container { display: flex; flex-direction: column; gap: 1rem; }
.severity-level-item { display: flex; justify-content: space-between; align-items: center; background-color: var(--dark-bg); padding: 10px 15px; border-radius: 8px; }
.severity-level-label { font-weight: 600; }
.severity-level-visual { display: flex; align-items: center; gap: 10px; }
.severity-level-visual .severity-icon-small { width: 36px; height: 36px; }
.severity-level-name { font-family: var(--font-heading); font-size: 1rem; color: var(--text-primary); }

/* --- Vitals Dashboard --- */
.vitals-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    max-width: 900px;
}
@media (min-width: 768px) {
    .vitals-dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.chart-container {
    background-color: var(--slate-bg);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--slate-light);
}
.chart-container h3 {
    text-align: center;
    margin-top: 0;
}

.admin-actions {
    display: flex; flex-direction: column; gap: 1.25rem; margin-top: 2rem;
}
.admin-action-card {
    background: #FFFFFF;
    padding: 1.5rem; border-radius: 20px; border: 1px solid var(--border-soft);
    text-decoration: none; text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.admin-action-card:hover {
    transform: translateY(-4px);
    border-color: var(--brand-primary);
    box-shadow: 0 12px 30px rgba(161, 75, 60, 0.1);
}
.admin-action-card h3 { margin: 0 0 8px 0; font-size: 1.2rem; color: var(--brand-primary); }
.admin-action-card p { margin: 0; color: var(--brand-secondary); font-size: 0.95rem; line-height: 1.4; opacity: 0.9; }

.logout-link {
    display: inline-block; margin-top: 1rem; color: var(--brand-secondary);
    text-decoration: none; font-size: 0.9rem; font-weight: 600;
}
.logout-link:hover { color: var(--brand-primary); text-decoration: underline; }

.severity-level-container { 
    display: flex; 
    flex-direction: column; 
    gap: 1rem; 
    margin-top: 1rem;
}
.severity-level-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background-color: var(--dark-bg); 
    padding: 12px 20px; 
    border-radius: 12px; 
    border: 1px solid var(--slate-light);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.severity-level-label { font-weight: 700; color: var(--text-primary); }
.severity-level-visual { display: flex; align-items: center; gap: 12px; }
.severity-level-name { font-weight: 700; font-size: 0.9rem; color: var(--text-secondary); width: 80px; text-align: right; }
.severity-icon-small { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }

/* ========================================================
   RESPONSIVE STYLES — Mobile-first approach
   Breakpoints:
     xs  < 400px  (small phones)
     sm  < 640px  (phones, portrait)
     md  < 768px  (large phones / phablets)
   ======================================================== */

/* ---------- SMALL PHONES < 400px ---------- */
@media (max-width: 400px) {

    .main-container {
        padding: 12px 8px;
        align-items: stretch;
    }

    .content-wrapper, .page-content {
        border-radius: 20px;
        padding: 1.75rem 1.25rem;
        max-width: 100%;
    }

    .logo { max-width: 120px; }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1rem; }

    /* Forms */
    .page-form { gap: 1rem; }
    .input-group input, .input-group textarea, .input-group select {
        padding: 16px 14px 8px 14px;
        font-size: 0.95rem;
    }
    button { font-size: 0.95rem; padding: 14px; }

    /* Vitals grid — single column on tiny screens */
    .vitals-form-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Severity selectors — 3 in a row still, but smaller */
    .severity-label .severity-icon { width: 52px; height: 52px; }
    .severity-icon span { font-size: 26px; }

    /* Timeline — vertical single column */
    .timeline-container-zigzag {
        max-width: 100%;
        padding: 1rem 0;
    }
    .timeline-item-zigzag.left,
    .timeline-item-zigzag.right {
        justify-content: flex-start;
        padding-left: 70px;
        padding-right: 0;
        flex-direction: row;
    }
    .timeline-container-zigzag::before {
        left: 27px;
        transform: none;
    }
    .timeline-day-label {
        position: static;
        width: auto;
        font-size: 0.8rem;
        padding-left: 16px;
    }

    /* Result page — compact */
    .result-logo-wrapper img { width: 90px; }
    .result-section h3 { font-size: 1rem; }
    .severity-level-item { padding: 10px 14px; }

    /* Chat bubble */
    .message-bubble { font-size: 0.95rem; padding: 14px 16px; }

    /* Admin patient list */
    .patient-list-item { padding: 1rem; }
    .patient-item-avatar { width: 40px; height: 40px; font-size: 1rem; border-radius: 12px; }

    /* Modal */
    .modal-content { width: 96%; padding: 1.25rem; border-radius: 16px; }
}

/* ---------- PHONES < 640px ---------- */
@media (max-width: 640px) {

    .main-container {
        padding: 16px 12px;
        align-items: stretch;
    }

    .content-wrapper, .page-content {
        border-radius: 24px;
        padding: 2rem 1.5rem;
        max-width: 100%;
        width: 100%;
    }

    .logo { max-width: 140px; }

    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.1rem; }

    .subtitle { font-size: 0.95rem; }

    /* Forms */
    .page-form { gap: 1.1rem; }
    .input-group input, .input-group textarea, .input-group select {
        font-size: 1rem;
        border-radius: 14px;
    }
    button, .button-link {
        font-size: 1rem;
        padding: 15px;
        border-radius: 14px;
    }

    /* Vitals form: 2-col grid */
    .vitals-form-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }
    .vitals-form-grid .input-group input,
    .vitals-form-grid .input-group select {
        padding: 10px 12px !important;
    }

    /* Admin wrapper — full width */
    .admin-wrapper { max-width: 100%; }

    /* Patient list */
    .patient-list-item:hover { transform: none; } /* Disable slide on touch */

    /* Symptom rating page — keep 3-col row */
    .severity-selector { gap: 6px; }
    .severity-label .severity-icon { width: 56px; height: 56px; }

    /* Result page */
    .result-logo-wrapper img { width: 100px; }
    .report-table { display: block; overflow-x: auto; }
    .severity-level-item { flex-wrap: wrap; gap: 8px; }

    /* Timeline — vertical, left-aligned */
    .timeline-container-zigzag {
        max-width: 100%;
        padding: 1.5rem 0;
    }
    .timeline-container-zigzag::before {
        left: 27px;
        transform: none;
    }
    .timeline-item-zigzag.left,
    .timeline-item-zigzag.right {
        justify-content: flex-start;
        padding-left: 70px;
        padding-right: 0;
        flex-direction: row;
        margin-bottom: 1.75rem;
    }
    .timeline-node {
        position: absolute;
        left: 0;
        width: 54px;
        height: 54px;
    }
    .timeline-day-label {
        position: static;
        width: auto;
        font-size: 0.85rem;
        padding-left: 0;
        letter-spacing: 0.5px;
        color: var(--text-secondary);
    }

    /* Chat/feeling page */
    .message-bubble {
        font-size: 1rem;
        padding: 16px 18px;
        border-radius: 4px 18px 18px 18px;
    }
    .avatar { width: 40px; height: 40px; border-radius: 12px; }

    /* Flash messages */
    .flash-message { font-size: 0.9rem; padding: 0.9rem 1rem; }

    /* Admin patient detail card */
    .day-group-card { padding: 1.25rem; border-radius: 16px; }
    .admin-action-card { padding: 1.25rem; border-radius: 16px; }

    /* Modal */
    .modal-content { width: 94%; padding: 1.5rem; border-radius: 20px; }
    .modal-backdrop { align-items: flex-end; }
    .modal-content { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

    /* Result page actions */
    .result-actions .button-link { padding: 14px 24px; }

    /* Welcome page header */
    .welcome-header h2 { font-size: 1.4rem; }

    /* Analysis points */
    .analysis-points li { font-size: 0.9rem; padding: 14px; }
}

/* ---------- PHABLETS / LARGE PHONES < 768px ---------- */
@media (max-width: 768px) {
    /* Vitals dashboard charts */
    .vitals-dashboard-grid { grid-template-columns: 1fr; gap: 1rem; }

    /* Admin back button */
    .admin-back-btn {
        font-size: 0.85rem;
        padding: 8px 14px;
    }
}

/* ---------- Prevent hover transforms on touch devices ---------- */
@media (hover: none) {
    .patient-list-item:hover { transform: none; box-shadow: none; }
    .admin-action-card:hover { transform: none; box-shadow: none; }
    .timeline-node:hover { transform: none; box-shadow: none; }
    button:hover, .button-link:hover { transform: none; filter: none; }
    .severity-label:hover { transform: none; }
}