:root {
    --primary: #1565C0;
    --primary-light: #5E92F3;
    --primary-dark: #003C8F;
    --surface: #ffffff;
    --background: #f5f7fa;
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --error: #d32f2f;
    --radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.glassmorphism {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.brand {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    width: 64px;
    height: 64px;
    background-color: var(--primary);
    color: white;
    font-size: 32px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    margin: 0 auto 16px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

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

.primary-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

.primary-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.error-message {
    color: var(--error);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
    min-height: 20px;
}

/* Portal Page */
.portal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tabs {
    display: flex;
    background: white;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow-x: auto;
}

.tab {
    padding: 16px 24px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.3s;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

.visit-group {
    margin-bottom: 30px;
}

.visit-date {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.item-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.item-title {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 8px;
}

.item-text {
    color: var(--text-main);
    white-space: pre-wrap;
}

.item-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 12px;
    border: 1px solid #eee;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Lab Tests */
.section-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin: 24px 0 12px;
}

.section-label:first-child {
    margin-top: 0;
}

.lab-test-card {
    border-left: 4px solid var(--primary);
}

.lab-test-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.lab-test-head .item-title {
    margin-bottom: 0;
}

.lab-test-date {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 10px;
}

.lab-test-head + .lab-test-date {
    margin-top: 6px;
}

.abnormal-flag {
    background: #fdecea;
    color: var(--error);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 8px 0;
}

.lab-pending-note {
    color: var(--text-muted);
    font-style: italic;
    font-size: 14px;
    margin-top: 10px;
}

.lab-img-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.zoomable {
    cursor: zoom-in;
}

.lab-img {
    height: 130px;
    width: 130px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: transform 0.15s, box-shadow 0.15s;
}

.lab-img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Full-screen image viewer */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 24px;
    cursor: zoom-out;
}

.lightbox.open {
    display: flex;
    animation: fadeIn 0.2s ease-in-out;
}

.lightbox img {
    max-width: 95%;
    max-height: 95%;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* Profile Selection */
#profile-list .primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface);
    color: var(--text-main);
    border: 2px solid #e0e0e0;
    font-size: 15px;
    transition: all 0.2s;
}

#profile-list .primary-btn:hover {
    border-color: var(--primary);
    background: #f0f6ff;
    color: var(--primary);
}

/* Reserve Tab */
.reserve-card {
    background: white;
    border-radius: var(--radius);
    padding: 28px;
    margin: 0 auto;
    max-width: 480px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.reserve-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.reserve-date {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.estimate-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.estimate-time {
    font-size: 44px;
    font-weight: 700;
    color: var(--primary);
    margin: 4px 0 8px;
}

.reserve-meta {
    color: var(--text-main);
    font-size: 15px;
    margin-bottom: 16px;
}

.reserve-note-hint {
    color: var(--text-muted);
    font-size: 13px;
    margin: 12px 0;
}

.reserve-note-input {
    width: 100%;
    min-height: 70px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 12px;
    outline: none;
}

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

.reserve-closed {
    background: #fff3e0;
    color: #b45309;
    padding: 20px;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 12px;
}

.status-badge {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    margin: 8px 0;
}

.status-pending {
    background: #fff3e0;
    color: #b45309;
}

.status-confirmed {
    background: #e6f4ea;
    color: #1e7e34;
}

