/* ============================================
   INVESTING MANAGER — Premium Dark Theme
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(79, 140, 255, 0.3);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #4f8cff;
  --accent-glow: rgba(79, 140, 255, 0.15);
  --green: #00d68f;
  --green-bg: rgba(0, 214, 143, 0.1);
  --red: #ff3d71;
  --red-bg: rgba(255, 61, 113, 0.1);
  --yellow: #ffb547;
  --yellow-bg: rgba(255, 181, 71, 0.1);
  --purple: #a78bfa;
  --sidebar-width: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ---- LAYOUT ---- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-brand .brand-text {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.sidebar-brand .brand-sub {
  font-size: 11px; color: var(--text-muted);
  font-weight: 400;
}

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

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500; font-size: 13px;
  transition: var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon { font-size: 18px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px 32px;
  max-width: calc(100vw - var(--sidebar-width));
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.header-actions { display: flex; gap: 8px; }

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(12px);
  transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-title {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.card-value {
  font-size: 28px; font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}
.card-value.positive { color: var(--green); }
.card-value.negative { color: var(--red); }
.card-change {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
  margin-top: 6px;
}
.card-change.positive { color: var(--green); background: var(--green-bg); }
.card-change.negative { color: var(--red); background: var(--red-bg); }

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

/* ---- CHARTS GRID ---- */
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }
.charts-grid .card { min-height: 320px; }
.chart-container { position: relative; width: 100%; height: 260px; }

/* ---- TABLE ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left; padding: 10px 12px;
  font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-glass); }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }
.positive-text { color: var(--green); }
.negative-text { color: var(--red); }

.ticker-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--accent);
}
.ticker-name { font-weight: 400; color: var(--text-secondary); font-size: 12px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #3b6fd4);
  color: white;
  box-shadow: 0 2px 12px rgba(79, 140, 255, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(79, 140, 255, 0.4);
}
.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-success { background: linear-gradient(135deg, var(--green), #00b377); color: white; }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(255,61,113,0.2); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit; font-size: 13px;
  transition: var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* ---- ASSET PREVIEW ---- */
.asset-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px; margin: 20px 0;
}
.asset-preview .asset-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.asset-preview .asset-ticker { font-size: 24px; font-weight: 800; color: var(--accent); }
.asset-preview .asset-name { font-size: 16px; color: var(--text-secondary); }
.asset-preview .asset-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.asset-meta-item { padding: 12px; background: var(--bg-glass); border-radius: var(--radius-sm); }
.asset-meta-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.asset-meta-value { font-size: 15px; font-weight: 600; margin-top: 2px; }

/* ---- ALERTS / MESSAGES ---- */
.messages { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  animation: slideIn 0.3s ease;
}
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(0,214,143,0.2); }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(255,61,113,0.2); }
.alert-info { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(79,140,255,0.2); }

/* ---- MODAL ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 560px;
  max-height: 85vh; overflow-y: auto;
  animation: modalIn 0.3s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }

/* ---- CALENDAR ---- */
.fc { font-family: 'Inter', sans-serif !important; }
.fc .fc-toolbar-title { font-size: 18px !important; font-weight: 700 !important; }
.fc .fc-button {
  background: var(--bg-glass) !important; border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important; font-size: 12px !important;
  padding: 6px 12px !important; border-radius: 6px !important;
}
.fc .fc-button:hover { background: var(--bg-card-hover) !important; color: var(--text-primary) !important; }
.fc .fc-button-active { background: var(--accent-glow) !important; color: var(--accent) !important; border-color: var(--accent) !important; }
.fc .fc-daygrid-day { background: var(--bg-secondary) !important; border-color: var(--border) !important; }
.fc .fc-daygrid-day:hover { background: var(--bg-card-hover) !important; }
.fc .fc-col-header-cell { background: var(--bg-primary) !important; border-color: var(--border) !important; color: var(--text-muted) !important; font-size: 12px !important; font-weight: 600 !important; text-transform: uppercase !important; }
.fc .fc-daygrid-day-number { color: var(--text-secondary) !important; font-size: 12px !important; }
.fc .fc-daygrid-day.fc-day-today { background: var(--accent-glow) !important; }
.fc .fc-event { border-radius: 4px !important; padding: 2px 4px !important; font-size: 11px !important; border: none !important; }

/* ---- DIVIDEND CARD ---- */
.dividend-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg-glass); margin-bottom: 8px;
  transition: var(--transition);
}
.dividend-item:hover { background: var(--bg-card-hover); }
.dividend-ticker { font-weight: 700; color: var(--accent); }
.dividend-amount { font-weight: 700; color: var(--green); }
.dividend-date { font-size: 12px; color: var(--text-muted); }

/* ---- TAGS ---- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.tag-low { background: rgba(79,140,255,0.1); color: var(--accent); }
.tag-medium { background: var(--yellow-bg); color: var(--yellow); }
.tag-high { background: rgba(255,61,113,0.1); color: var(--red); }
.tag-stock { background: rgba(79,140,255,0.1); color: var(--accent); }
.tag-etf { background: rgba(167,139,250,0.1); color: var(--purple); }
.tag-currency { background: rgba(255,181,71,0.08); color: var(--yellow); font-family: monospace; }
.text-xs { font-size: 10px; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto 20px; }

/* ---- ANIMATIONS ---- */
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-in { animation: fadeIn 0.4s ease; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ---- UTILITIES ---- */
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.overflow-auto { overflow-x: auto; }
