/* StockResults.in - Refined Financial Technology Design System */

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Color Palette */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface: #ffffff;
  --bg-hover: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --primary: #1e3a8a;
  --primary-accent: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: #eff6ff;
  
  --green: #16a34a;
  --green-bg: #dcfce7;
  --green-text: #15803d;
  
  --red: #dc2626;
  --red-bg: #fee2e2;
  --red-text: #b91c1c;
  
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --amber-text: #b45309;
  
  --telegram-blue: #0088cc;
  --telegram-hover: #0077b5;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

/* Base Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 20px;
}

.brand-logo img {
  height: 38px;
  width: auto;
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 4px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary-accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary-accent);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
  border-color: #cbd5e1;
}

.btn-telegram {
  background-color: var(--telegram-blue);
  color: #ffffff;
}

.btn-telegram:hover {
  background-color: var(--telegram-hover);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--red);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-danger-outline {
  background: transparent;
  color: var(--red);
  border-color: #fca5a5;
}

.btn-danger-outline:hover {
  background: var(--red-bg);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

/* Flash Messages */
.flash-container {
  margin-top: 16px;
}

.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success {
  background-color: var(--green-bg);
  color: var(--green-text);
  border: 1px solid #bbf7d0;
}

.alert-error {
  background-color: var(--red-bg);
  color: var(--red-text);
  border: 1px solid #fecaca;
}

/* Typography & Headers */
h1, h2, h3, h4 {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #fbfcfe;
}

.num-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  line-height: 1;
  white-space: nowrap;
}

.badge-green {
  background: var(--green-bg);
  color: var(--green-text);
}

.badge-red {
  background: var(--red-bg);
  color: var(--red-text);
}

.badge-amber {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.badge-blue {
  background: var(--primary-subtle);
  color: var(--primary-accent);
}

.badge-gray {
  background: #f1f5f9;
  color: var(--text-muted);
}

.growth-pill {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}

.growth-pill.positive {
  background: var(--green-bg);
  color: var(--green-text);
}

.growth-pill.negative {
  background: var(--red-bg);
  color: var(--red-text);
}

.growth-pill.neutral {
  background: #f1f5f9;
  color: var(--text-muted);
}

/* Hero Section */
.hero {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 48px 0 36px 0;
  text-align: center;
}

.hero h1 {
  font-size: 38px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero .subtitle {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 28px auto;
}

/* Instant Search Box */
.search-wrapper {
  max-width: 620px;
  margin: 0 auto 36px auto;
  position: relative;
}

.search-input-group {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.search-input-group:focus-within {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-icon {
  color: var(--text-muted);
  font-size: 18px;
  margin-right: 10px;
}

.search-input {
  border: none;
  outline: none;
  font-size: 15px;
  width: 100%;
  color: var(--text-main);
  font-family: inherit;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  margin-top: 6px;
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}

.autocomplete-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.15s ease;
}

.autocomplete-item:hover {
  background: var(--bg-hover);
}

/* Market Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  font-family: inherit;
  transition: all 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Toggle Switches */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-accent);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Footer */
.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  padding: 48px 0 24px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 36px;
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .header-inner {
    height: 60px;
  }
  .main-nav {
    display: none;
  }
  .hero h1 {
    font-size: 28px;
  }
  .hero .subtitle {
    font-size: 15px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}
