/* ============================================================
   Investor Portal — app.css
   Dark theme matching admin dashboard design tokens
   ============================================================ */

/* ── Design tokens ── */
:root {
  --bg0:    #111318;
  --bg1:    #191b23;
  --panel:  rgba(255, 255, 255, 0.03);
  --stroke: rgba(255, 255, 255, 0.08);
  --text:   rgba(255, 255, 255, 0.88);
  --muted:  rgba(255, 255, 255, 0.55);
  --faint:  rgba(255, 255, 255, 0.35);
  --accent: #d4940a;
  --good:   #22c55e;
  --bad:    #ef4444;
  --mono:   "IBM Plex Mono", ui-monospace, monospace;
  --sans:   "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --r:      8px;
}

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

html { font-size: 16px; }

body {
  font-family: var(--sans);
  background: var(--bg0);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ============================================================
   1. Login page
   ============================================================ */

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--bg1);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.login-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.fc-mark {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  color: #000;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.header-text .fund-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.header-text .portal-tag {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

.error-box {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.30);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 13px;
  color: #f87171;
  margin-bottom: 16px;
}

/* ============================================================
   2. Forms (shared login + portal)
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

.form-group label,
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg0);
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s;
  resize: vertical;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

/* ============================================================
   3. Buttons
   ============================================================ */

.btn-primary,
.btn-accent,
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.18s, background 0.18s;
  border: none;
  line-height: 1;
}

/* Gold accent — used on login and CTA buttons */
.btn-primary,
.btn-accent {
  background: var(--accent);
  color: #000;
  border: none;
}

.btn-primary:hover,
.btn-accent:hover {
  opacity: 0.88;
}

/* Full-width variant for login */
.btn-primary.full-width,
.btn-login {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
}

/* Outline variant */
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--stroke);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: var(--bad);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.18s;
}

.btn-danger:hover { opacity: 0.85; }

/* ============================================================
   4. App shell — sidebar + main grid
   ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ============================================================
   5. Sidebar
   ============================================================ */

.sidebar {
  background: var(--bg1);
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--stroke);
}

/* fc-mark already defined above (shared with login) */

.sidebar-fund-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--r);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.nav-btn:hover {
  background: var(--panel);
  color: var(--text);
}

.nav-btn:hover svg { opacity: 1; }

.nav-btn.active {
  background: rgba(212, 148, 10, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.nav-btn.active svg { opacity: 1; }

/* Sidebar footer: investor info + sign-out */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 16px;
  border-top: 1px solid var(--stroke);
}

.investor-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.investor-avatar {
  width: 30px;
  height: 30px;
  background: rgba(212, 148, 10, 0.20);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.investor-name {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sign-out-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--faint);
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.sign-out-btn:hover {
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
}

/* ============================================================
   6. Main content area
   ============================================================ */

.main-content {
  padding: 32px;
  overflow-y: auto;
  min-width: 0;
}

.view-header {
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.view-header p {
  font-size: 14px;
  color: var(--muted);
}

.loading-placeholder {
  color: var(--muted);
  font-size: 14px;
  padding: 48px 0;
  text-align: center;
}

/* ============================================================
   7. Cards
   ============================================================ */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: var(--bg1);
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  padding: 20px;
}

.card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.card-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--mono);
  letter-spacing: -0.01em;
}

.card-value.positive { color: var(--good); }
.card-value.negative { color: var(--bad); }
.card-value.accent   { color: var(--accent); }

/* ============================================================
   8. Chart container
   ============================================================ */

.chart-panel {
  background: var(--bg1);
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 28px;
}

.chart-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

/* ============================================================
   9. Data tables
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--stroke);
  border-radius: var(--r);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--bg1);
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--stroke);
  transition: background 0.12s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--panel); }

tbody td {
  padding: 11px 14px;
  color: var(--text);
  vertical-align: middle;
}

.td-mono {
  font-family: var(--mono);
  font-size: 12px;
}

.td-muted {
  color: var(--muted);
}

/* ============================================================
   10. Status badges
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-pending {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.badge-approved {
  background: rgba(34, 197, 94, 0.12);
  color: var(--good);
}

.badge-rejected {
  background: rgba(239, 68, 68, 0.12);
  color: var(--bad);
}

.badge-completed {
  background: rgba(34, 197, 94, 0.12);
  color: var(--good);
}

/* ============================================================
   11. Section toolbars (above tables)
   ============================================================ */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   12. Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-box {
  background: var(--bg1);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--panel);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ============================================================
   13. Toast notifications
   ============================================================ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: var(--good);
}

.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--bad);
}

.toast-info {
  background: rgba(212, 148, 10, 0.15);
  border: 1px solid rgba(212, 148, 10, 0.35);
  color: var(--accent);
}

/* ============================================================
   14. Account / profile section
   ============================================================ */

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-field-value {
  font-size: 15px;
  color: var(--text);
}

.section-divider {
  border: none;
  border-top: 1px solid var(--stroke);
  margin: 28px 0;
}

.subsection-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ============================================================
   15. Empty states
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 24px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.empty-state-icon {
  font-size: 32px;
  opacity: 0.4;
}

/* ============================================================
   16. Responsive — mobile
   ============================================================ */

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--stroke);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
    gap: 4px;
  }

  .nav-btn {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 13px;
  }

  .sidebar-footer {
    padding: 8px 12px 12px;
  }

  .main-content {
    padding: 16px;
  }

  .cards-grid {
    grid-template-columns: 1fr 1fr;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 32px 24px;
    border-radius: 12px;
  }

  .modal-box {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
