/* =========================================================
   MEDICATIONS PAGE — shared family reference list
   Warm neutral palette aligned with the rest of the app.
   ========================================================= */

/* ── Page header ─────────────────────────────────────────── */
.meds-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 8px;
}
.meds-back-btn,
.meds-add-btn {
    background: rgba(184, 134, 45, 0.08);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--primary, #B8862D);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.meds-back-btn:hover,
.meds-add-btn:hover { background: rgba(184, 134, 45, 0.14); }
.meds-title-wrap { flex: 1; min-width: 0; }
.meds-title {
    font-family: 'Georgia', 'Palatino Linotype', serif;
    font-size: 24px;
    font-weight: 700;
    color: #2C1A0E;
    margin: 0;
    letter-spacing: -0.01em;
}
.meds-sub {
    font-size: 12px;
    color: #9C7B68;
    margin: 2px 0 0;
    font-weight: 500;
}

/* ── Disclaimer banner ───────────────────────────────────── */
.meds-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 8px 16px 12px;
    padding: 10px 12px;
    background: rgba(184, 134, 45, 0.05);
    border: 1px solid rgba(184, 134, 45, 0.14);
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.45;
    color: #5b4434;
}
.meds-disclaimer-icon { color: var(--primary, #B8862D); font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.meds-disclaimer-text { flex: 1; }
.meds-disclaimer-close {
    background: none;
    border: none;
    color: #9C7B68;
    cursor: pointer;
    padding: 0 4px;
    font-size: 14px;
    flex-shrink: 0;
}

/* ── Action bar (Share / Show doctor) ────────────────────── */
.meds-action-bar {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px;
}
.meds-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 12px;
    background: #fff;
    color: #2C1A0E;
    border: 1px solid rgba(184, 134, 45, 0.18);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}
.meds-action-btn:hover {
    border-color: var(--primary, #B8862D);
    background: rgba(184, 134, 45, 0.04);
}
.meds-action-primary {
    background: var(--primary, #B8862D);
    color: #fff;
    border-color: var(--primary, #B8862D);
}
.meds-action-primary:hover { background: #6D28D9; color: #fff; }

/* ── Search ──────────────────────────────────────────────── */
.meds-search-wrap { padding: 0 16px 8px; }
.meds-search {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid rgba(184, 134, 45, 0.25);
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: #2C1A0E;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}
.meds-search:focus {
    outline: none;
    border-color: var(--primary, #B8862D);
}
.meds-search::placeholder { color: #B09A8A; }

/* ── View tabs ───────────────────────────────────────────── */
.meds-tabs {
    display: flex;
    gap: 6px;
    padding: 0 16px 14px;
}
.meds-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 6px;
    border-radius: 10px;
    border: 1px solid rgba(184, 134, 45, 0.18);
    background: transparent;
    color: #6B4C38;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}
.meds-tab:hover { background: rgba(184, 134, 45, 0.05); }
.meds-tab.active {
    background: var(--primary, #B8862D);
    color: #fff;
    border-color: var(--primary, #B8862D);
}
.meds-tab-icon { font-size: 14px; line-height: 1; }

/* ── Views and sections ──────────────────────────────────── */
.meds-view { padding: 0 16px 32px; }
.meds-section {
    margin-bottom: 18px;
}
.meds-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 4px 8px;
}
.meds-section-title {
    font-family: 'Georgia', serif;
    font-size: 16px;
    font-weight: 700;
    color: #2C1A0E;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.meds-section-emoji { font-size: 18px; }
.meds-section-count {
    font-size: 12px;
    color: #9C7B68;
    background: rgba(184, 134, 45, 0.06);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}
.meds-section-empty {
    color: #B09A8A;
    font-size: 13px;
    padding: 8px 4px;
    font-style: italic;
}

/* ── Medication cards ────────────────────────────────────── */
.med-card {
    background: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 1px 3px rgba(44, 26, 14, 0.04);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
.med-card:hover {
    border-color: rgba(184, 134, 45, 0.2);
    box-shadow: 0 3px 10px rgba(184, 134, 45, 0.08);
    transform: translateY(-1px);
}
.med-card-pill {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cat-color, #B8862D);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 700;
}
.med-card-body { flex: 1; min-width: 0; }
.med-card-name {
    font-size: 15px;
    font-weight: 700;
    color: #2C1A0E;
    margin: 0 0 2px;
    line-height: 1.25;
}
.med-card-strength {
    font-weight: 500;
    color: #6B4C38;
    margin-left: 4px;
}
.med-card-meta {
    font-size: 12px;
    color: #9C7B68;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.4;
}
.med-card-meta > span { display: inline-flex; align-items: center; gap: 3px; }
.med-card-meta .sep { color: #D4C3B3; }
.med-card-flag {
    font-size: 11px;
    color: var(--primary, #B8862D);
    background: rgba(184, 134, 45, 0.08);
    padding: 2px 7px;
    border-radius: 8px;
    font-weight: 600;
}
.med-card-chevron {
    color: #C4A898;
    flex-shrink: 0;
    line-height: 0;
}

/* Category colour accents (applied to .med-card-pill) */
.cat-cardiovascular  { --cat-color: #E11D48; }
.cat-cholesterol     { --cat-color: #F59E0B; }
.cat-anticoagulant   { --cat-color: #B91C1C; }
.cat-diabetes        { --cat-color: #0891B2; }
.cat-dementia        { --cat-color: #B8862D; }
.cat-sleep           { --cat-color: #6366F1; }
.cat-mood            { --cat-color: #EC4899; }
.cat-pain            { --cat-color: #DC6B3F; }
.cat-digestive       { --cat-color: #059669; }
.cat-respiratory     { --cat-color: #0EA5E9; }
.cat-supplement      { --cat-color: #84CC16; }
.cat-other           { --cat-color: #9C7B68; }

/* ── Archived section ────────────────────────────────────── */
.meds-archived-section { padding: 8px 16px 16px; }
.meds-archived-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px dashed rgba(184, 134, 45, 0.4);
    background: transparent;
    border-radius: 10px;
    color: #6B4C38;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.meds-archived-toggle:hover { background: rgba(184, 134, 45, 0.04); }
.meds-archived-count {
    background: rgba(184, 134, 45, 0.08);
    color: var(--primary, #B8862D);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.meds-archived-list { margin-top: 10px; opacity: 0.7; }
.meds-archived-list .med-card { opacity: 0.7; }

/* ── Empty state ─────────────────────────────────────────── */
.meds-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 32px;
    text-align: center;
}
.meds-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.meds-empty h3 {
    font-family: 'Georgia', serif;
    font-size: 20px;
    font-weight: 700;
    color: #2C1A0E;
    margin: 0 0 8px;
}
.meds-empty p {
    font-size: 14px;
    color: #9C7B68;
    line-height: 1.5;
    margin: 0 0 24px;
    max-width: 300px;
}
.meds-empty-cta {
    background: var(--primary, #B8862D);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}
.meds-empty-cta:hover { background: #6D28D9; transform: translateY(-1px); }

/* ── Form modal specifics ─────────────────────────────────── */
.meds-modal .form-row {
    display: flex;
    gap: 10px;
}
.meds-modal .form-row .form-group { flex: 1; }
.meds-times-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.meds-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid rgba(184, 134, 45, 0.3);
    border-radius: 20px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.meds-chip:hover { border-color: var(--primary, #B8862D); }
.meds-chip input { margin: 0; accent-color: var(--primary, #B8862D); }
.meds-chip input:checked + span {
    color: var(--primary, #B8862D);
    font-weight: 600;
}
.meds-chip:has(input:checked) {
    background: rgba(184, 134, 45, 0.08);
    border-color: var(--primary, #B8862D);
}
.danger-button {
    width: 100%;
    background: transparent;
    color: #DC2626;
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 12px;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    margin-top: 8px;
}
.danger-button:hover { background: rgba(220, 38, 38, 0.05); }

/* ── Detail modal ────────────────────────────────────────── */
.meds-detail-modal .meds-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #F3F4F6;
}
.meds-detail-modal .meds-detail-pill {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--cat-color, #B8862D);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
    flex-shrink: 0;
}
.meds-detail-modal h2 {
    font-family: 'Georgia', serif;
    font-size: 20px;
    color: #2C1A0E;
    margin: 0;
}
.meds-detail-modal .meds-detail-category {
    font-size: 12px;
    color: #9C7B68;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 2px;
}
.meds-detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #F3F4F6;
    gap: 12px;
}
.meds-detail-row:last-of-type { border-bottom: none; }
.meds-detail-label {
    font-size: 12px;
    color: #9C7B68;
    width: 110px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    padding-top: 2px;
}
.meds-detail-value {
    font-size: 14px;
    color: #2C1A0E;
    flex: 1;
    line-height: 1.45;
}
.meds-detail-history {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #F3F4F6;
    font-size: 11px;
    color: #B09A8A;
    font-style: italic;
}

/* ── Show Doctor full-screen mode ────────────────────────── */
.show-doctor-mode {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 9999;
    overflow-y: auto;
    padding: 0;
    color: #111;
    font-size: 18px;
    line-height: 1.55;
}
.sd-header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 18px 20px 12px;
    border-bottom: 2px solid #111;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.sd-title {
    font-family: 'Georgia', serif;
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    flex: 1;
    color: #000;
}
.sd-meta {
    font-size: 14px;
    color: #555;
    margin-top: 2px;
}
.sd-close {
    background: none;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.sd-body { padding: 20px; max-width: 720px; margin: 0 auto; }
.sd-section { margin-bottom: 26px; }
.sd-section-title {
    font-family: 'Georgia', serif;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px;
    color: #000;
    border-bottom: 1px solid #000;
    padding-bottom: 4px;
}
.sd-med {
    padding: 12px 0;
    border-bottom: 1px solid #e5e5e5;
}
.sd-med-name {
    font-size: 19px;
    font-weight: 700;
    color: #000;
}
.sd-med-strength { font-weight: 500; }
.sd-med-meta {
    font-size: 15px;
    color: #333;
    margin-top: 4px;
}
.sd-med-inst {
    font-size: 14px;
    color: #555;
    font-style: italic;
    margin-top: 2px;
}
.sd-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e5e5;
    text-align: center;
    font-size: 12px;
    color: #777;
}

/* ── Desktop adjustments ─────────────────────────────────── */
@media (min-width: 1024px) {
    .meds-page-header { padding: 24px 0 14px; }
    .meds-title { font-size: 28px; }
    .meds-action-bar, .meds-tabs, .meds-search-wrap, .meds-view {
        padding-left: 0;
        padding-right: 0;
    }
    .meds-action-btn { max-width: 200px; }
}

/* ── Home-screen "Today's meds" card ─────────────────────── */
.today-meds-card {
    background: #fff;
    border-radius: 16px;
    margin: 8px 16px 16px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 1px 3px rgba(44, 26, 14, 0.04);
    cursor: pointer;
    transition: all 0.15s ease;
}
.today-meds-card:hover {
    border-color: rgba(184, 134, 45, 0.2);
    box-shadow: 0 3px 12px rgba(184, 134, 45, 0.08);
}
.today-meds-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.today-meds-title {
    font-family: 'Georgia', serif;
    font-size: 15px;
    font-weight: 700;
    color: #2C1A0E;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.today-meds-count {
    font-size: 12px;
    color: #9C7B68;
    font-weight: 500;
}
.today-meds-slots {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.today-meds-slot {
    flex: 1;
    min-width: 70px;
    padding: 8px 10px;
    background: rgba(184, 134, 45, 0.04);
    border-radius: 10px;
    text-align: center;
}
.today-meds-slot-label {
    font-size: 10px;
    color: #9C7B68;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 4px;
}
.today-meds-slot-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary, #B8862D);
}
.today-meds-slot.empty .today-meds-slot-count { color: #D4C3B3; }
.today-meds-empty {
    text-align: center;
    padding: 18px 12px;
    color: #9C7B68;
    font-size: 13px;
}
.today-meds-empty-cta {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--primary, #B8862D);
    font-weight: 600;
    text-decoration: none;
}
