/* ARTEL Fintech — Инвестиции (Light theme matching Trading dashboard) */

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

:root {
  --bg-page: #f5f7fb;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-input: #f1f5f9;
  --border: #e5e7eb;
  --border-light: #f0f0f5;
  --border-hover: #d1d5db;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-light: rgba(99, 102, 241, 0.1);
  --primary-hover: #4f46e5;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-light: rgba(249, 115, 22, 0.1);
  --accent-blue: #3b82f6;
  --accent-blue-light: rgba(59, 130, 246, 0.1);
  --accent-green: #22c55e;
  --accent-green-light: rgba(34, 197, 94, 0.1);
  --accent-red: #ef4444;
  --accent-red-light: rgba(239, 68, 68, 0.1);
  --accent-yellow: #f59e0b;
  --accent-yellow-light: rgba(245, 158, 11, 0.1);
  --accent-purple: #8b5cf6;
  --accent-purple-light: rgba(139, 92, 246, 0.1);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --sidebar-width: 260px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.logo-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  background: var(--accent-blue-light);
  padding: 1px 8px;
  border-radius: 4px;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Nav */
.nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 24px;
}

.nav-group-title {
  display: block;
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link.active svg {
  opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.platform-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.platform-nav-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 4px 4px;
}

.platform-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.platform-link:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.platform-link svg {
  opacity: 0.5;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  min-height: 100vh;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Content Header */
.content-header {
  margin-bottom: 28px;
}

.content-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.content-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== SCREENER FILTERS ===== */
.screener-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.filter-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-range span {
  color: var(--text-muted);
  font-size: 12px;
}

.filter-input {
  width: 72px;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.filter-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.filter-input::-webkit-inner-spin-button,
.filter-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-filter-apply,
.btn-filter-reset {
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  font-family: var(--font-main);
}

.btn-filter-apply {
  background: var(--accent-blue);
  color: #fff;
}

.btn-filter-apply:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-filter-reset {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-filter-reset:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

/* ===== SCREENER TABLE ===== */
.screener-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: calc(100vh - 280px);
  box-shadow: var(--shadow-card);
}

.screener-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.screener-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.screener-table th {
  padding: 12px 14px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border-bottom: 2px solid var(--border);
  transition: color 0.15s;
}

.screener-table th:hover {
  color: var(--text);
}

.screener-table th::after {
  content: '';
  display: inline-block;
  width: 0;
  margin-left: 4px;
}

.screener-table th.sorted-asc::after {
  content: ' \25B2';
  font-size: 9px;
  color: var(--accent-blue);
}

.screener-table th.sorted-desc::after {
  content: ' \25BC';
  font-size: 9px;
  color: var(--accent-blue);
}

.screener-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  color: var(--text);
}

.screener-table tbody tr {
  transition: background 0.12s;
  cursor: pointer;
}

.screener-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.04);
}

.screener-table tbody tr:nth-child(even) {
  background: var(--bg-elevated);
}

.screener-table tbody tr:nth-child(even):hover {
  background: rgba(99, 102, 241, 0.06);
}

.ticker-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-blue) !important;
  font-size: 12.5px;
}

.sector-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-input);
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.loading-cell {
  text-align: center !important;
  padding: 40px 14px !important;
  color: var(--text-muted) !important;
  font-size: 14px !important;
}

/* Score badges */
.score-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 36px;
  text-align: center;
}

.score-badge.high {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.score-badge.medium {
  background: var(--accent-yellow-light);
  color: var(--accent-yellow);
}

.score-badge.low {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 20px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 400px;
  line-height: 1.6;
}

.empty-state.small {
  padding: 40px 20px;
}

.empty-state.small h3 {
  font-size: 15px;
}

.empty-state.small p {
  font-size: 13px;
}

/* ===== BUILDER ===== */
.builder-layout {
  display: grid;
  grid-template-columns: 280px 1fr 1fr;
  gap: 20px;
}

.builder-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.builder-field {
  margin-bottom: 14px;
}

.builder-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.builder-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.builder-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.builder-input::placeholder {
  color: var(--text-muted);
}

.builder-ticker-add {
  display: flex;
  gap: 8px;
}

.builder-ticker-add .builder-input {
  flex: 1;
}

.btn-add-ticker {
  padding: 9px 14px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  font-family: var(--font-main);
}

.btn-add-ticker:hover {
  background: #2563eb;
}

/* ===== STRATEGIES ===== */
.strategies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.strategy-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.strategy-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.strategy-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.strategy-icon.value {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.strategy-icon.growth {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
}

.strategy-icon.dividend {
  background: var(--accent-yellow-light);
  color: var(--accent-yellow);
}

.strategy-icon.balanced {
  background: var(--accent-purple-light);
  color: var(--accent-purple);
}

.strategy-icon.defensive {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.strategy-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.strategy-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.strategy-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.risk-tag, .horizon-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.risk-tag.low {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.risk-tag.medium {
  background: var(--accent-yellow-light);
  color: var(--accent-yellow);
}

.risk-tag.high {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

.horizon-tag {
  background: var(--bg-input);
  color: var(--text-secondary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .builder-layout {
    grid-template-columns: 1fr 1fr;
  }
  .builder-layout .builder-section:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 220px;
  }
  :root {
    --sidebar-width: 220px;
  }
  .main-content {
    padding: 24px;
  }
  .strategies-grid {
    grid-template-columns: 1fr;
  }
  .builder-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: relative;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .app {
    flex-direction: column;
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }
  .nav {
    display: flex;
    overflow-x: auto;
    padding: 8px 12px;
  }
  .nav-group {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
  }
  .nav-group-title {
    display: none;
  }
  .nav-link {
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }
  .nav-link.active {
    box-shadow: none;
  }
  .sidebar-footer {
    display: none;
  }
  .screener-filters {
    flex-direction: column;
  }
  .filter-group {
    width: 100%;
  }
  .filter-range {
    width: 100%;
  }
  .filter-input {
    flex: 1;
    width: auto;
  }
  .content-header h1 {
    font-size: 22px;
  }
}
