/* ============================================================
   Trust Line Investments — "Meridian" Professional Theme
   ------------------------------------------------------------
   A refined, institutional financial identity layered on top of
   styles.css. Loaded last, so it wins the cascade without
   requiring the base stylesheet to be rewritten.

   Direction: obsidian navy foundations, a disciplined emerald
   for growth/action, and a champagne-gold hairline as the single
   "fanciful" signature. Display type in Fraunces (a characterful
   modern serif) paired with Inter for data and body.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap');

/* ---------- 1. TOKENS (dark = default) ---------- */
:root {
  /* Brand */
  --primary: #12B886;          /* emerald — growth, action */
  --primary-dark: #0CA678;
  --primary-light: #63E6BE;
  --accent: #D4B25A;           /* champagne gold — the signature */
  --accent-dark: #B8963F;
  --accent-light: #E8CE8C;

  /* Semantic */
  --success: #12B886;
  --danger: #F0616D;
  --warning: #E0A94B;
  --info: #5B9DF0;

  /* Foundations — obsidian navy */
  --bg-primary: #080B14;
  --bg-secondary: #0E1320;
  --bg-tertiary: #141B2D;

  /* Text */
  --text-primary: #F4F6FB;
  --text-secondary: #9BA8C0;
  --text-muted: #5C687F;

  /* Glass / surfaces */
  --glass-bg: rgba(255, 255, 255, 0.035);
  --glass-border: rgba(212, 178, 90, 0.14);   /* faint gold hairline */
  --glass-shadow: rgba(0, 0, 0, 0.45);
  --card-bg: #101728;
  --sidebar-bg: #0A0E18;
  --header-bg: rgba(8, 11, 20, 0.88);
  --input-bg: #131A2B;
  --input-border: #26304A;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #12B886 0%, #0CA678 60%, #0B8F6A 100%);
  --gradient-gold: linear-gradient(135deg, #E8CE8C 0%, #D4B25A 55%, #B8963F 100%);
  --gradient-hero: radial-gradient(1200px 600px at 20% -10%, rgba(18,184,134,0.10), transparent 60%),
                   radial-gradient(900px 500px at 90% 10%, rgba(212,178,90,0.08), transparent 55%),
                   linear-gradient(160deg, #080B14 0%, #0C111C 55%, #0E1320 100%);

  /* Shadows — softer, deeper */
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.35);
  --shadow-md: 0 8px 26px rgba(0,0,0,0.42);
  --shadow-lg: 0 18px 48px rgba(0,0,0,0.50);
  --shadow-xl: 0 28px 70px rgba(0,0,0,0.58);

  --border-radius: 14px;
  --border-radius-lg: 18px;
  --border-radius-sm: 10px;

  --font-display: 'Fraunces', 'Times New Roman', serif;
}

/* ---------- Light theme refinement ---------- */
[data-theme="light"] {
  --primary: #0CA678;
  --primary-dark: #099268;
  --accent: #B8963F;
  --accent-dark: #9C7E32;
  --bg-primary: #F6F8FB;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #EEF2F8;
  --text-primary: #10192B;
  --text-secondary: #4A5878;
  --text-muted: #8A97AE;
  --glass-bg: rgba(255,255,255,0.75);
  --glass-border: rgba(184,150,63,0.22);
  --card-bg: #FFFFFF;
  --sidebar-bg: #FFFFFF;
  --header-bg: rgba(246,248,251,0.9);
  --input-bg: #F1F4F9;
  --input-border: #DCE3ED;
  --shadow-sm: 0 2px 10px rgba(16,25,43,0.06);
  --shadow-md: 0 8px 26px rgba(16,25,43,0.09);
  --shadow-lg: 0 18px 48px rgba(16,25,43,0.12);
  --gradient-hero: radial-gradient(1000px 500px at 15% -10%, rgba(12,166,120,0.08), transparent 60%),
                   linear-gradient(160deg, #F6F8FB 0%, #FFFFFF 60%);
}

/* ---------- 2. GLOBAL ATMOSPHERE ---------- */
body {
  background: var(--gradient-hero) fixed, var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

/* Display face for headings + brand */
h1, h2, h3,
.section-title,
.brand-name, .logo-text, .sidebar-brand,
.card-header h3, .stat-value {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
.section-title { font-weight: 600; }

/* A gold hairline under section titles — the recurring signature */
.section-header { position: relative; }
.section-header .section-title::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 12px;
  border-radius: 3px;
  background: var(--gradient-gold);
  box-shadow: 0 0 18px rgba(212,178,90,0.35);
}

/* ---------- 3. SIDEBAR ---------- */
.sidebar {
  background:
    linear-gradient(180deg, rgba(18,184,134,0.05), transparent 220px),
    var(--sidebar-bg);
  border-right: 1px solid var(--glass-border);
}
.sidebar-nav .nav-item {
  border-radius: 12px;
  margin: 2px 10px;
  transition: all .22s ease;
}
.sidebar-nav .nav-item:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}
.sidebar-nav .nav-item.active {
  background: linear-gradient(90deg, rgba(18,184,134,0.16), rgba(18,184,134,0.02));
  color: var(--text-primary);
  box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar-nav .nav-item.active i { color: var(--primary); }

/* ---------- 4. TOP HEADER ---------- */
.top-header {
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--glass-border);
}

/* ---------- 5. CARDS & PANELS ---------- */
.card,
.glass-card,
.chart-card,
.plan-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
/* faint top gold hairline on primary panels */
.card::before,
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,178,90,0.5), transparent);
  opacity: .7;
}

/* ---------- 6. STAT CARDS ---------- */
.stat-card {
  background:
    radial-gradient(140% 120% at 100% 0%, rgba(18,184,134,0.06), transparent 55%),
    var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover {
  border-color: rgba(212,178,90,0.45);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}
/* stat icon chips get depth */
.stat-card-icon {
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), var(--shadow-sm);
}

/* ---------- 7. BUTTONS ---------- */
.btn-primary {
  background: var(--gradient-primary);
  border: none;
  box-shadow: 0 6px 20px rgba(18,184,134,0.28);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 28px rgba(18,184,134,0.4);
  transform: translateY(-1px);
}
.btn-gold,
.btn-accent {
  background: var(--gradient-gold);
  color: #2A2210;
  border: none;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(212,178,90,0.3);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 8. BADGES / MEMBERSHIP ---------- */
.membership-badge,
.badge-bronze, .badge-silver, .badge-gold, .badge-platinum {
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(6px);
}
.badge-gold { background: var(--gradient-gold); color: #2A2210; border: none; }
.nav-badge {
  background: var(--gradient-gold);
  color: #2A2210;
  font-weight: 700;
}

/* ---------- 9. INPUTS ---------- */
input, select, textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18,184,134,0.15);
  outline: none;
}

/* ---------- 10. TABLES ---------- */
table thead th {
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
table tbody tr:hover { background: var(--glass-bg); }

/* ---------- 11. NOTIFICATION CENTER (styling for the fixed section) ---------- */
.notif-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.notif-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.notif-filter {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
}
.notif-filter:hover { color: var(--text-primary); border-color: rgba(212,178,90,0.4); }
.notif-filter.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(18,184,134,0.3);
}
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  transition: all .2s ease;
  cursor: pointer;
  position: relative;
}
.notification-item:hover { border-color: rgba(212,178,90,0.4); box-shadow: var(--shadow-sm); }
.notification-item.unread {
  background:
    linear-gradient(90deg, rgba(18,184,134,0.07), transparent 60%),
    var(--card-bg);
  box-shadow: inset 3px 0 0 var(--primary);
}
.notification-item.unread::after {
  content: "";
  position: absolute;
  top: 18px; right: 44px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(18,184,134,0.7);
}
.notification-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
}
.notification-item[data-id] .notification-content { flex: 1; min-width: 0; }
.notification-title { margin: 0 0 3px; font-size: 0.95rem; color: var(--text-primary); font-weight: 600; }
.notification-message { margin: 0 0 6px; font-size: 0.88rem; color: var(--text-secondary); line-height: 1.45; }
.notification-time { font-size: 0.75rem; color: var(--text-muted); }
.notification-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 8px;
  transition: all .2s ease;
  flex-shrink: 0;
}
.notification-delete:hover { background: rgba(240,97,109,0.12); color: var(--danger); }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.6rem; color: var(--accent); opacity: .6; margin-bottom: 14px; }
.empty-state p { font-size: 0.95rem; margin: 0; }

/* count pill in the section header */
.notif-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gradient-gold);
  color: #2A2210;
  font-size: 0.8rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 10px;
}
.notif-count-pill[data-count="0"] { display: none; }

/* ---------- 12. SCROLLBAR ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--primary-dark), var(--accent-dark));
  border-radius: 10px;
  border: 2px solid var(--bg-primary);
}

/* ---------- 13. ACCESSIBILITY ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================
   14. SEMANTIC RED / GREEN FINANCIAL COLOUR
   ------------------------------------------------------------
   Money in = green, money out = red, status = gold.
   Applied via .tone-green / .tone-red / .tone-gold on the card,
   so the meaning lives in the markup rather than in a colour.
   ============================================================ */

:root {
  --gain: #16C784;          /* the green used by trading UIs */
  --gain-soft: rgba(22, 199, 132, 0.14);
  --gain-line: rgba(22, 199, 132, 0.45);
  --loss: #EA3943;          /* matching red */
  --loss-soft: rgba(234, 57, 67, 0.14);
  --loss-line: rgba(234, 57, 67, 0.45);
}

[data-theme="light"] {
  --gain: #099268;
  --gain-soft: rgba(9, 146, 104, 0.10);
  --gain-line: rgba(9, 146, 104, 0.35);
  --loss: #C92A2A;
  --loss-soft: rgba(201, 42, 42, 0.10);
  --loss-line: rgba(201, 42, 42, 0.35);
}

/* ---- Stat cards: tinted surface + coloured edge ---- */
.stat-card.tone-green {
  background:
    linear-gradient(135deg, var(--gain-soft), transparent 60%),
    var(--card-bg);
  border-color: var(--gain-line);
}
.stat-card.tone-green::before {
  background: linear-gradient(90deg, transparent, var(--gain), transparent);
  opacity: 1;
}
.stat-card.tone-green:hover {
  border-color: var(--gain);
  box-shadow: 0 14px 40px rgba(22, 199, 132, 0.18), var(--shadow-md);
}
.stat-card.tone-green .stat-value { color: var(--gain); }

.stat-card.tone-red {
  background:
    linear-gradient(135deg, var(--loss-soft), transparent 60%),
    var(--card-bg);
  border-color: var(--loss-line);
}
.stat-card.tone-red::before {
  background: linear-gradient(90deg, transparent, var(--loss), transparent);
  opacity: 1;
}
.stat-card.tone-red:hover {
  border-color: var(--loss);
  box-shadow: 0 14px 40px rgba(234, 57, 67, 0.18), var(--shadow-md);
}
.stat-card.tone-red .stat-value { color: var(--loss); }

.stat-card.tone-gold {
  background:
    linear-gradient(135deg, rgba(212, 178, 90, 0.14), transparent 60%),
    var(--card-bg);
  border-color: rgba(212, 178, 90, 0.45);
}
.stat-card.tone-gold::before {
  background: var(--gradient-gold);
  opacity: 1;
}
.stat-card.tone-gold .stat-value { color: var(--accent-light); }

/* Icon chips inherit the tone */
.stat-card.tone-green .stat-card-icon {
  background: linear-gradient(135deg, var(--gain), #0CA678);
  color: #fff;
}
.stat-card.tone-red .stat-card-icon {
  background: linear-gradient(135deg, var(--loss), #C92A2A);
  color: #fff;
}
.stat-card.tone-gold .stat-card-icon {
  background: var(--gradient-gold);
  color: #2A2210;
}

/* ---- Trend chips ---- */
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
}
.stat-trend.trend-up,
.stat-trend.trend-positive {
  background: var(--gain-soft);
  color: var(--gain);
}
.stat-trend.trend-down,
.stat-trend.trend-negative {
  background: var(--loss-soft);
  color: var(--loss);
}
.stat-trend.trend-neutral {
  background: var(--glass-bg);
  color: var(--text-muted);
}

/* ---- Deposit / Withdraw balance cards ---- */
.balance-display-card {
  position: relative;
  overflow: hidden;
}
.balance-display-card.tone-green {
  background:
    radial-gradient(120% 140% at 0% 0%, var(--gain-soft), transparent 55%),
    var(--card-bg);
  border-color: var(--gain-line);
  box-shadow: inset 4px 0 0 var(--gain);
}
.balance-display-card.tone-green .balance-amount { color: var(--gain); }

.balance-display-card.tone-red {
  background:
    radial-gradient(120% 140% at 0% 0%, var(--loss-soft), transparent 55%),
    var(--card-bg);
  border-color: var(--loss-line);
  box-shadow: inset 4px 0 0 var(--loss);
}
.balance-display-card.tone-red .balance-amount { color: var(--loss); }

.balance-amount {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---- Amounts in tables ---- */
.amount-positive, td.amount-positive { color: var(--gain); font-weight: 600; }
.amount-negative, td.amount-negative { color: var(--loss); font-weight: 600; }

/* Status badges pick up the same language */
.status-badge.status-completed,
.status-badge.status-approved,
.status-badge.status-active {
  background: var(--gain-soft);
  color: var(--gain);
  border: 1px solid var(--gain-line);
}
.status-badge.status-rejected,
.status-badge.status-failed,
.status-badge.status-cancelled {
  background: var(--loss-soft);
  color: var(--loss);
  border: 1px solid var(--loss-line);
}
.status-badge.status-pending {
  background: rgba(224, 169, 75, 0.14);
  color: var(--warning);
  border: 1px solid rgba(224, 169, 75, 0.4);
}

/* ============================================================
   15. INPUT FIELDS — raised, clearly-visible surfaces
   ------------------------------------------------------------
   The dark-on-dark inputs read as disabled. These sit ABOVE the
   card surface with a real border so they look typeable.
   ============================================================ */

:root {
  --input-bg: #232E47;
  --input-bg-focus: #273353;
  --input-border: #3E4C6B;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
select,
textarea,
.form-control {
  background: #232E47;
  border: 1.5px solid #3E4C6B;
  color: var(--text-primary);
  border-radius: 10px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input::placeholder,
textarea::placeholder,
.form-control::placeholder {
  /* #8E9DBB clears 4.5:1 against the input fill; anything darker fails. */
  color: #8E9DBB;
  opacity: 1;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover,
.form-control:hover {
  border-color: #55668C;
  background: #273353;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  background: #273353;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 184, 134, 0.22);
  outline: none;
}

input:disabled,
select:disabled,
textarea:disabled,
.form-control:disabled,
input[readonly],
.form-control[readonly] {
  background: #1A2237;
  border-color: #2E3A54;
  color: var(--text-secondary);
}

/* Search box in the top bar */
.search-box input,
.top-header input[type="search"] {
  background: #232E47;
  border: 1.5px solid #3E4C6B;
}

/* Light theme keeps inputs clearly recessed but bright */
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] select,
[data-theme="light"] textarea,
[data-theme="light"] .form-control {
  background: #FFFFFF;
  border-color: #C9D3E3;
  color: #10192B;
}
[data-theme="light"] input::placeholder,
[data-theme="light"] .form-control::placeholder { color: #93A0B8; }
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] .form-control:focus {
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(12, 166, 120, 0.18);
}

/* ============================================================
   16. SIDEBAR CLOSE (X) — MOBILE ONLY
   ------------------------------------------------------------
   The sidebar is permanently docked on desktop, so there is
   nothing to close there — the X was only ever meant for the
   off-canvas mobile drawer. It had no CSS at all, so it fell
   back to a bare unstyled button next to the logo on every
   screen size. It now appears exactly where the hamburger does
   (<=768px), and is properly styled there.
   ============================================================ */

.sidebar-close {
  display: none;
}

@media (max-width: 768px) {
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    margin-left: auto;
    padding: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
  }

  .sidebar-close:hover,
  .sidebar-close:focus-visible {
    background: rgba(18, 184, 134, 0.12);
    border-color: var(--primary);
    color: var(--text-primary);
  }

  /* Keep the logo and the X on one row with the X pushed to the end */
  .sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
  }
}
