/**
 * AlphaSeeker - Unified Styles
 * Centralized CSS for all views with consistent theming
 * Based on list.html visual design as source of truth
 */

/* ============================================
   CSS Variables for Consistent Theming
   ============================================ */
:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --danger-color: #dc3545;
  --light-bg: #f8f9fa;
  --white: #ffffff;
  --border-color: #dee2e6;
  --text-dark: #212529;
  --text-muted: #6c757d;
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 0.75rem 1.5rem rgba(13, 110, 253, 0.2);
  --transition-base: all 0.3s ease;
}

/* ============================================
   Base Styles
   ============================================ */
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: linear-gradient(135deg, var(--white) 0%, var(--light-bg) 100%);
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
  padding: 0.75rem 0;
  backdrop-filter: blur(10px);
  transition: var(--transition-base);
  background: linear-gradient(135deg, var(--white) 0%, var(--light-bg) 100%);
}

.navbar-brand {
  font-size: 1.25rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: var(--transition-base);
}

.navbar-brand:hover {
  background: var(--light-bg);
  transform: translateY(-2px);
}

.navbar-brand i {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.navbar-brand:hover i {
  transform: scale(1.1) rotate(-5deg);
}

.navbar-brand .fw-bold {
  font-size: 1.35rem;
  letter-spacing: -0.5px;
}

/* Nav Links */
.navbar-nav .nav-link {
  position: relative;
  padding: 0.5rem 1rem;
  margin: 0 0.25rem;
  border-radius: 0.5rem;
  font-weight: 500;
  color: var(--text-dark);
  transition: var(--transition-base);
}

.navbar-nav .nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

.navbar-nav .nav-link:hover {
  background: var(--light-bg);
  color: var(--primary-color);
}

.navbar-nav .nav-link:hover::after {
  width: 60%;
}

.navbar-nav .nav-link.active {
  background: linear-gradient(
    135deg,
    rgba(13, 110, 253, 0.1),
    rgba(13, 110, 253, 0.05)
  );
  color: var(--primary-color);
}

.navbar-nav .nav-link i {
  transition: transform 0.2s ease;
}

.navbar-nav .nav-link:hover i {
  transform: translateY(-2px);
}

/* Mobile Toggle */
.navbar-toggler {
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  transition: var(--transition-base);
}

.navbar-toggler:hover {
  background: var(--light-bg);
  border-color: var(--primary-color);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* Mobile Menu */
@media (max-width: 991px) {
  .navbar-collapse {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 0.5rem;
  }

  .navbar-nav .nav-link {
    margin: 0.25rem 0;
  }
}

/* ============================================
   Cards - Common Styling
   ============================================ */
.card {
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  border-bottom: 1px solid var(--border-color);
}

/* ============================================
   Page Headers
   ============================================ */
.page-header {
  background: linear-gradient(135deg, var(--white) 0%, var(--light-bg) 100%);
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

.stats-badge {
  background: var(--white);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
}

/* ============================================
   Strategy Cards (Grid Layout)
   ============================================ */
.strategy-card {
  height: 100%;
  transition: var(--transition-base);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.strategy-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--success-color)
  );
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.strategy-card:hover::before {
  transform: scaleX(1);
}

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

.strategy-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.strategy-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-color), #0a58ca);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.strategy-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  text-decoration: none;
  display: block;
}

.strategy-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4rem;
}

.strategy-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--light-bg);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.strategy-meta .badge {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
}

.strategy-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============================================
   Ticker Cards (Full Width Layout)
   ============================================ */
.ticker-card {
  transition: var(--transition-base);
  border: 2px solid transparent;
  border-left: 4px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.ticker-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--success-color)
  );
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.ticker-card:hover::before {
  transform: scaleX(1);
}

.ticker-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg) !important;
}

.ticker-card.status-passed {
  border-left-color: var(--success-color);
}

.ticker-card.status-failed {
  border-left-color: var(--danger-color);
}

.ticker-card.status-na {
  border-left-color: var(--secondary-color);
}

.ticker-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--light-bg);
  padding: 4px;
}

/* Ticker logos */
.ticker-logo-lg {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: contain;
}

.ticker-symbol {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  text-decoration: none;
}

.data-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.data-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.status-badge-large {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
  background: linear-gradient(135deg, var(--light-bg) 0%, #e9ecef 100%);
  border-radius: 1rem;
  padding: 4rem 2rem;
}

.empty-state-icon {
  width: 120px;
  height: 120px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.empty-state-icon i {
  font-size: 3rem;
}

/* ============================================
   Table Styling
   ============================================ */
.table-hover tbody tr:hover {
  background-color: rgba(13, 110, 253, 0.05);
}

/* ============================================
   Rule Rows (Create/Edit Strategy)
   ============================================ */
.rule-row {
  background-color: var(--light-bg);
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.rule-row:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0.125rem 0.5rem rgba(13, 110, 253, 0.15);
}

/* Desktop Table View - Hidden on mobile */
.rule-table-view {
  display: block;
}

.rule-card-view {
  display: none;
}

/* ============================================
   Form Controls
   ============================================ */
.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ============================================
   Footer
   ============================================ */
footer {
  background-color: var(--white);
  border-top: 1px solid var(--border-color);
}

/* ============================================
   Custom Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
  .navbar-brand span {
    font-size: 1rem;
  }

  .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
  }

  .strategy-card {
    margin-bottom: 1rem;
  }

  .strategy-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .strategy-title {
    font-size: 1.1rem;
  }

  .ticker-symbol {
    font-size: 1.25rem;
  }

  .data-value {
    font-size: 0.9rem;
  }

  .page-header {
    padding: 1.5rem;
  }

  /* Switch from table to card view on mobile */
  .rule-table-view {
    display: none;
  }

  .rule-card-view {
    display: block;
  }

  .rule-actions {
    display: flex;
    gap: 0.5rem;
  }

  /* Detail actions: stack full-width below md */
  .actions-stack > * {
    flex: 1 1 100%;
  }

  .actions-stack .btn {
    width: 100%;
  }

  /* Home / Landing */
  .home-hero {
    padding: 3rem 0 2rem;
  }

  .home-feature-icon {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }
}

/* ============================================
   Home / Landing Page
   ============================================ */
.home-hero {
  padding: 5rem 0 4rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #f0f4ff 100%);
  border-bottom: 1px solid var(--border-color);
}

.home-feature-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 1.75rem;
  transition: var(--transition-base);
}

/* Home screenshots carousel - one large capture per slide */
.screenshots-carousel .screenshots-img {
  width: 100%;
  aspect-ratio: 1413 / 953;
  object-fit: cover;
}

.screenshots-carousel .carousel-control-prev-icon,
.screenshots-carousel .carousel-control-next-icon {
  filter: invert(0.55);
}

.screenshots-carousel .carousel-indicators {
  position: static;
  margin-top: 1.25rem;
}

.screenshots-carousel .carousel-indicators [data-bs-target] {
  background-color: var(--primary-color);
  width: 2rem;
}

/* Navbar Public - Login Button */
.navbar-nav .btn-primary {
  border-radius: 0.5rem;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  transition: var(--transition-base);
}

.navbar-nav .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

/* ============================================
   Inline Style Extractions
   ============================================ */

/* Chart legend */
.chart-legend-dot {
  width: 16px;
  height: 3px;
  display: inline-block;
}

/* Chart containers */
.chart-container {
  height: 540px;
  overflow: hidden;
}

.chart-inner {
  width: 100%;
  height: 100%;
}

/* Mini chart */
.mini-chart-container {
  width: 100%;
  height: 150px;
}

/* Notification */
.notification-container {
  z-index: 1060;
  min-width: 350px;
}

.notification-progress {
  height: 3px;
  background-color: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.notification-progress .progress-bar {
  width: 100%;
}

/* Utilities */
.cursor-help {
  cursor: help;
}

.progress-thin {
  height: 6px;
}

.text-max-width {
  max-width: 500px;
}

.icon-xl {
  font-size: 3rem;
}
