/* ================================================
   Masaniello Money Management — ASIK RANA
   Main Stylesheet
   ================================================ */

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

:root {
  --bg:          #0f1117;
  --bg2:         #1a1d27;
  --bg3:         #22263a;
  --border:      #2e3352;
  --text:        #e2e8f0;
  --muted:       #64748b;
  --primary:     #6366f1;
  --primary-h:   #7c7ff5;
  --success:     #22c55e;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --info:        #38bdf8;
  --win:         #16a34a;
  --loss:        #dc2626;
  --radius:      8px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
}

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

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

/* ---- NAVBAR ---- */
.navbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text) !important;
  text-decoration: none !important;
}
.brand-icon { font-size: 22px; }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a {
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: all .2s;
  text-decoration: none !important;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg3); }
.btn-new {
  background: var(--primary) !important;
  color: #fff !important;
  border-radius: var(--radius) !important;
  padding: 6px 16px !important;
}
.btn-new:hover { background: var(--primary-h) !important; }

/* ---- PAGE ---- */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 24px; font-weight: 700; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border-left: 4px solid;
}
.alert-success { background: rgba(34,197,94,.1); border-color: var(--success); color: #86efac; }
.alert-error   { background: rgba(239,68,68,.1);  border-color: var(--danger);  color: #fca5a5; }
.alert ul { margin-top: 6px; padding-left: 16px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none !important;
}
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-h); color: #fff; }
.btn-secondary{ background: var(--bg3);      color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-warning  { background: var(--warning);  color: #000; }
.btn-warning:hover  { opacity: .85; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { opacity: .85; }
.btn-info     { background: var(--info);     color: #000; }
.btn-info:hover     { opacity: .85; }
.btn-win      { background: var(--win);      color: #fff; }
.btn-loss     { background: var(--loss);     color: #fff; }
.btn-sm       { padding: 4px 10px; font-size: 12px; }
.btn-lg       { padding: 10px 20px; font-size: 15px; }
.btn-full     { width: 100%; justify-content: center; }

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active    { background: rgba(34,197,94,.2); color: var(--success); }
.badge-completed { background: rgba(99,102,241,.2); color: #a5b4fc; }
.badge-cancelled { background: rgba(100,116,139,.2); color: var(--muted); }
.badge-win  { background: rgba(22,163,74,.3); color: #86efac; }
.badge-loss { background: rgba(220,38,38,.3); color: #fca5a5; }
.badge-pending { background: var(--bg3); color: var(--muted); }
.badge-lg { padding: 4px 14px; font-size: 14px; }

/* ---- STATS GRID (Dashboard) ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-icon  { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 36px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-active .stat-value    { color: var(--success); }
.stat-completed .stat-value { color: var(--primary); }

/* ---- SECTION ---- */
.section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section h2 { font-size: 17px; font-weight: 600; margin-bottom: 16px; }

/* ---- TABLES ---- */
.table-wrapper { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--bg3);
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(46,51,82,.4);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.data-table .actions { display: flex; gap: 4px; flex-wrap: wrap; }
.num    { text-align: right; font-family: monospace; }
.center { text-align: center; }
.bold   { font-weight: 700; }
.green  { color: var(--success); }
.red    { color: var(--danger); }
.muted  { color: var(--muted); }
.small  { font-size: 12px; }

/* ---- EVENT TABLE ROWS ---- */
.row-win  td { background: rgba(22,163,74,.06); }
.row-loss td { background: rgba(220,38,38,.06); }
.row-pending td { opacity: .7; }
.event-actions { display: flex; gap: 4px; }

/* ---- SESSION LAYOUT (2-col) ---- */
.session-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
.session-main {}
.session-sidebar {}

/* ---- SUMMARY GRID ---- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.sum-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.sum-label { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.sum-value { font-size: 16px; font-weight: 700; font-family: monospace; }

/* ---- SEQUENZA BAR ---- */
.sequenza-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  gap: 0;
  flex-direction: column;
}
.seq-item {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.seq-item:last-child { border: none; }
.seq-label { flex: 1; font-weight: 600; font-size: 12px; }
.seq-num   { width: 60px; text-align: right; font-family: monospace; font-weight: 700; }
.seq-pct   { width: 80px; text-align: right; color: var(--muted); font-size: 12px; }

/* ---- NEXT STAKE BANNER ---- */
.next-stake-banner {
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.next-stake-banner strong {
  font-size: 20px;
  font-family: monospace;
  color: var(--primary-h);
}

/* ---- CONFIG CARD ---- */
.config-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.config-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.config-card h4 { font-size: 13px; color: var(--muted); margin: 10px 0 8px; }
.config-table { width: 100%; border-collapse: collapse; }
.config-table td {
  padding: 5px 4px;
  font-size: 13px;
  border-bottom: 1px solid rgba(46,51,82,.3);
}
.config-table td:last-child { text-align: right; font-family: monospace; }
.config-table tr:last-child td { border: none; }
.config-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ---- SUPPORT CARD ---- */
.support-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

/* ---- FORM ---- */
.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 700px;
}
.form-section { margin-bottom: 24px; }
.form-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,.2);
}
.help-text  { font-size: 11px; color: var(--muted); margin-top: 4px; display: block; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; display: block; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ---- PREVIEW PANEL ---- */
.preview-panel {
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}
.preview-panel h3 { font-size: 14px; margin-bottom: 12px; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.preview-item {}
.preview-label { font-size: 11px; color: var(--muted); }
.preview-value { font-size: 18px; font-family: monospace; font-weight: 700; display: block; margin-top: 2px; }
.preview-value.green { color: var(--success); }

/* ---- INFO GRID ---- */
.info-section h2 { font-size: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 12px; }
.info-card {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.info-card h3 { font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--primary-h); }
.info-card p  { font-size: 12px; color: var(--muted); line-height: 1.5; }
.info-card code {
  background: rgba(255,255,255,.05);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }

/* ---- FOOTER ---- */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.mt-2 { margin-top: 16px; }
.text-center { text-align: center; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .session-layout   { grid-template-columns: 1fr; }
  .session-sidebar  { order: -1; }
  .summary-grid     { grid-template-columns: repeat(2, 1fr); }
  .stats-grid       { grid-template-columns: 1fr; }
  .info-grid        { grid-template-columns: 1fr; }
  .preview-grid     { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .page-container   { padding: 12px; }
  .form-row         { grid-template-columns: 1fr; }
  .summary-grid     { grid-template-columns: 1fr; }
  .page-header      { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ---- COMPLETED BANNER ---- */
.completed-banner {
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.4);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #a5b4fc;
}

/* ---- SEQ HEADER ---- */
.seq-header .seq-label,
.seq-header .seq-num,
.seq-header .seq-pct {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
}

/* ---- PROGRESS BAR ---- */
.progress-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}
.progress-bar {
  background: var(--bg3);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width .4s ease;
}
.progress-done { background: var(--success); }
.progress-label { font-size: 12px; margin-top: 4px; }

/* ---- SEQ AMOUNT COL ---- */
.seq-amount { width: 120px; text-align: right; font-family: monospace; font-size: 13px; }

/* ---- PRIMARY COLOR ---- */
.primary { color: var(--primary-h); }
.sum-value.primary { color: var(--primary-h); }

/* ---- FORMULA BOX ---- */
.formula-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  font-family: monospace;
}
.formula-box strong { color: var(--text); font-family: sans-serif; }
