/* styles.css */

/* Google Fonts - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Base */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  transition: background-color 0.35s ease, color 0.35s ease;
  background-color: #f8fafc;
  color: #1e293b;
}
html.dark body {
  background-color: #020617;
  color: #f1f5f9;
}

/* ──────────────────────────────────── */
/*  TOP BAR                            */
/* ──────────────────────────────────── */
#topBar {
  background: rgba(255,255,255,0.85);
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
html.dark #topBar {
  background: rgba(2,6,23,0.92);
  border-bottom-color: #1e293b;
}

/* ──────────────────────────────────── */
/*  METRIC PILLS (Top Bar)             */
/* ──────────────────────────────────── */
.metric-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
}
/* Net Profit pill */
.metric-pill.pill-profit {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
html.dark .metric-pill.pill-profit {
  background: rgba(5,46,22,0.4);
  border-color: rgba(22,101,52,0.4);
}
/* Sales pill */
.metric-pill.pill-sales {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
html.dark .metric-pill.pill-sales {
  background: #0f172a;
  border-color: #1e293b;
}
/* Invested pill */
.metric-pill.pill-inv {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
}
html.dark .metric-pill.pill-inv {
  background: rgba(59,7,100,0.3);
  border-color: rgba(107,33,168,0.35);
}
/* Payouts pill */
.metric-pill.pill-pay {
  background: #fffbeb;
  border: 1px solid #fde68a;
}
html.dark .metric-pill.pill-pay {
  background: rgba(69,26,3,0.35);
  border-color: rgba(146,64,14,0.4);
}

/* Metric labels */
.metric-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 13px; font-weight: 800; }

.metric-label.lbl-profit,
.metric-value.val-profit  { color: #16a34a; }
html.dark .metric-label.lbl-profit,
html.dark .metric-value.val-profit  { color: #4ade80; }

.metric-label.lbl-sales   { color: #94a3b8; }
.metric-value.val-sales   { color: #1e293b; }
html.dark .metric-label.lbl-sales   { color: #64748b; }
html.dark .metric-value.val-sales   { color: #e2e8f0; }

.metric-label.lbl-inv,
.metric-value.val-inv     { color: #7c3aed; }
html.dark .metric-label.lbl-inv,
html.dark .metric-value.val-inv     { color: #c084fc; }

.metric-label.lbl-pay,
.metric-value.val-pay     { color: #d97706; }
html.dark .metric-label.lbl-pay,
html.dark .metric-value.val-pay     { color: #fb923c; }

/* ──────────────────────────────────── */
/*  TOP BAR ICON BUTTONS               */
/* ──────────────────────────────────── */
.topbar-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 600;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.topbar-btn:hover { background: #f1f5f9; }
html.dark .topbar-btn {
  background: #0f172a;
  border-color: #1e293b;
  color: #94a3b8;
}
html.dark .topbar-btn:hover { background: #1e293b; }

.topbar-btn.btn-primary {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
}
.topbar-btn.btn-primary:hover { background: #4338ca; }
html.dark .topbar-btn.btn-primary { background: #4f46e5; border-color: #4f46e5; }

/* ──────────────────────────────────── */
/*  FORM LABELS + INPUTS               */
/* ──────────────────────────────────── */
.form-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 4px;
}
html.dark .form-label { color: #64748b; }

.form-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.2s;
  color: #1e293b;
}
.form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
html.dark .form-input {
  background: #020617;
  border-color: #1e293b;
  color: #e2e8f0;
}
html.dark .form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.form-input::placeholder { color: #94a3b8; }
html.dark .form-input::placeholder { color: #334155; }
.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ──────────────────────────────────── */
/*  SIDEBAR / FORM CARD                */
/* ──────────────────────────────────── */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}
html.dark .card {
  background: #0f172a;
  border-color: #1e293b;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px; font-weight: 700; color: #1e293b;
}
html.dark .card-header {
  border-bottom-color: #1e293b;
  color: #f1f5f9;
}

.card-body { padding: 16px 20px; }

/* ──────────────────────────────────── */
/*  INVESTOR ACCORDION                 */
/* ──────────────────────────────────── */
.accordion {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
html.dark .accordion { border-color: #1e293b; }

.accordion-trigger {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: transparent;
  cursor: pointer;
  border: none;
  text-align: left;
  transition: background 0.15s;
  font-size: 12px; font-weight: 700; color: #475569;
}
.accordion-trigger:hover { background: #f8fafc; }
html.dark .accordion-trigger { color: #cbd5e1; }
html.dark .accordion-trigger:hover { background: #1e293b; }

.accordion-body {
  border-top: 1px solid #e2e8f0;
  background: #fafafa;
  padding: 12px;
}
html.dark .accordion-body {
  border-top-color: #1e293b;
  background: #020617;
}

/* Investor row chips */
.inv-chip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 12px;
}
html.dark .inv-chip {
  background: #1e293b;
  border-color: #334155;
}

/* ──────────────────────────────────── */
/*  FILTER BAR                         */
/* ──────────────────────────────────── */
.filter-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
html.dark .filter-bar {
  background: #0f172a;
  border-color: #1e293b;
}

/* ──────────────────────────────────── */
/*  TABLE CARD                         */
/* ──────────────────────────────────── */
.table-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
html.dark .table-card {
  background: #0f172a;
  border-color: #1e293b;
}

.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
html.dark .table-toolbar {
  background: #020617;
  border-bottom-color: #1e293b;
}

table thead tr {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
html.dark table thead tr {
  background: #020617;
  border-bottom-color: #1e293b;
}

table thead th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
table thead th:hover { background: #f1f5f9; }
html.dark table thead th { color: #475569; }
html.dark table thead th:hover { background: #1e293b; }

table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s;
  animation: fadeInRow 0.2s ease both;
}
table tbody tr:hover { background: #fafafa; }
html.dark table tbody tr { border-bottom-color: #1e293b; }
html.dark table tbody tr:hover { background: rgba(30,41,59,0.4); }

table tbody td { padding: 10px 12px; font-size: 12px; }

/* ──────────────────────────────────── */
/*  PAGINATION                         */
/* ──────────────────────────────────── */
.pagination-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 12px; color: #94a3b8;
}
html.dark .pagination-bar {
  background: #020617;
  border-top-color: #1e293b;
}
.page-btn {
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.page-btn:hover:not(:disabled) { background: #f1f5f9; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.active { background: #4f46e5; border-color: #4f46e5; color: #fff; }
html.dark .page-btn {
  background: #0f172a;
  border-color: #1e293b;
  color: #94a3b8;
}
html.dark .page-btn:hover:not(:disabled) { background: #1e293b; }

/* ──────────────────────────────────── */
/*  STATUS PILLS                       */
/* ──────────────────────────────────── */
.pill-instock {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700;
  background: #f0fdf4; color: #16a34a;
}
html.dark .pill-instock { background: rgba(5,46,22,0.4); color: #4ade80; }

.pill-sold {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700;
  background: #f8fafc; color: #64748b;
}
html.dark .pill-sold { background: #1e293b; color: #94a3b8; }

/* ──────────────────────────────────── */
/*  PROFIT / LOSS CELLS                */
/* ──────────────────────────────────── */
.profit-pos { background: #f0fdf4; color: #16a34a; }
.profit-neg { background: #fff1f2; color: #e11d48; }
html.dark .profit-pos { background: rgba(5,46,22,0.25); color: #4ade80; }
html.dark .profit-neg { background: rgba(69,10,10,0.3); color: #fb7185; }

/* ──────────────────────────────────── */
/*  SHARED PILLS                       */
/* ──────────────────────────────────── */
.shared-yes {
  padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700;
  background: #fdf2f8; color: #db2777;
}
.shared-no {
  padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700;
  background: #f8fafc; color: #94a3b8;
}
html.dark .shared-yes { background: rgba(86,7,53,0.35); color: #f472b6; }
html.dark .shared-no  { background: #1e293b; color: #475569; }

/* ──────────────────────────────────── */
/*  IMAGE MODAL                        */
/* ──────────────────────────────────── */
#imageModal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2,6,23,0.85);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
#imageModal.open { display: flex; }
#imageModal > div {
  background: #ffffff;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
  padding: 8px; max-width: 640px; width: 100%;
}
html.dark #imageModal > div { background: #0f172a; }

/* ──────────────────────────────────── */
/*  DANGER ZONE                        */
/* ──────────────────────────────────── */
.danger-zone {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: rgba(254,242,242,0.4);
  border: 1px solid rgba(252,165,165,0.3);
  border-radius: 12px;
}
html.dark .danger-zone {
  background: rgba(69,10,10,0.15);
  border-color: rgba(153,27,27,0.2);
}

/* ──────────────────────────────────── */
/*  CUSTOM SCROLLBAR                   */
/* ──────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
html.dark ::-webkit-scrollbar-thumb { background: #334155; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ──────────────────────────────────── */
/*  ANIMATIONS                         */
/* ──────────────────────────────────── */
@keyframes fadeInRow {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

tbody tr:nth-child(1)  { animation-delay: 0.02s; }
tbody tr:nth-child(2)  { animation-delay: 0.04s; }
tbody tr:nth-child(3)  { animation-delay: 0.06s; }
tbody tr:nth-child(4)  { animation-delay: 0.08s; }
tbody tr:nth-child(5)  { animation-delay: 0.10s; }
tbody tr:nth-child(6)  { animation-delay: 0.12s; }
tbody tr:nth-child(7)  { animation-delay: 0.14s; }
tbody tr:nth-child(8)  { animation-delay: 0.16s; }
tbody tr:nth-child(9)  { animation-delay: 0.18s; }
tbody tr:nth-child(10) { animation-delay: 0.20s; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.animate-fade-in { animation: fadeIn 0.2s ease; }

/* ──────────────────────────────────── */
/*  IMAGE ZOOM                         */
/* ──────────────────────────────────── */
.zoom-img {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.zoom-img:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

/* ──────────────────────────────────── */
/*  EDIT RING                          */
/* ──────────────────────────────────── */
.edit-ring {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
  border-radius: 16px;
}

/* ──────────────────────────────────── */
/*  SIDEBAR MAXIMIZE TRANSITION        */
/* ──────────────────────────────────── */
#formSidebar {
  transition: width 0.35s ease, opacity 0.3s ease, margin 0.35s ease, padding 0.35s ease;
}
#formSidebar.sidebar-hidden {
  width: 0 !important;
  opacity: 0;
  overflow: hidden;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none;
}

/* ──────────────────────────────────── */
/*  PROFIT METRIC DYNAMIC COLOR       */
/* ──────────────────────────────────── */
#metricProfit.positive { color: #16a34a; }
#metricProfit.negative { color: #e11d48; }
html.dark #metricProfit.positive { color: #4ade80; }
html.dark #metricProfit.negative { color: #fb7185; }



/* ──────────────────────────────────── */
/*  FORM INPUTS  */
/* ──────────────────────────────────── */
.form-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 4px;
}
.dark .form-label { color: #64748b; }

.form-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: #1e293b;
}
.form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.dark .form-input {
  background: #0f172a;
  border-color: #1e293b;
  color: #e2e8f0;
}
.dark .form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.form-input::placeholder { color: #94a3b8; }
.dark .form-input::placeholder { color: #475569; }

/* ──────────────────────────────────── */
/*  METRIC PILLS (Top Bar)  */
/* ──────────────────────────────────── */
.metric-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
}

/* ──────────────────────────────────── */
/*  CUSTOM SCROLLBAR  */
/* ──────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-thumb { background: #334155; }
.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ──────────────────────────────────── */
/*  TABLE ROW ANIMATIONS  */
/* ──────────────────────────────────── */
@keyframes fadeInRow {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

tbody tr {
  animation: fadeInRow 0.2s ease both;
}
tbody tr:nth-child(1)  { animation-delay: 0.02s; }
tbody tr:nth-child(2)  { animation-delay: 0.04s; }
tbody tr:nth-child(3)  { animation-delay: 0.06s; }
tbody tr:nth-child(4)  { animation-delay: 0.08s; }
tbody tr:nth-child(5)  { animation-delay: 0.10s; }
tbody tr:nth-child(6)  { animation-delay: 0.12s; }
tbody tr:nth-child(7)  { animation-delay: 0.14s; }
tbody tr:nth-child(8)  { animation-delay: 0.16s; }
tbody tr:nth-child(9)  { animation-delay: 0.18s; }
tbody tr:nth-child(10) { animation-delay: 0.20s; }

/* ──────────────────────────────────── */
/*  FADE-IN MODAL ANIMATION  */
/* ──────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.animate-fade-in { animation: fadeIn 0.2s ease; }

/* ──────────────────────────────────── */
/*  IMAGE HOVER EFFECT  */
/* ──────────────────────────────────── */
.zoom-img {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.zoom-img:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* ──────────────────────────────────── */
/*  EDITING HIGHLIGHT RING  */
/* ──────────────────────────────────── */
.edit-ring {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
  border-radius: 14px;
}

/* ──────────────────────────────────── */
/*  SIDEBAR TRANSITION (maximize)  */
/* ──────────────────────────────────── */
#formSidebar {
  transition: width 0.35s ease, opacity 0.3s ease, margin 0.35s ease;
}
#formSidebar.sidebar-hidden {
  width: 0 !important;
  opacity: 0;
  overflow: hidden;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none;
}
