/* NirogMaya Patient Portal - shared stylesheet
 * Visual language matches frontend/doctor/index.html (segoe UI, soft shadows,
 * card-based layout, gradient accents). Pure CSS - no Tailwind, no React.
 */

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

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #1f2937;
    min-height: 100vh;
}

a { color: #4338ca; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
 * Page layout - stacked, max-width container
 * ============================================================ */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}
.page-narrow { max-width: 720px; }
.page-wide { max-width: 1300px; }

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-tight { display: flex; flex-direction: column; gap: 10px; }

/* ============================================================
 * Header / footer (inlined in each page, styled here)
 * ============================================================ */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: linear-gradient(180deg, #e67e22 0%, #f39c12 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.portal-header h1 {
    font-size: 1.4em;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.portal-header .who {
    font-size: 0.85em;
    opacity: 0.9;
    margin-top: 2px;
    font-family: 'Consolas', 'Menlo', monospace;
}
.portal-header .actions { display: flex; gap: 8px; align-items: center; }

.portal-footer {
    margin-top: 30px;
    padding: 18px 24px;
    text-align: center;
    font-size: 0.8em;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
}

.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 24px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}
.subnav a {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    color: #4b5563;
}
.subnav a:hover { background: #f3f4f6; text-decoration: none; }
.subnav a.active { background: #fff7ed; color: #c2410c; font-weight: 600; }

/* ============================================================
 * Cards
 * ============================================================ */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-h { font-size: 0.75em; text-transform: uppercase; letter-spacing: 1.5px; color: #6b7280; margin-bottom: 8px; }
.card h2 { font-size: 1.05em; font-weight: 700; color: #111827; margin-bottom: 8px; }
.card h3 { font-size: 0.95em; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
.card .muted { color: #6b7280; font-size: 0.9em; }

.card-link { display: block; cursor: pointer; transition: background 0.15s; }
.card-link:hover { background: #fafafa; text-decoration: none; }

.card-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
@media (max-width: 800px) {
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
 * Status badges + pills
 * ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    background: #f1f5f9;
    color: #334155;
}
.badge-emerald { background: #d1fae5; color: #065f46; }
.badge-sky { background: #e0f2fe; color: #075985; }
.badge-violet { background: #ede9fe; color: #5b21b6; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-slate { background: #e2e8f0; color: #334155; }
.badge-indigo { background: #e0e7ff; color: #3730a3; }

.pill {
    border: 0;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78em;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
    transition: background 0.15s, color 0.15s;
}
.pill:hover { background: #cbd5e1; }
.pill.active { background: #a7f3d0; color: #065f46; }

/* ============================================================
 * Buttons
 * ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: #059669;
    color: #fff;
    border-color: #059669;
}
.btn-primary:hover { background: #047857; border-color: #047857; }

.btn-danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-secondary {
    background: #fff;
    color: #c2410c;
    border-color: #fed7aa;
}
.btn-secondary:hover { background: #fff7ed; }

.btn-cta {
    padding: 14px 24px;
    font-size: 1em;
    border-radius: 12px;
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: 0;
    box-shadow: 0 2px 6px rgba(16,185,129,0.35);
}
.btn-cta:hover { background: linear-gradient(180deg, #059669 0%, #047857 100%); }

/* ============================================================
 * Big-number / token display
 * ============================================================ */
.token-display {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.token-num {
    font-size: 3.6em;
    font-weight: 900;
    line-height: 1;
    color: #0f172a;
    margin-top: 4px;
}
.kpi {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 14px;
}
.kpi-label { font-size: 0.7em; text-transform: uppercase; letter-spacing: 1px; color: #6b7280; }
.kpi-value { margin-top: 4px; font-size: 1.4em; font-weight: 700; color: #1f2937; }

/* ============================================================
 * Encounter step strip
 * ============================================================ */
.steps {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
    margin-top: 10px;
}
@media (max-width: 700px) {
    .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.step {
    text-align: center;
    font-size: 0.65em;
    padding: 6px 4px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
}
.step.done { background: #d1fae5; color: #065f46; }

/* ============================================================
 * Form bits
 * ============================================================ */
.label {
    display: block;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #6b7280;
    margin-bottom: 4px;
}
.input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    background: #fff;
    color: #1f2937;
}
.input-mono { font-family: 'Consolas', 'Menlo', monospace; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > * { flex: 0 0 auto; }

/* ============================================================
 * Banners
 * ============================================================ */
.banner {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85em;
}
.banner-warn { background: #fef3c7; border: 1px solid #fde68a; color: #78350f; font-weight: 600; }
.banner-info { background: #dbeafe; border: 1px solid #bfdbfe; color: #1e40af; }
.banner-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ============================================================
 * Telemed video tiles
 * ============================================================ */
.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}
@media (max-width: 700px) {
    .video-grid { grid-template-columns: 1fr; }
}
.video-tile {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #1f2937;
}
.video-tile video {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    object-fit: cover;
    display: block;
}
.video-tile .caption {
    background: rgba(15,23,42,0.85);
    color: #fff;
    font-size: 0.78em;
    padding: 4px 10px;
}
.rec-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.75em;
    font-weight: 700;
}
.rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* ============================================================
 * Timeline list
 * ============================================================ */
.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.timeline-entry {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
}
.timeline-entry .row1 { display: flex; justify-content: space-between; gap: 8px; }
.timeline-entry .ttl { font-weight: 600; font-size: 0.95em; color: #111827; }
.timeline-entry .when { font-size: 0.78em; color: #6b7280; }
.timeline-entry .smry { font-size: 0.85em; color: #4b5563; margin-top: 4px; }
.timeline-entry .meta { font-size: 0.73em; color: #9ca3af; margin-top: 4px; }

/* ============================================================
 * Loading / empty states
 * ============================================================ */
.loading, .empty {
    color: #6b7280;
    font-size: 0.9em;
    padding: 12px 0;
}

/* ============================================================
 * Phase 22: Language switcher (i18n)
 * ============================================================ */
.lang-switcher {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #111827;
    font-size: 0.9em;
    cursor: pointer;
    margin-left: 8px;
}
.lang-switcher:focus {
    outline: 2px solid #6366f1;
    outline-offset: 1px;
}
