/* ============================================================
   AY Capital — Shared Styles
   Dark theme matching original dashboard
   ============================================================ */

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

:root {
  --bg:          #0a0e1a;
  --surface:     #111827;
  --surface2:    #1a2035;
  --border:      #1f2937;
  --text:        #f1f5f9;
  --muted:       #8892a4;
  --green:       #22c55e;
  --red:         #ef4444;
  --orange:      #f59e0b;
  --blue:        #3b82f6;
  --teal:        #14b8a6;
  --purple:      #8b5cf6;
  --radius:      12px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
}

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

/* ── Typography ─────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 0.85rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Layout ─────────────────────────────────────────────── */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.brand { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.brand span { color: var(--blue); }
.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

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

.metric-card { position: relative; overflow: hidden; }
.metric-card .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.metric-card .value { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.metric-card .sub   { font-size: 0.72rem; color: var(--muted); margin-top: 6px; }

.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral  { color: var(--text); }
.orange   { color: var(--orange); }
.blue     { color: var(--blue); }

/* ── Charts grid ────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.charts-row.single { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.chart-card h2 { margin-bottom: 4px; }
.chart-card .chart-sub { font-size: 0.75rem; color: var(--muted); margin-bottom: 16px; }
.chart-wrapper { position: relative; height: 200px; }

/* ── Table ──────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.table-header h2 { font-size: 1rem; }
.row-count {
  background: var(--blue);
  color: white;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody td {
  padding: 13px 16px;
  font-size: 0.85rem;
  white-space: nowrap;
}
tbody td:first-child { color: var(--muted); font-weight: 500; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
}
.btn:hover { opacity: .85; }
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--blue);   color: white; }
.btn-success  { background: var(--green);  color: white; }
.btn-danger   { background: var(--red);    color: white; }
.btn-ghost    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-google   { background: #fff; color: #333; border: 1px solid #ccc; }
.btn-google:hover { background: #f8f8f8; border-color: #aaa; }

/* ── Form ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color .2s;
}
input:focus, select:focus { border-color: var(--blue); }
input::placeholder { color: var(--muted); }

/* ── Alert ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.alert-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }

/* ── Login page ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.login-card .brand { display: block; text-align: center; margin-bottom: 6px; font-size: 1.6rem; }
.login-card .tagline { text-align: center; color: var(--muted); font-size: 0.8rem; margin-bottom: 32px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 0.95rem; }

/* ── Admin selector ─────────────────────────────────────── */
.investor-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.investor-bar label { margin: 0; white-space: nowrap; }
.investor-bar select { width: auto; min-width: 200px; flex: 1; }

/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
}

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