/* ============================================================
   Family Office Secure File Portal — Professional Stylesheet
   Reference: Linear / Vercel / Stripe Dashboard
   ============================================================ */

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

:root {
    --bg:        #fafafa;
    --surface:   #ffffff;
    --border:    rgba(0,0,0,0.08);
    --text:      #0d0d0d;
    --text-muted:#5c5c5c;
    --accent:    #0066ff;
    --accent-hover: #0052cc;
    --danger:    #0d0d0d;
    --radius:    8px;
    --radius-sm: 6px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.7; min-height: 100vh; }

/* ── Navigation ── */
.top-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 2rem; }
.top-bar-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-size: 20px; font-weight: 600; color: var(--text); text-decoration: none; letter-spacing: -0.025em; }
nav { display: flex; align-items: center; gap: 1rem; }
.nav-user { color: var(--text-muted); font-size: 13px; }
.nav-link { color: var(--accent); text-decoration: none; font-size: 13px; padding: 0.3rem 0.6rem; border-radius: var(--radius-sm); }
.nav-link:hover { background: rgba(0,102,255,0.06); }
.nav-logout { color: var(--text-muted); }

/* ── Layout ── */
.main-content { max-width: 1100px; margin: 0 auto; padding: 4rem 2rem; }
.page-header { margin-bottom: 2.5rem; }
.page-header h1 { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; margin-bottom: 0.3rem; }
.page-subtitle { color: var(--text-muted); font-size: 16px; }

/* ── Back / Utility links ── */
.back-link { color: var(--accent); text-decoration: none; font-size: 13px; }
.back-link:hover { text-decoration: underline; }

/* ── Flash messages ── */
.flash-container { margin-bottom: 2rem; }
.flash { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem; font-size: 13px; background: rgba(0,0,0,0.04); color: var(--text); }

/* ── Cards ── */
.card { background: var(--surface); border-radius: var(--radius); margin-bottom: 2.5rem; overflow: hidden; }
.card-header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 16px; font-weight: 600; color: var(--text); }
.card-body { padding: 2rem; }
.card-body.no-padding { padding: 0; }
.empty-state { padding: 3rem 2rem; text-align: center; color: var(--text-muted); font-size: 16px; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 0.4rem; color: var(--text); }
.form-group input[type="text"],
.form-group input[type="password"] { width: 100%; padding: 0.6rem 0; border: none; border-bottom: 1px solid var(--border); font-size: 16px; font-family: var(--font); color: var(--text); background: transparent; border-radius: 0; transition: border-color 0.15s ease; }
.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus { outline: none; border-color: var(--accent); }
.form-group input[type="file"] { width: 100%; padding: 0.6rem 0; border: none; border-bottom: 1px solid var(--border); font-size: 16px; font-family: var(--font); color: var(--text); background: transparent; border-radius: 0; }
.form-group input[type="file"]:focus { outline: none; border-color: var(--accent); }
.form-help { font-size: 13px; color: var(--text-muted); margin-top: 0.3rem; }
.inline-form { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.inline-group { flex: 1; min-width: 200px; margin-bottom: 0; }

/* ── Buttons ── */
.btn { display: inline-block; padding: 0.6rem 1.25rem; font-size: 16px; font-weight: 500; font-family: var(--font); border: none; border-radius: 6px; cursor: pointer; text-decoration: none; line-height: 1.4; transition: background 0.15s ease; }
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text); }
.btn-secondary:hover { background: rgba(0,0,0,0.04); }
.btn-danger { background: transparent; color: var(--text); }
.btn-danger:hover { background: rgba(0,0,0,0.04); }

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; margin-bottom: 2.5rem; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.stat-number { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 0.3rem; }

/* ── Password strength ── */
.strength-meter { display: flex; align-items: center; gap: 0.5rem; }
.strength-bar { height: 6px; border-radius: 3px; background: var(--border); width: 0; flex: 1; }
.strength-bar.s0 { background: #0d0d0d; }
.strength-bar.s1 { background: #5c5c5c; }
.strength-bar.s2 { background: #b0b0b0; }
.strength-bar.s3 { background: #0066ff; }
.strength-bar.s4 { background: #0052cc; }
.strength-label { font-size: 13px; color: var(--text-muted); min-width: 2em; }

/* ── Login page ── */
.login-page { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 200px); }
.login-card { background: var(--surface); border-radius: var(--radius); padding: 3rem 2.5rem; width: 100%; max-width: 400px; }
.login-title { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 0.25rem; letter-spacing: -0.02em; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 16px; margin-bottom: 2.5rem; }
.login-form .form-group { margin-bottom: 1.5rem; }

/* ── Data tables (list-style) ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 1rem 2rem; font-size: 15px; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); }
.data-table td { padding: 1rem 2rem; font-size: 16px; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover td { background: rgba(0,0,0,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }
.filename-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 500; }
.size-cell, .date-cell { white-space: nowrap; color: var(--text-muted); font-size: 14px; }
.actions-cell { white-space: nowrap; display: flex; gap: 0.4rem; }

/* ── Badges ── */
.badge { display: inline-block; padding: 0.2rem 0.6rem; font-size: 13px; font-weight: 500; border-radius: 999px; background: rgba(0,0,0,0.05); color: var(--text); }
.badge-new { font-size: 13px; padding: 0.1rem 0.4rem; margin-left: 0.4rem; vertical-align: middle; }

/* ── Error page ── */
.error-page { display: flex; justify-content: center; align-items: center; min-height: 60vh; }
.error-card { text-align: center; }
.error-code { font-size: 4rem; font-weight: 700; color: var(--border); line-height: 1; margin-bottom: 0.5rem; }
.error-message { font-size: 16px; color: var(--text-muted); margin-bottom: 1.5rem; }

/* ── Upload form ── */
.upload-form { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.upload-form .form-group { flex: 1; min-width: 250px; margin-bottom: 0; }

/* ── Drop zone ── */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2.5rem 2rem; text-align: center; cursor: pointer; margin-bottom: 1rem; }
.drop-zone.drag-over { border-color: var(--accent); background: rgba(0,102,255,0.04); }
.drop-zone-icon { font-size: 2rem; margin-bottom: 0.5rem; color: var(--text-muted); }
.drop-zone-text { color: var(--text-muted); font-size: 16px; }
.drop-zone-text strong { color: var(--accent); }
.drop-file-list { margin-top: 0.75rem; font-size: 13px; color: var(--text); }
.drop-file-list .drop-file-item { display: inline-block; background: rgba(0,0,0,0.05); padding: 0.2rem 0.6rem; border-radius: var(--radius-sm); margin: 0.2rem; }

/* ── Responsive ── */
@media (max-width: 640px) {
    .top-bar { padding: 0 1rem; }
    .top-bar-inner { flex-direction: column; height: auto; padding: 0.75rem 0; gap: 0.5rem; }
    .main-content { padding: 2rem 1rem; }
    .card-header, .card-body { padding-left: 1.25rem; padding-right: 1.25rem; }
    .card-header { padding-top: 1.25rem; padding-bottom: 1.25rem; }
    .card-body { padding-top: 1.25rem; padding-bottom: 1.25rem; }
    .data-table th, .data-table td { padding: 0.75rem 1rem; font-size: 13px; }
    .data-table th { font-size: 14px; }
    .actions-cell { flex-direction: column; gap: 0.25rem; }
    .upload-form { flex-direction: column; }
    .upload-form .form-group { min-width: unset; width: 100%; }
    .login-card { padding: 2rem 1.5rem; }
    .upload-form .btn-primary { width: 100%; min-height: 44px; }
    .upload-form select { min-height: 44px; font-size: 16px !important; }
    .upload-form input[type="text"], .upload-form input[type="password"] { font-size: 16px !important; }
    .card-body.no-padding { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .hide-mobile { display: none; }
    .data-table { min-width: unset; width: 100%; }
    .drop-zone { padding: 2rem 1.25rem; min-height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
    .filename-cell { max-width: 150px; }
    .page-header h1 { font-size: 24px; }
    .page-header { margin-bottom: 2rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .stat-card { padding: 1rem 0.75rem; }
    .stat-number { font-size: 24px; }
    .stat-label { font-size: 13px; }
    nav { gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
    .nav-link, .nav-user { font-size: 13px; }
}
