/* ================================================================
   JUXITA PCMS — Main Stylesheet
   Prostate Cancer Management System
   ================================================================ */

:root {
    --bg:        #060d1a;
    --surface:   #0d1b2e;
    --surface2:  #112240;
    --border:    #1e3a5f;
    --accent:    #1d4ed8;
    --accent2:   #38bdf8;
    --teal:      #0891b2;
    --text:      #e2e8f0;
    --muted:     #64748b;
    --success:   #22c55e;
    --warning:   #f59e0b;
    --danger:    #ef4444;
    --orange:    #f97316;
    --sidebar-w: 240px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13.5px;
    min-height: 100vh;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Sidebar ── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 200; overflow-y: auto;
    transition: transform .25s;
}
.sidebar-brand {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.brand-logo { width: 38px; height: 38px; flex-shrink: 0; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text .name { font-size: 13px; font-weight: 700; color: #f1f5f9; }
.brand-text .sub  { font-size: 10px; color: var(--muted); margin-top: 1px; }

.nav-section {
    padding: 12px 16px 4px;
    font-size: 9.5px; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted);
}
.nav-item { margin: 1px 8px; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--muted); font-size: 13px; font-weight: 500;
    text-decoration: none; transition: all .15s;
}
.nav-link:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav-link.active { background: rgba(29,78,216,.2); color: var(--accent2); }
.nav-link .icon { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); margin-top: auto; }

/* ── Main wrap ── */
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

/* ── Topbar ── */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px 22px; display: flex; align-items: center; gap: 14px;
}
.topbar-title { font-size: 16px; font-weight: 700; color: #f1f5f9; }
.topbar-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8, #38bdf8);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff; cursor: pointer;
    flex-shrink: 0;
}
.topbar-btn {
    background: none; border: none; color: var(--muted);
    cursor: pointer; padding: 6px; border-radius: 6px;
    font-size: 18px; position: relative; transition: color .15s;
}
.topbar-btn:hover { color: var(--text); }
.notif-dot {
    position: absolute; top: 2px; right: 2px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger);
}

/* ── Page content ── */
.page-content { flex: 1; padding: 22px; }

/* ── Page header ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.page-title  { font-size: 20px; font-weight: 700; color: #f1f5f9; }
.page-sub    { font-size: 12px; color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden;
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
}
.card-header h6 { font-size: 13.5px; font-weight: 600; color: #f1f5f9; margin: 0; }
.card-body { padding: 18px; }

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px; padding: 16px 18px;
    display: flex; align-items: center; gap: 14px;
    transition: border-color .2s;
}
.stat-card:hover { border-color: var(--accent); }
.stat-icon { font-size: 28px; flex-shrink: 0; }
.stat-value { font-size: 26px; font-weight: 700; color: #f1f5f9; line-height: 1; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.stat-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th {
    padding: 10px 14px; background: rgba(255,255,255,.03);
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted);
    border-bottom: 1px solid var(--border); text-align: left;
    white-space: nowrap;
}
table.data-table td {
    padding: 10px 14px; color: var(--text); font-size: 13px;
    border-bottom: 1px solid rgba(30,58,95,.4);
    vertical-align: middle;
}
table.data-table tr:hover td { background: rgba(255,255,255,.02); }
table.data-table tr:last-child td { border-bottom: none; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: 8px; border: none;
    font-size: 13px; font-weight: 500; cursor: pointer;
    text-decoration: none; transition: all .15s; white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1e40af; color: #fff; }
.btn-secondary { background: rgba(255,255,255,.07); color: var(--text); }
.btn-secondary:hover { background: rgba(255,255,255,.12); }
.btn-success  { background: rgba(34,197,94,.15); color: var(--success); border: 1px solid rgba(34,197,94,.25); }
.btn-danger   { background: rgba(239,68,68,.15);  color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }
.btn-warning  { background: rgba(245,158,11,.15); color: var(--warning); border: 1px solid rgba(245,158,11,.25); }
.btn-teal     { background: rgba(8,145,178,.15);  color: var(--teal);    border: 1px solid rgba(8,145,178,.25); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px;  font-size: 11px; border-radius: 5px; }

/* ── Form controls ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.form-label .req { color: var(--danger); }
.form-control, .form-select, .form-textarea {
    width: 100%;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: 8px; padding: 9px 13px;
    color: var(--text); font-size: 13px; font-family: inherit;
    outline: none; transition: border-color .15s;
}
.form-control:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.form-control::placeholder, .form-textarea::placeholder { color: var(--muted); }
.form-select option { background: var(--surface); color: var(--text); }
.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.25);  color: #86efac; }
.alert-danger  { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: #fcd34d; }
.alert-info    { background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.25); color: #7dd3fc; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(34,197,94,.12);  color: var(--success); }
.badge-danger  { background: rgba(239,68,68,.12);  color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.12); color: var(--warning); }
.badge-info    { background: rgba(56,189,248,.12); color: var(--accent2); }
.badge-muted   { background: rgba(100,116,139,.15); color: var(--muted); }

/* ── Modal ── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.7); z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; width: 90%; max-width: 640px;
    max-height: 90vh; overflow-y: auto;
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h5 { font-size: 15px; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── PSA chart colors ── */
.psa-up   { color: var(--danger); }
.psa-down { color: var(--success); }
.psa-neutral { color: var(--muted); }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content:''; position:absolute; left:6px; top:0; bottom:0; width:2px; background:var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
    position: absolute; left: -21px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg);
}
.timeline-date { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.timeline-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }

/* ── Progress bars ── */
.progress { background: rgba(255,255,255,.08); border-radius: 4px; height: 6px; overflow: hidden; margin-top: 6px; }
.progress-bar { height: 100%; border-radius: 4px; transition: width .5s; }

/* ── Next appointment box ── */
.appt-box {
    background: linear-gradient(135deg, rgba(29,78,216,.15), rgba(56,189,248,.08));
    border: 1px solid rgba(56,189,248,.3);
    border-radius: 12px; padding: 18px 20px;
}
.appt-box .days-count { font-size: 40px; font-weight: 800; color: var(--accent2); line-height: 1; }
.appt-box .days-label { font-size: 12px; color: var(--muted); }
.appt-box .appt-date  { font-size: 15px; font-weight: 600; color: #f1f5f9; margin-top: 6px; }
.appt-box .appt-reason { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── PSA value indicator ── */
.psa-value { font-size: 22px; font-weight: 700; }
.psa-normal  { color: var(--success); }
.psa-watch   { color: var(--warning); }
.psa-high    { color: var(--orange); }
.psa-critical{ color: var(--danger); }

/* ── Requirements list ── */
.req-list { list-style: none; padding: 0; }
.req-list li {
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; gap: 8px; font-size: 13px;
}
.req-list li::before { content: '✓'; color: var(--accent2); font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.req-list li:last-child { border-bottom: none; }

/* ── Responsive ── */
.menu-toggle { display: none; }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.5); }
    .main-wrap { margin-left: 0; }
    .menu-toggle { display: flex; }
    .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .page-header { flex-direction: column; }
}

/* ── Login page ── */
.login-bg {
    min-height: 100vh; background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background-image: radial-gradient(ellipse at 20% 50%, rgba(29,78,216,.08) 0%, transparent 60%),
                      radial-gradient(ellipse at 80% 20%, rgba(8,145,178,.06) 0%, transparent 50%);
}
.login-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 36px; width: 100%; max-width: 420px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 70px; width: auto; }
.login-logo .org-name { font-size: 15px; font-weight: 700; color: #1a3a6b; margin-top: 10px; }
.login-logo .system-name { font-size: 12px; color: var(--muted); }
.login-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-sub { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 24px; }
.code-input {
    display: flex; gap: 10px; justify-content: center; margin: 20px 0;
}
.code-digit {
    width: 52px; height: 60px; text-align: center;
    background: rgba(255,255,255,.06); border: 2px solid var(--border);
    border-radius: 10px; color: var(--text); font-size: 24px;
    font-weight: 700; outline: none; transition: border-color .15s;
}
.code-digit:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,78,216,.2); }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Utility ── */
.text-accent  { color: var(--accent2); }
.text-muted   { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.mono { font-family: 'Courier New', monospace; font-size: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }
.mb-0 { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
