/* ================================================================
   Fund Management System — Main Stylesheet
   Shopify-style: data-rich, clean, mobile-optimised
   ================================================================ */

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg:          #f6f7f8;
  --color-surface:     #ffffff;
  --color-border:      #e3e5e8;
  --color-border-focus:#2563eb;
  --color-text:        #111827;
  --color-text-muted:  #6b7280;
  --color-primary:     #2563eb;
  --color-primary-hover:#1d4ed8;
  --color-success:     #16a34a;
  --color-warning:     #d97706;
  --color-danger:      #dc2626;
  --color-info:        #0891b2;
  --radius:            6px;
  --radius-lg:         10px;
  --shadow-sm:         0 1px 3px rgba(0,0,0,.08);
  --shadow-md:         0 4px 12px rgba(0,0,0,.10);
  --transition:        150ms ease;
  --font-sans:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-ar:           'Noto Sans Arabic', var(--font-sans);
  --font-ur:           'Noto Nastaliq Urdu', var(--font-sans);
  --sidebar-w:         240px;
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

html[lang="ar"] body, html[lang="ur"] body {
  font-family: var(--font-ar);
}

html[lang="ur"] body {
  font-family: var(--font-ur);
}

/* ── Typography ──────────────────────────────────────────────── */
h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: .95rem; font-weight: 600; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }

.text-muted { color: var(--color-text-muted); }
.text-sm    { font-size: .85rem; }
.text-xs    { font-size: .75rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ── Layout Helpers ──────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 640px; }
.container-md { max-width: 900px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px;
}
.card-title { font-size: 1rem; font-weight: 600; }

/* ── Stat Cards (Dashboard) ──────────────────────────────────── */
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .78rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-value { font-size: 1.65rem; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat-change { font-size: .8rem; margin-top: 6px; }
.stat-up   { color: var(--color-success); }
.stat-down { color: var(--color-danger); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: var(--radius); font-size: .9rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover   { background: var(--color-primary-hover); border-color: var(--color-primary-hover); text-decoration: none; }
.btn-outline   { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-outline:hover   { background: var(--color-bg); text-decoration: none; }
.btn-danger    { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-success   { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-sm  { padding: .35rem .75rem; font-size: .82rem; }
.btn-lg  { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .87rem; font-weight: 500; margin-bottom: .35rem; color: var(--color-text); }
.form-label .req { color: var(--color-danger); margin-left: .15rem; }

.form-control {
  width: 100%; padding: .6rem .85rem;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  font-size: .9rem; font-family: inherit; color: var(--color-text);
  background: var(--color-surface); transition: border-color var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--color-border-focus); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control::placeholder { color: var(--color-text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .85rem center; padding-right: 2.5rem; }

.form-hint  { font-size: .78rem; color: var(--color-text-muted); margin-top: .3rem; }
.form-error { font-size: .78rem; color: var(--color-danger); margin-top: .3rem; }

.checkbox-group { display: flex; align-items: flex-start; gap: .6rem; }
.checkbox-group input[type=checkbox] { flex-shrink: 0; margin-top: .2rem; width: 16px; height: 16px; accent-color: var(--color-primary); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; background: var(--color-surface); }
th { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); padding: 10px 16px; border-bottom: 1px solid var(--color-border); white-space: nowrap; text-align: left; }
td { padding: 12px 16px; border-bottom: 1px solid var(--color-border); font-size: .88rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-bg); }

/* ── Badges / Status ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem; border-radius: 20px; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-info     { background: #e0f2fe; color: #075985; }
.badge-neutral  { background: #f3f4f6; color: #374151; }
.badge-pending  { background: #fef9c3; color: #854d0e; }

/* Status helpers */
.status-active    { background: #dcfce7; color: #15803d; }
.status-pending   { background: #fef9c3; color: #854d0e; }
.status-suspended { background: #fee2e2; color: #b91c1c; }
.status-rejected  { background: #f1f5f9; color: #475569; }

/* ── Alerts / Flash ──────────────────────────────────────────── */
.flash {
  padding: .85rem 1.1rem; border-radius: var(--radius); font-size: .9rem;
  margin-bottom: 1.25rem; display: flex; align-items: center; gap: .5rem;
}
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* ── Public Nav ──────────────────────────────────────────────── */
.public-nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100;
}
.public-nav .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 1rem;
}
.public-nav .brand {
  font-size: 1.1rem; font-weight: 700; color: var(--color-text); text-decoration: none;
}
.public-nav-links { display: flex; align-items: center; gap: .75rem; }
.lang-switcher { display: flex; gap: .25rem; }
.lang-switcher a, .lang-btn {
  font-size: .75rem; font-weight: 600; padding: .2rem .45rem; border-radius: 4px;
  color: var(--color-text-muted); text-decoration: none;
  background: transparent; border: none; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.lang-switcher a.active, .lang-btn.active {
  background: var(--color-primary); color: #fff;
}

/* ── Public Footer ───────────────────────────────────────────── */
.public-footer { background: #111; color: #aaa; padding: 48px 0 24px; margin-top: 80px; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.public-footer strong { color: #fff; display: block; margin-bottom: 10px; font-size: .9rem; }
.public-footer ul { list-style: none; }
.public-footer ul li { margin-bottom: 6px; }
.public-footer a { color: #9ca3af; font-size: .85rem; }
.public-footer a:hover { color: #fff; text-decoration: none; }
.footer-bottom { border-top: 1px solid #333; padding-top: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }

/* ── Cookie Banner ───────────────────────────────────────────── */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: #1f2937; color: #f9fafb; padding: 16px 24px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.2);
}
.cookie-banner-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cookie-banner-inner p { margin: 0; font-size: .9rem; }
.cookie-banner-inner a { color: #93c5fd; }
.cookie-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* ── Admin layout ────────────────────────────────────────────── */
.layout-admin { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #111; color: #d1d5db;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 50;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #222;
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-brand a { color: #fff; font-weight: 700; font-size: 1rem; text-decoration: none; }
.sidebar-role-badge { font-size: .65rem; background: #374151; padding: .15rem .5rem; border-radius: 10px; color: #9ca3af; font-weight: 600; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-link {
  display: flex; align-items: center; gap: .65rem;
  padding: 9px 20px; font-size: .87rem; color: #9ca3af;
  text-decoration: none; transition: all var(--transition);
  position: relative;
}
.sidebar-link:hover { background: #1f2937; color: #f3f4f6; text-decoration: none; }
.sidebar-link.active { background: #1d4ed8; color: #fff; }
.sidebar-icon { width: 18px; text-align: center; font-size: .95rem; }
.sidebar-badge {
  margin-left: auto; background: var(--color-danger); color: #fff;
  font-size: .68rem; font-weight: 700; padding: .1rem .45rem;
  border-radius: 20px; min-width: 20px; text-align: center;
}
.sidebar-footer { padding: 16px 20px; border-top: 1px solid #222; }
.sidebar-logout-btn {
  width: 100%; padding: .45rem; background: #1f2937; border: 1px solid #374151;
  color: #9ca3af; border-radius: var(--radius); font-size: .85rem; cursor: pointer;
  transition: all var(--transition); font-family: inherit;
}
.sidebar-logout-btn:hover { background: #374151; color: #f3f4f6; }

.admin-main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 40;
}
.sidebar-toggle { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--color-text-muted); display: none; }
.topbar-title { font-weight: 600; font-size: .95rem; }
.topbar-right { margin-left: auto; }
.topbar-alert { font-size: .8rem; color: var(--color-warning); font-weight: 500; }
.admin-content { padding: 24px; flex: 1; }

/* ── Investor layout ─────────────────────────────────────────── */
.investor-topbar {
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100;
}
.investor-topbar .container { height: 58px; display: flex; align-items: center; gap: 1rem; }
.investor-topbar .brand { font-weight: 700; font-size: 1rem; color: var(--color-text); text-decoration: none; }
.investor-topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.mobile-nav-toggle { display: none; background: none; border: none; font-size: 1.2rem; cursor: pointer; }

.investor-layout { display: flex; min-height: calc(100vh - 58px); }
.investor-sidebar {
  width: 220px; flex-shrink: 0; background: var(--color-surface);
  border-right: 1px solid var(--color-border); padding: 20px 0;
  position: sticky; top: 58px; height: calc(100vh - 58px);
  overflow-y: auto;
}
.investor-sidebar-profile {
  display: flex; align-items: center; gap: .75rem;
  padding: 0 16px 16px; margin-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.investor-name { font-weight: 600; font-size: .87rem; }
.investor-status-badge { font-size: .7rem; font-weight: 600; padding: .1rem .45rem; border-radius: 10px; display: inline-block; margin-top: 2px; }

.investor-nav { padding: 8px 0; }
.investor-nav-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 20px; font-size: .88rem; color: var(--color-text-muted);
  text-decoration: none; transition: all var(--transition);
}
.investor-nav-link:hover { background: var(--color-bg); color: var(--color-text); text-decoration: none; }
.investor-nav-link.active { color: var(--color-primary); font-weight: 600; background: #eff6ff; border-left: 3px solid var(--color-primary); }

.investor-main { flex: 1; padding: 28px 32px; min-width: 0; }
.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.4rem; font-weight: 700; }

/* ── Notification bell ───────────────────────────────────────── */
.notif-bell { position: relative; font-size: 1.2rem; text-decoration: none; }
.notif-dot {
  position: absolute; top: -6px; right: -8px;
  background: var(--color-danger); color: #fff;
  border-radius: 50%; font-size: .6rem; font-weight: 700;
  min-width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ── Page header row ─────────────────────────────────────────── */
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: .75rem;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--color-text-muted); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--color-text); margin-bottom: 6px; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .25rem; margin-top: 16px; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius);
  font-size: .85rem; text-decoration: none;
  border: 1px solid var(--color-border); color: var(--color-text);
  transition: all var(--transition);
}
.pagination a:hover { background: var(--color-bg); text-decoration: none; }
.pagination .active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ── Login / Register forms ──────────────────────────────────── */
.auth-wrap { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 40px; box-shadow: var(--shadow-md); }
.auth-logo { text-align: center; font-size: 1.4rem; font-weight: 700; margin-bottom: 28px; }
.auth-divider { text-align: center; color: var(--color-text-muted); font-size: .82rem; margin: 16px 0; position: relative; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--color-border); }
.auth-divider span { background: var(--color-surface); padding: 0 10px; position: relative; }

/* ── Google OAuth button ─────────────────────────────────────── */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: .65rem; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  font-size: .9rem; font-weight: 500; color: var(--color-text);
  cursor: pointer; transition: all var(--transition); text-decoration: none;
  font-family: inherit;
}
.btn-google:hover { background: var(--color-bg); text-decoration: none; }
.btn-google svg { width: 18px; height: 18px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .investor-sidebar { display: none; }
  .investor-sidebar.open { display: block; position: fixed; top: 58px; left: 0; bottom: 0; z-index: 200; box-shadow: var(--shadow-md); }
  .mobile-nav-toggle { display: block; }
  .investor-main { padding: 20px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .public-nav-links .btn { display: none; }
}

@media (max-width: 480px) {
  .footer-cols { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .stat-value { font-size: 1.35rem; }
}

/* ── Registration flow ───────────────────────────────────────── */
.reg-progress { }

/* Risk disclosure checkboxes */
.risk-check-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius); transition: border-color var(--transition);
}
.risk-check-item:has(input:checked) {
  border-color: var(--color-success);
  background: #f0fdf4;
}

/* Sophistication options */
.soph-option:has(input:checked) {
  border-color: var(--color-primary) !important;
  background: #eff6ff !important;
}

/* Legal content within cards */
.legal-content { line-height: 1.7; }
.legal-content h2 { font-size: 1.3rem; margin: 0 0 16px; }
.legal-content h3 { font-size: 1.05rem; margin: 24px 0 8px; }
.legal-content h4 { font-size: .95rem; margin: 18px 0 6px; font-weight: 600; }
.legal-content p  { margin-bottom: .85rem; }
.legal-content ul, .legal-content ol { padding-left: 1.4rem; margin-bottom: .85rem; }
.legal-content li { margin-bottom: .4rem; }
.legal-content strong { font-weight: 600; }
[dir="rtl"] .legal-content ul,
[dir="rtl"] .legal-content ol { padding-left: 0; padding-right: 1.4rem; }

/* Homepage hero responsive */
@media (max-width: 640px) {
  .grid-4.how-it-works { grid-template-columns: 1fr 1fr; }
}
