/* ===== CARDIOPULSE - Professional Hospital Style ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: #f0f4f8;
    color: #1e2b3c;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    position: fixed;
    inset: 0;
    background: #f0f4f8;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    background: white;
    padding: 40px 30px;
    border-radius: 32px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.login-card h1 {
    color: #0066a1;
    font-size: 2rem;
    margin-bottom: 24px;
}

.login-card input {
    width: 100%;
    padding: 14px;
    margin: 8px 0;
    border-radius: 40px;
    border: 1px solid #dde3e9;
    background: #f9fbfd;
    font-size: 1rem;
    transition: all 0.2s;
}

.login-card input:focus {
    outline: 2px solid #0066a1;
    border-color: transparent;
}

.login-card button {
    width: 100%;
    padding: 14px;
    margin: 8px 0;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

#loginBtn {
    background: #0066a1;
    color: white;
}

#loginBtn:hover {
    background: #004b7a;
}

#guestBtn {
    background: #e2e8f0;
    color: #1e2b3c;
}

#guestBtn:hover {
    background: #d0d8e0;
}

.error {
    color: #c00;
    margin: 10px 0;
    font-size: 0.9rem;
}

/* ===== MAIN APP CONTAINER ===== */
.app-container {
    max-width: 480px;
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 16px;
}

.app-container.visible {
    display: flex;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 32px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    border: 1px solid #e2e8f0;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header h1 {
    color: #0066a1;
    font-size: 1.6rem;
    font-weight: 600;
}

.logout-btn {
    background: #e2e8f0;
    color: #1e2b3c;
    border: none;
    padding: 8px 18px;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #d0d8e0;
}

/* ===== TAGLINE ===== */
.tagline {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    font-style: italic;
}

/* ===== PATIENT BANNER ===== */
.patient-banner {
    background: #f1f9ff;
    color: #0066a1;
    padding: 10px 16px;
    border-radius: 40px;
    margin-bottom: 24px;
    font-weight: 500;
    text-align: center;
    border: 1px solid #cce5ff;
}

.patient-id {
    font-weight: 700;
}

/* ===== HEART DISPLAY ===== */
.heart-display {
    text-align: center;
    margin-bottom: 16px;
}

.heart-icon {
    font-size: 2.5rem;
    color: #0066a1;
    display: block;
    margin-bottom: 4px;
}

.hr-number {
    font-size: 4rem;
    font-weight: 700;
    color: #1e2b3c;
}

.hr-unit {
    color: #64748b;
    font-size: 1.2rem;
    margin-left: 4px;
}

/* ===== STATUS ===== */
.status {
    color: #0066a1;
    font-weight: 600;
    text-align: center;
    margin: 16px 0 8px;
    font-size: 1rem;
}

/* ===== STIMULUS BOX (GREEN BUTTON) ===== */
.stimulus-box {
    width: 120px;
    height: 120px;
    background: #d9e2ec;
    border-radius: 30px;
    margin: 16px auto;
    box-shadow: 0 6px 0 #b0c4d9;
    cursor: pointer;
    transition: all 0.1s ease;
}

.stimulus-box.ready {
    background: #48bb78;
    box-shadow: 0 6px 0 #2f855a, 0 0 20px #48bb78;
}

/* ===== REACTION TIME DISPLAY ===== */
.rt-container {
    text-align: center;
    margin: 8px 0 16px;
}

.rt-label {
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.rt-value {
    color: #0066a1;
    font-size: 3rem;
    font-weight: 700;
}

.rt-unit {
    color: #64748b;
    font-size: 0.9rem;
    margin-left: 4px;
}

/* ===== LEVEL BUTTONS ===== */
.level-container {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}

.level-btn {
    flex: 1;
    padding: 12px 0;
    border-radius: 40px;
    border: 1px solid #dde3e9;
    background: #f9fbfd;
    color: #1e2b3c;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.level-btn:hover {
    background: #e2e8f0;
}

.level-btn.selected {
    background: #0066a1;
    border-color: #0066a1;
    color: white;
}

/* ===== ACTION BUTTONS ===== */
.action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.action-btn {
    flex: 1;
    padding: 14px;
    border-radius: 40px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.start-btn {
    background: #0066a1;
    color: white;
}

.start-btn:hover {
    background: #004b7a;
}

.reset-btn {
    background: #e2e8f0;
    color: #1e2b3c;
}

.reset-btn:hover {
    background: #d0d8e0;
}

/* ===== ACTIVE INDICATOR LED ===== */
.led {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cbd5e0;
    transition: all 0.2s;
}

.led.active {
    background: #48bb78;
    box-shadow: 0 0 10px #48bb78;
}

.led-label {
    color: #64748b;
    font-size: 0.8rem;
    margin-left: 4px;
}

/* ===== INFO BAR ===== */
.info-bar {
    display: flex;
    justify-content: space-between;
    color: #64748b;
    font-size: 0.9rem;
    margin: 16px 0 8px;
    padding: 8px 0;
    border-top: 1px solid #e2e8f0;
}

/* ===== METRICS SECTION ===== */
.metrics-title {
    font-weight: 600;
    margin: 16px 0 12px;
    color: #1e2b3c;
    font-size: 1.1rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 12px 0;
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.metric-cell {
    background: #f9fbfd;
    padding: 12px 6px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0066a1;
    display: block;
}

.metric-label {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== CHART ===== */
.chart-container {
    background: #f9fbfd;
    border-radius: 24px;
    padding: 12px;
    margin: 16px 0;
    height: 100px;
    border: 1px solid #e2e8f0;
}

/* ===== CLINICAL NOTE ===== */
.clinical-note {
    background: #f1f9ff;
    border-left: 4px solid #0066a1;
    padding: 14px;
    border-radius: 16px;
    margin: 16px 0;
    color: #1e2b3c;
    font-weight: 500;
    transition: background 0.3s;
}

/* ===== HISTORY PANEL ===== */
.history-panel {
    background: #f9fbfd;
    border-radius: 20px;
    padding: 12px;
    max-height: 100px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    margin: 12px 0;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 6px;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.85rem;
}

.history-item:last-child {
    border-bottom: none;
}

/* ===== SYNC STATUS ===== */
.sync-status {
    text-align: center;
    color: #0066a1;
    font-size: 0.8rem;
    margin-top: 12px;
    font-weight: 500;
}

/* ===== FIREBASE STATUS (ALIAS) ===== */
#fbStatus {
    text-align: center;
    color: #0066a1;
    font-size: 0.8rem;
    margin-top: 12px;
    font-weight: 500;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 400px) {
    .card {
        padding: 20px;
    }
    
    .hr-number {
        font-size: 3.5rem;
    }
    
    .rt-value {
        font-size: 2.5rem;
    }
    
    .metric-grid {
        gap: 6px;
    }
    
    .metric-value {
        font-size: 1.2rem;
    }
}
