:root {
    --primary: #2a9d8f;
    --bg: #f4f7f6;
    --text: #264653;
    --white: #ffffff;
}

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

@font-face {
    font-family: "myemoji";

    src: local('Apple Color Emoji'),
         local('Android Emoji'),
         local('Segoe UI Emoji'),
         local('Noto Color Emoji'),
         local(EmojiSymbols),
         local(Symbola);

    unicode-range: U+1F600-1F64F;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: stretch;
    min-height: 100svh;
    max-height: 100svh;
}

#app {
    width: 100%;
    max-width: 500px; /* Keeps it looking like a phone on desktop */
    min-height: 100%;
    max-height: 100%;
    position: relative;
    padding-bottom: 70px; /* Space for bottom nav */
}

.view {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: calc(100vh - 100px);
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.hidden { display: none !important; }

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

/* Cards & Forms */
.card {
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

h1, h2 { margin-bottom: 20px; text-align: center; }

.input-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: bold; }

input {
    width: 100%;
    padding: 12px;
    margin-top: 5px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px; /* Prevents iOS zoom on focus */
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 10px;
}

.date-range-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: larger;
    font-weight: bold;
}

div#date-range {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
}

a.date-range-button {
    text-decoration: none;
    display: flex;
    color:#264653;
    cursor: pointer;
    padding: 6px 12px;
    margin: 8px 2px;
}

a.date-range-button:hover {
    background-color: lightslategray;
    color: floralwhite;
}

a.date-range-button:active {
    background-color: cornflowerblue;
    color: floralwhite;
}

/* Bottom Navigation */
#bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 500px;
    height: 65px;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #ddd;
    padding-bottom: env(safe-area-inset-bottom); /* For iPhone notch */
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    width: 100%;
    height: 100%;
    font-weight: bold;
}

.nav-item.active { 
    background-color: cornflowerblue; 
    color: floralwhite;
}

.nav-item span { font-size: 24px; }

#history-list { 
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* History List Items */
.history-item {
    background: white;
    padding: 8px 12px 8px 8px;
    border-radius: 10px;
    margin-bottom: 5px;
    margin-right: 5px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--primary);
}

.date-label { font-size: 0.8rem; color: #888; }
.time-label { font-size: 0.8rem; color: #888; }
.bp-label { font-size: 0.5rem; color: #888; }
.hr-label { font-size: 0.5rem; color: #888; }
.systolic-value { font-size: 1.2rem; font-weight: bold; color: #ff6b6b; }
.diastolic-value { font-size: 1.2rem; font-weight: bold; color: #4ecdc4; }
.bp-container { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 15%; }
.hr-container { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 15%; }
.hr-value { font-size: 1.2rem; color: darkred; font-weight: bold; }

/* div.heart-rate {
    font-family: myemoji;
    font-size: 1.8rem;
    position: relative;
} */

/* div.heart-rate-value {
    position: absolute;
    font-size: 0.8rem;
    color: whitesmoke;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
} */

/* Container to center the spinner on the screen */
#loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh; /* Full viewport height */
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: white; /* Matches your app background */
    z-index: 9999;
}

/* The actual spinner element */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3; /* Light grey background circle */
    border-top: 5px solid #3498db; /* Blue color for the moving part */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* The rotation animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Container to hold all toasts */
#toast-container {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* The actual toast style */
.toast {
    min-width: 250px;
    margin-bottom: 10px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-family: sans-serif;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    /* Animation properties */
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

/* Success color */
.toast-success {
    background-color: #2ecc71;
}

/* Error color (optional, if you want to use it for failures) */
.toast-error {
    background-color: #e74c3c;
}

/* Class to trigger when the toast is visible */
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Class to trigger the fade-out animation before removal */
.toast.fade-out {
    opacity: 0;
    transform: translateY(20px);
}