/* =========================================================
   Bariatric Nepal — Patient Portal Styles
   ========================================================= */

:root {
    --bn-primary:    #0052a5;
    --bn-primary-light: #e8f0fb;
    --bn-accent:     #00a86b;
    --bn-danger:     #dc2626;
    --bn-warning:    #d97706;
    --bn-text:       #1a1a2e;
    --bn-muted:      #6b7280;
    --bn-border:     #e5e7eb;
    --bn-bg:         #f5f7fb;
    --bn-card:       #ffffff;
    --bn-radius:     12px;
    --bn-shadow:     0 2px 12px rgba(0,0,0,.08);
}

.bn-wrap { font-family: 'Segoe UI', Arial, sans-serif; color: var(--bn-text); }
.bn-wrap *, .bn-wrap *::before, .bn-wrap *::after { box-sizing: border-box; }

/* ── Login ─────────────────────────────────────────────── */

.bn-login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0052a5 0%, #00a86b 100%);
    padding: 20px;
}
.bn-login-card {
    background: var(--bn-card);
    border-radius: 20px;
    padding: 40px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.bn-login-logo { text-align: center; margin-bottom: 30px; }
.bn-logo-icon { font-size: 48px; }
.bn-login-logo h1 { font-size: 22px; margin: 8px 0 4px; color: var(--bn-primary); }
.bn-login-logo p { color: var(--bn-muted); margin: 0; font-size: 14px; }
.bn-login-help { text-align: center; color: var(--bn-muted); font-size: 13px; margin-top: 20px; line-height: 1.6; }

/* ── Fields ────────────────────────────────────────────── */

.bn-field { margin-bottom: 16px; }
.bn-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--bn-text); }
.bn-field label small { font-weight: 400; color: var(--bn-muted); }
.bn-field input, .bn-field select, .bn-field textarea {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--bn-border);
    border-radius: 8px; font-size: 14px; color: var(--bn-text);
    background: #fafafa; transition: border-color .2s;
}
.bn-field input:focus, .bn-field select:focus, .bn-field textarea:focus {
    outline: none; border-color: var(--bn-primary); background: #fff;
}
.bn-field textarea { resize: vertical; min-height: 90px; }
.bn-input-eye { position: relative; }
.bn-input-eye input { padding-right: 40px; }
.bn-eye-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; }

/* ── Buttons ───────────────────────────────────────────── */

.bn-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 8px; font-size: 14px;
    font-weight: 600; cursor: pointer; border: none; text-decoration: none;
    transition: all .2s;
}
.bn-btn-primary { background: var(--bn-primary); color: #fff; }
.bn-btn-primary:hover { background: #003d7a; }
.bn-btn-outline { background: transparent; color: var(--bn-primary); border: 1.5px solid var(--bn-primary); }
.bn-btn-outline:hover { background: var(--bn-primary-light); }
.bn-btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.bn-link { background: none; border: none; color: var(--bn-primary); cursor: pointer; font-size: 13px; text-decoration: underline; }
.bn-btn-icon { background: none; border: none; cursor: pointer; font-size: 20px; position: relative; padding: 4px; }

/* ── Alerts ────────────────────────────────────────────── */

.bn-alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.bn-alert-success, .bn-alert.success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.bn-alert-error, .bn-alert.error   { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }

/* ── Portal ────────────────────────────────────────────── */

.bn-portal-wrap { background: var(--bn-bg); min-height: 100vh; padding: 0 0 40px; }

.bn-topbar {
    background: var(--bn-primary); color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
}
.bn-greeting { font-size: 15px; }
.bn-topbar-right { display: flex; align-items: center; gap: 12px; }
.bn-badge {
    position: absolute; top: -4px; right: -4px;
    background: #ef4444; color: #fff; font-size: 10px;
    border-radius: 50%; width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}

/* Stats */
.bn-stats-grid {
    display: grid; grid-template-columns: repeat(4,1fr); gap: 16px;
    padding: 20px 24px 0;
}
@media(max-width:768px) { .bn-stats-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:480px) { .bn-stats-grid { grid-template-columns: 1fr 1fr; } }

.bn-stat-card {
    background: var(--bn-card); border-radius: var(--bn-radius);
    padding: 16px; box-shadow: var(--bn-shadow);
}
.bn-stat-label { font-size: 12px; color: var(--bn-muted); font-weight: 600; text-transform: uppercase; letter-spacing:.5px; }
.bn-stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.bn-stat-value span { font-size: 13px; font-weight: 400; color: var(--bn-muted); }
.bn-stat-sub { font-size: 12px; color: var(--bn-muted); margin-top: 4px; }
.bn-positive { color: var(--bn-accent) !important; }

/* Tabs */
.bn-tabs {
    display: flex; gap: 4px; padding: 20px 24px 0; flex-wrap: wrap;
}
.bn-tab {
    padding: 9px 16px; border-radius: 8px 8px 0 0; font-size: 13px; font-weight: 600;
    border: none; background: #dbe4f0; color: var(--bn-primary); cursor: pointer;
    transition: all .2s;
}
.bn-tab.active { background: var(--bn-primary); color: #fff; }

.bn-tab-content { display: none; padding: 0 24px; }
.bn-tab-content.active { display: block; }

/* Section */
.bn-section {
    background: var(--bn-card); border-radius: 0 var(--bn-radius) var(--bn-radius) var(--bn-radius);
    padding: 24px; margin-bottom: 16px; box-shadow: var(--bn-shadow);
}
.bn-section h3 { margin: 0 0 18px; font-size: 16px; color: var(--bn-primary); }
.bn-section-sub { font-size: 14px; color: var(--bn-muted); margin: 20px 0 10px; }

/* Forms */
.bn-form-inline { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.bn-form-inline .bn-field { min-width: 160px; margin-bottom: 0; }
.bn-form-inline .bn-field-wide { flex: 1; min-width: 200px; }
.bn-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; }

/* Progress bar */
.bn-progress-bar-wrap { margin-bottom: 20px; }
.bn-progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--bn-muted); margin-bottom: 6px; }
.bn-progress-bar { background: var(--bn-border); border-radius: 99px; height: 12px; overflow: hidden; }
.bn-progress-fill { background: linear-gradient(90deg, var(--bn-primary), var(--bn-accent)); border-radius: 99px; height: 100%; transition: width .6s ease; }

/* BMI badge */
.bn-bmi-badge { display: inline-block; color: #fff; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.bn-bmi-display { font-size: 22px; font-weight: 700; }
.bn-bmi-display #bn-bmi-cat { font-size: 13px; margin-left: 8px; font-weight: 400; color: var(--bn-muted); }

/* Table */
.bn-table-wrap { overflow-x: auto; }
.bn-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bn-table th, .bn-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--bn-border); }
.bn-table th { background: var(--bn-bg); font-size: 12px; text-transform: uppercase; letter-spacing:.5px; color: var(--bn-muted); }
.bn-table tr:hover td { background: #fafbff; }

/* Blood reports */
.bn-report-card {
    border: 1.5px solid var(--bn-border); border-radius: var(--bn-radius);
    padding: 16px; margin-bottom: 12px;
}
.bn-report-card.reviewed { border-color: #86efac; }
.bn-report-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.bn-badge-success { background: #d1fae5; color: #065f46; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.bn-badge-pending { background: #fef3c7; color: #92400e; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.bn-report-values { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.bn-val-chip { background: var(--bn-bg); border: 1px solid var(--bn-border); padding: 4px 10px; border-radius: 99px; font-size: 13px; }
.bn-doctor-note { background: #eff6ff; border-left: 3px solid var(--bn-primary); padding: 10px 14px; border-radius: 0 8px 8px 0; font-size: 13px; margin-top: 8px; }

/* Complaints */
.bn-complaint-card {
    border: 1.5px solid var(--bn-border); border-radius: var(--bn-radius);
    padding: 16px; margin-bottom: 12px;
}
.bn-complaint-card.severity-urgent { border-color: var(--bn-danger); }
.bn-complaint-card.severity-high { border-color: #f97316; }
.bn-complaint-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.bn-severity-badge { padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bn-bg); }
.bn-status-badge { padding: 2px 10px; border-radius: 99px; font-size: 12px; }
.status-open     { background: #fef3c7; color: #92400e; }
.status-reviewed { background: #d1fae5; color: #065f46; }
.status-resolved { background: #e0e7ff; color: #3730a3; }
.bn-complaint-text { margin: 6px 0; }
.bn-doctor-reply { background: #f0fdf4; border-left: 3px solid var(--bn-accent); padding: 10px 14px; border-radius: 0 8px 8px 0; font-size: 13px; margin-top: 8px; }

/* Diet */
.bn-diet-card {
    background: var(--bn-card); border-radius: var(--bn-radius);
    padding: 24px; margin-bottom: 16px; box-shadow: var(--bn-shadow);
}
.bn-diet-header { margin-bottom: 16px; }
.bn-diet-header h3 { margin: 0 0 4px; }
.bn-meal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; }
.bn-meal-card {
    background: var(--bn-bg); border-radius: 10px; padding: 14px;
    border: 1px solid var(--bn-border);
}
.bn-meal-name { font-weight: 700; font-size: 15px; color: var(--bn-primary); margin-bottom: 4px; }
.bn-meal-time { font-size: 12px; color: var(--bn-muted); margin-bottom: 8px; }
.bn-meal-food { font-size: 13px; line-height: 1.6; }
.bn-meal-cal { font-size: 12px; color: var(--bn-accent); font-weight: 600; margin-top: 8px; }
.bn-diet-notes { margin-top: 16px; font-size: 13px; color: var(--bn-muted); }

/* Medications */
.bn-meds-list { padding-top: 20px; }
.bn-med-card {
    border: 1.5px solid var(--bn-border); border-radius: var(--bn-radius);
    padding: 16px; margin-bottom: 10px;
}
.bn-med-card.active { border-color: var(--bn-primary); }
.bn-med-card.inactive { opacity: .6; }
.bn-med-name { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.bn-med-details { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--bn-muted); margin-bottom: 6px; }
.bn-med-instructions { font-size: 13px; color: var(--bn-text); background: var(--bn-bg); padding: 8px 12px; border-radius: 6px; }

/* Notifications panel */
.bn-notif-panel {
    position: absolute; right: 20px; top: 60px; z-index: 999;
    background: var(--bn-card); border-radius: var(--bn-radius);
    box-shadow: 0 8px 30px rgba(0,0,0,.15); width: 340px; max-width: 95vw;
}
.bn-notif-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--bn-border);
}
.bn-notif-list { max-height: 360px; overflow-y: auto; }
.bn-notif-item { padding: 12px 16px; border-bottom: 1px solid var(--bn-border); }
.bn-notif-item strong { font-size: 13px; display: block; }
.bn-notif-item p { font-size: 12px; color: var(--bn-muted); margin: 2px 0 4px; }
.bn-notif-item small { font-size: 11px; color: #9ca3af; }
.bn-empty { text-align: center; padding: 20px; color: var(--bn-muted); font-size: 13px; }

.bn-empty-state { text-align: center; padding: 40px 20px; color: var(--bn-muted); }
.bn-empty-icon { font-size: 48px; margin-bottom: 12px; }

/* Spinner */
.bn-spinner {
    width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.bn-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.bn-modal-inner {
    background: #fff; border-radius: 16px; padding: 32px;
    width: 100%; max-width: 420px; margin: 16px;
}
.bn-modal-inner h3 { margin: 0 0 8px; }
.bn-modal-inner > p { color: var(--bn-muted); font-size: 14px; margin-bottom: 20px; }

/* Responsive */
@media(max-width: 600px) {
    .bn-stats-grid  { padding: 12px; }
    .bn-tabs        { padding: 12px 12px 0; }
    .bn-tab-content { padding: 0 12px; }
    .bn-section     { padding: 16px; }
    .bn-form-inline { flex-direction: column; }
    .bn-form-inline .bn-field { width: 100%; }
}
