/* Style System for Alternativas de Inversión - Light & Dark Mode */

:root, [data-bs-theme="dark"] {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --accent-primary: #0284c7;
  --accent-primary-hover: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.3);
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --form-label-color: #f1f5f9;
  --border-color: rgba(255, 255, 255, 0.15);
  --input-bg: #0f172a;
  --input-border: #475569;
  --input-text: #f8fafc;
  --input-placeholder: #94a3b8;
  --glass-bg: rgba(30, 41, 59, 0.85);
  --table-header-bg: #0f172a;
  --table-header-text: #94a3b8;
  --table-hover-bg: rgba(51, 65, 85, 0.4);
  --badge-border: rgba(255, 255, 255, 0.15);
}

[data-bs-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --accent-primary: #0284c7;
  --accent-primary-hover: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.15);
  --text-main: #0f172a;
  --text-muted: #475569;
  --form-label-color: #0f172a;
  --border-color: #e2e8f0;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-text: #0f172a;
  --input-placeholder: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.9);
  --table-header-bg: #f1f5f9;
  --table-header-text: #334155;
  --table-hover-bg: #f8fafc;
  --badge-border: rgba(0, 0, 0, 0.1);
}

body {
  background-color: var(--bg-main) !important;
  color: var(--text-main) !important;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navbar */
.navbar-custom {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.brand-text {
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Cards */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.glass-card:hover {
  border-color: var(--accent-primary);
}

/* Typography & Contrast Overrides */
.text-muted {
  color: var(--text-muted) !important;
}

.text-main {
  color: var(--text-main) !important;
}

.form-label {
  color: var(--form-label-color) !important;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
}

/* Form Controls */
.form-control, .form-select {
  background-color: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  color: var(--input-text) !important;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.form-control::placeholder {
  color: var(--input-placeholder) !important;
  opacity: 1;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 4px var(--accent-glow) !important;
}

.input-group-text {
  background-color: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  color: var(--text-muted) !important;
}

/* Buttons */
.btn-primary-custom {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 0.75rem;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary-custom:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-outline-custom {
  background: transparent;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-outline-custom:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

/* Theme Toggle Button */
.btn-theme-toggle {
  background: var(--bg-card-hover);
  color: var(--text-main) !important;
  border: 1px solid var(--border-color);
  border-radius: 2rem;
  padding: 0.4rem 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-theme-toggle:hover {
  border-color: var(--accent-primary);
  transform: scale(1.03);
}

/* Stat Cards */
.stat-card {
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-primary);
}

.stat-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.25rem;
}

/* Tables */
.table-custom {
  color: var(--text-main) !important;
  border-color: var(--border-color) !important;
  margin-bottom: 0;
}

.table-custom th {
  background-color: var(--table-header-bg) !important;
  color: var(--table-header-text) !important;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 1rem;
}

.table-custom td {
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color) !important;
  background: transparent !important;
  color: var(--text-main) !important;
}

.table-custom tr:hover td {
  background-color: var(--table-hover-bg) !important;
}

/* Recommendation Badges */
.badge-category {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4em 0.8em;
  border-radius: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-buy { background-color: rgba(34, 197, 94, 0.18); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-hold { background-color: rgba(234, 179, 8, 0.18); color: #eab308; border: 1px solid rgba(234, 179, 8, 0.3); }
.badge-sell { background-color: rgba(239, 68, 68, 0.18); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-sell-partial { background-color: rgba(249, 115, 22, 0.18); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-rebalance { background-color: rgba(168, 85, 247, 0.18); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }

/* Modals */
.modal-content-custom {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: 1rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-header-custom {
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
}

.modal-footer-custom {
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
}

/* Modal Close Button Theme Compatibility */
[data-bs-theme="dark"] .modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
[data-bs-theme="light"] .modal-header .btn-close {
  filter: none;
}

.auth-container {
  max-width: 450px;
  width: 100%;
  margin: auto;
}

/* Tabla Comparativa de Alternativas */
.table-alt thead th {
  background: var(--bg-card-hover);
  color: var(--text-main);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  border-bottom: 2px solid var(--accent-primary);
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
}
.table-alt thead th:hover {
  color: var(--accent-primary);
}
.table-alt thead th .sort-icon {
  margin-left: 4px;
  font-size: 0.65rem;
  opacity: 0.4;
}
.table-alt thead th.sorted-asc .sort-icon,
.table-alt thead th.sorted-desc .sort-icon {
  opacity: 1;
  color: var(--accent-primary);
}
.table-alt tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}
.table-alt tbody tr:hover {
  background: var(--bg-card-hover);
}
.table-alt tbody td {
  padding: 0.65rem 0.5rem;
  vertical-align: middle;
  font-size: 0.88rem;
  color: var(--text-main);
}
.table-alt .ticker-cell {
  font-weight: 700;
  color: var(--accent-primary);
  transition: opacity 0.15s;
}
.table-alt .ticker-cell:hover {
  opacity: 0.75;
  text-decoration: underline;
}
.table-alt .name-cell {
  color: var(--text-muted);
  font-size: 0.78rem;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Risk & Liquidity mini badges */
.badge-risk-low  { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); font-size: 0.7rem; padding: 0.25em 0.6em; border-radius: 1rem; }
.badge-risk-mid  { background: rgba(234,179,8,0.15); color: #eab308; border: 1px solid rgba(234,179,8,0.3); font-size: 0.7rem; padding: 0.25em 0.6em; border-radius: 1rem; }
.badge-risk-high { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); font-size: 0.7rem; padding: 0.25em 0.6em; border-radius: 1rem; }
.badge-liq-high  { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); font-size: 0.7rem; padding: 0.25em 0.6em; border-radius: 1rem; }
.badge-liq-mid   { background: rgba(234,179,8,0.15); color: #eab308; border: 1px solid rgba(234,179,8,0.3); font-size: 0.7rem; padding: 0.25em 0.6em; border-radius: 1rem; }
.badge-liq-low   { background: rgba(148,163,184,0.15); color: #94a3b8; border: 1px solid rgba(148,163,184,0.3); font-size: 0.7rem; padding: 0.25em 0.6em; border-radius: 1rem; }

/* Category pills */
.badge-cat { font-size: 0.65rem; padding: 0.2em 0.5em; border-radius: 0.5rem; font-weight: 600; letter-spacing: 0.03em; }
.badge-cat-rf-ars { background: rgba(34,197,94,0.12); color: #22c55e; }
.badge-cat-rf-usd { background: rgba(59,130,246,0.12); color: #3b82f6; }
.badge-cat-cedear { background: rgba(168,85,247,0.12); color: #a855f7; }
.badge-cat-crypto { background: rgba(249,115,22,0.12); color: #f97316; }
.badge-cat-on     { background: rgba(13,202,240,0.15); color: #0dcaf2; border: 1px solid rgba(13,202,240,0.3); }

.table-responsive-alt {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Fundamento accordion */
.fund-details {
  transition: all 0.2s ease;
  overflow: hidden;
}
.fund-details .p-2 > div {
  padding: 0.15rem 0;
  line-height: 1.3;
}
