/* ============================================
   isiMed – Health-App Mobile-First Stylesheet
   ============================================ */

:root {
    --teal: #1a9c87;
    --teal-light: #e6f5f2;
    --teal-dark: #158a76;
    --orange: #e8735a;
    --orange-light: #fdf0ed;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #8e8ea0;
    --border: #eef0f2;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --bottom-nav-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Reset & Base ---- */
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: 0;
}

/* ---- Page Layout ---- */
.page-content {
    padding: 1.5rem 1.25rem;
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 1.5rem);
    max-width: 540px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .page-content {
        padding: 2rem;
        padding-bottom: 2rem;
        max-width: 680px;
    }
}

/* ---- Page Title ---- */
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}
.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ---- Desktop Navbar ---- */
.desktop-nav {
    background-color: var(--teal);
}
.desktop-nav .navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -2px 16px rgba(0,0,0,0.06);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    gap: 3px;
    padding: 8px 0;
    transition: color 0.15s;
}
.bottom-nav-item i {
    font-size: 1.35rem;
    line-height: 1;
}
.bottom-nav-item.active {
    color: var(--teal);
}
.bottom-nav-item:active {
    opacity: 0.7;
}
/* Special "Add" center button */
.bottom-nav-add {
    position: relative;
}
.bottom-nav-add .nav-add-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--teal-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -6px;
    transition: background 0.15s;
}
.bottom-nav-add.active .nav-add-circle {
    background: var(--teal);
    color: white;
}

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body {
    padding: 1.125rem;
}

/* ---- Health Dashboard ---- */
.greeting {
    font-size: 0.9rem;
    color: var(--teal);
    margin-bottom: 0.125rem;
}

.bp-big-reading {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    letter-spacing: -1px;
}
.bp-big-reading .bp-slash {
    font-weight: 300;
    color: var(--text-muted);
    margin: 0 2px;
}
.bp-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.sparkline-container {
    height: 40px;
    margin-top: 0.5rem;
}

.stat-card {
    text-align: center;
    padding: 1rem 0.5rem;
}
.stat-icon {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.stat-unit {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}
.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* ---- Status Badges ---- */
.badge-status {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-normal {
    background-color: var(--teal-light);
    color: var(--teal);
}
.badge-elevated {
    background-color: var(--orange-light);
    color: var(--orange);
}
.badge-high {
    background-color: #fde8e8;
    color: #dc3545;
}
.badge-taken {
    background-color: var(--teal-light);
    color: var(--teal);
}
.badge-pending {
    background-color: var(--orange-light);
    color: var(--orange);
}
.badge-missed {
    background-color: #fde8e8;
    color: #dc3545;
}
.badge-skipped {
    background-color: #f0f0f2;
    color: #6c757d;
}

/* ---- Medicine Section ---- */
.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}
.section-right {
    font-size: 0.85rem;
    color: var(--teal);
    font-weight: 600;
}

.med-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.125rem;
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
}
.med-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 1rem;
}
.med-info {
    flex-grow: 1;
    min-width: 0;
}
.med-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}
.med-schedule {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.med-dosage {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: right;
    flex-shrink: 0;
}
.med-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

/* ---- Pill Buttons (Taken / Take now) ---- */
.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.pill-taken {
    background: var(--teal-light);
    color: var(--teal);
}
.pill-take-now {
    background: var(--orange-light);
    color: var(--orange);
    border: 1px solid var(--orange);
}
.pill-skip {
    background: #f0f0f2;
    color: #6c757d;
}

/* ---- Progress Bar ---- */
.progress-card {
    padding: 1rem 1.125rem;
}
.progress-bar-custom {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.625rem;
}
.progress-bar-fill {
    height: 100%;
    background: var(--teal);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ---- History / Reading Cards ---- */
.reading-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.125rem;
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.reading-bp {
    font-size: 1.25rem;
    font-weight: 700;
}
.reading-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* ---- Charts ---- */
.chart-card {
    padding: 1.25rem;
}
.chart-card canvas {
    max-height: 200px;
}

/* ---- Forms ---- */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    min-height: 48px;
    background: var(--card-bg);
}
.form-control:focus, .form-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(26,156,135,0.12);
}
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.375rem;
}

/* ---- Buttons ---- */
.btn-teal {
    background-color: var(--teal);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    min-height: 50px;
}
.btn-teal:hover, .btn-teal:active {
    background-color: var(--teal-dark);
    color: white;
}
.btn-icon-round {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 1.1rem;
}
.btn-icon-round:hover {
    border-color: var(--teal);
    color: var(--teal);
}

/* ---- Add BP Visual ---- */
.bp-visual-card {
    background: var(--teal-light);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.bp-visual-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--teal);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}
.bp-visual-reading {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
}
.bp-visual-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ---- Date Navigation ---- */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.date-nav-center {
    text-align: center;
}
.date-nav-day {
    font-weight: 700;
    font-size: 1rem;
}
.date-nav-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Auth Pages ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a9c87 0%, #158a76 100%);
    padding: 1.5rem;
}
.auth-card {
    background: white;
    border-radius: 1.25rem;
    padding: 2.25rem 1.75rem;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
    width: 100%;
    max-width: 400px;
}
.auth-logo {
    font-size: 2.5rem;
    color: var(--teal);
    margin-bottom: 0.5rem;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}

/* ---- Offline / PWA Banners ---- */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background-color: #fff3cd;
    color: #664d03;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #ffda6a;
}
.pwa-banner {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 0.75rem);
    left: 1rem;
    right: 1rem;
    z-index: 1028;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* ---- Utilities ---- */
.text-teal { color: var(--teal) !important; }
.bg-teal { background-color: var(--teal) !important; }
.bg-teal-light { background-color: var(--teal-light) !important; }
