/* base.css */

/* ============================================
   CSS RESET FOR CROSS-BROWSER CONSISTENCY
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Add this at the VERY TOP of base.css */
html {
  /* Default is usually 16px. Setting this to 14px scales the whole site down */
  font-size: 14px; 
}

/* Ensure the body inherits this size */
body {
  font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem; /* This will now equal 14px */
  line-height: 1.6; /* Improves readability for smaller text */
}

/* ============================================
   GLOBAL LAYOUT CONSISTENCY
   Ensures all content (except hero sections) 
   stays within a reasonable max-width
   ============================================ */

/* Main content wrapper - constrain width */
main.flex-grow-1 > .container,
main.flex-grow-1 > section > .container {
  max-width: 1140px; /* Bootstrap's default xl container */
}

/* Hero/wave sections can be full width, but inner content is constrained */
.wave-bg .container,
.hero-section .container {
  max-width: 1140px;
}

/* Ensure consistent container behavior across browsers */
.container {
  width: 100%;
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* For very large screens (2K+), add more padding to prevent gigantic appearance */
@media (min-width: 1400px) {
  .container {
    max-width: 1200px;
  }
}

@media (min-width: 1600px) {
  .container {
    max-width: 1280px;
  }
}

/* Ensure full-width sections (heroes) still look good */
.wave-bg,
.hero-section,
[class*="bg-"] {
  width: 100%;
}

/* ============================================
   TOOLS PAGES - CONSISTENT WIDTH + CLEAN RHYTHM
   Scoped to /tools/ via body.tools-page in base.html
   ============================================ */
.tools-page main .container,
.tools-page main .container-sm,
.tools-page main .container-md,
.tools-page main .container-lg,
.tools-page main .container-xl,
.tools-page main .container-xxl,
.tools-page main .container-fluid {
  width: min(80vw, 1440px);
  max-width: min(80vw, 1440px);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(0.75rem, 1.1vw, 1.25rem);
  padding-right: clamp(0.75rem, 1.1vw, 1.25rem);
}

@media (max-width: 1199.98px) {
  .tools-page main .container,
  .tools-page main .container-sm,
  .tools-page main .container-md,
  .tools-page main .container-lg,
  .tools-page main .container-xl,
  .tools-page main .container-xxl,
  .tools-page main .container-fluid {
    width: min(92vw, 980px);
    max-width: min(92vw, 980px);
  }
}

@media (max-width: 767.98px) {
  .tools-page main .container,
  .tools-page main .container-sm,
  .tools-page main .container-md,
  .tools-page main .container-lg,
  .tools-page main .container-xl,
  .tools-page main .container-xxl,
  .tools-page main .container-fluid {
    width: 96vw;
    max-width: 96vw;
  }
}

.tools-page .form-label {
  font-size: 1.02rem;
  margin-bottom: 0.35rem;
}

.tools-page .input-group-sm > .form-control,
.tools-page .input-group-sm > .form-select,
.tools-page .input-group-sm > .input-group-text,
.tools-page .input-group-sm > .btn,
.tools-page .form-control,
.tools-page .form-select,
.tools-page .input-group-text {
  font-size: 1rem;
}

.tools-page .btn-sm {
  font-size: 0.95rem;
}

.tools-page .field-explanation,
.tools-page .metric-explanation,
.tools-page .greek-explanation,
.tools-page .form-text,
.tools-page .how-to-use .step-text,
.tools-page .alert p,
.tools-page .alert .small {
  font-size: 0.95rem;
  line-height: 1.45;
}

.tools-page .how-to-use {
  padding: 1rem 1.1rem;
}

.tools-page .how-to-use .step {
  margin-bottom: 0.55rem;
}

.tools-page .how-to-use .step:last-child {
  margin-bottom: 0;
}

.tools-page .card-body > .row {
  --bs-gutter-y: 1rem;
}

.tools-page .table-sm > :not(caption) > * > * {
  padding: 0.45rem 0.55rem;
}

/* Schibsted Grotesk, the one family of every Loheden site (global font rule,
   2026-10-07): the authors' own release 1.100 WOFF2 files, served from this
   site, one per weight the design uses. Guarded by home/test_fonts.py. */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk/SchibstedGrotesk-Regular.12804c89cc48.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk/SchibstedGrotesk-Medium.d8ff08ec1c17.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk/SchibstedGrotesk-SemiBold.fcd8cd302dad.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk/SchibstedGrotesk-Bold.9fe1b7a284e1.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk/SchibstedGrotesk-ExtraBold.406b3abbb5e0.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk/SchibstedGrotesk-Black.97a8d4ff8b2c.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary-color: #1E3A8A; /* Elegant Deep Blue */
  --secondary-color: #C9A227; /* Rich Gold (from logo) */
  --text-color-dark: #1E293B; /* Slate 800 */
  --text-color-light: #475569; /* Slate 600 */
  /* Bootstrap's own components (tooltips, popovers, form controls) read these. */
  --bs-font-sans-serif: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bs-body-font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-color-light);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-color-dark);
  font-weight: 600;
}

h1 .step-number, h2 .step-number, h3 .step-number, h4 .step-number, h5 .step-number, h6 .step-number {
  color: var(--secondary-color);
}

h1 .step-text, h2 .step-text, h3 .step-text, h4 .step-text, h5 .step-text, h6 .step-text {
  color: var(--primary-color);
}

a, p {
  color: var(--text-color-light);
}

.icon-primary {
  color: var(--secondary-color);
}

.card-title-primary {
  color: var(--primary-color);
}

.navbar .nav-link {
  color: var(--primary-color) !important;
  transition: color 0.3s ease;
}

.navbar .nav-link:hover, .navbar .nav-link:focus {
  color: var(--secondary-color) !important;
}

.navbar .nav-link.active {
  color: var(--secondary-color) !important;
}

.navbar-toggler {
  border-color: var(--primary-color) !important;
}

.navbar-toggler-icon { 
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(30, 58, 138, 1)' stroke-width='2.5' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E"); 
}

/* ============================================
   DASHBOARD NAVBAR — Logged-in users
   ============================================ */
.dash-navbar {
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.dash-nav-link {
  font-size: 1rem !important;
  font-weight: 500 !important;
  color: #2d3436 !important;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.85rem !important;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease !important;
}

.dash-nav-link:hover,
.dash-nav-link:focus {
  color: var(--primary-color) !important;
  background: rgba(30, 58, 138, 0.05); /* Match new primary */
}

.dash-nav-link.show {
  color: var(--primary-color) !important;
  background: rgba(30, 58, 138, 0.08); /* Match new primary */
}

/* Dropdown menus */
.dash-dropdown {
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
  padding: 0.4rem 0;
  margin-top: 0.35rem !important;
  animation: dashDropFade 0.15s ease-out;
}

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

.dash-dropdown-item {
  font-size: 0.94rem;
  padding: 0.55rem 1.1rem;
  color: #2d3436;
  border-radius: 6px;
  margin: 0 0.3rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.dash-dropdown-item i {
  color: var(--primary-color);
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.dash-dropdown-item:hover {
  background: rgba(30, 58, 138, 0.05); /* Match new primary */
  color: var(--primary-color);
}

.dash-dropdown-item:hover i {
  opacity: 1;
}

.dash-dropdown-item.text-danger:hover {
  background: rgba(220, 53, 69, 0.07);
  color: #dc3545;
}

.dash-dropdown-item.text-danger:hover i {
  color: #dc3545;
  opacity: 1;
}

/* User avatar circle */
.dash-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), #3B82F6);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.dash-user-toggle {
  color: #2d3436 !important;
  font-weight: 500 !important;
  font-size: 0.95rem !important;
  padding: 0.35rem 0.6rem !important;
  border-radius: 20px;
  transition: background 0.2s ease !important;
}

.dash-user-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.dash-username {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile collapse refinements */
@media (max-width: 991.98px) {
  .dash-navbar .navbar-collapse {
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 0.5rem;
  }
  .dash-nav-link {
    padding: 0.65rem 0.75rem !important;
  }
  .dash-dropdown {
    box-shadow: none;
    border: none;
    padding-left: 0.75rem;
  }
}

.text-custom-title {
  text-align: left;
  font-size: 1.25rem; /* Adjust the font size as needed */
  color: var(--primary-color); /* Use the primary color defined in :root */
}

.text-custom-subtitle {
  text-align: left;
  font-size: 1.0rem; /* Adjust the font size as needed */
  color: var(--primary-color); /* Use the primary color defined in :root */
}

.border-custom {
  border-color: var(--primary-color) !important;
  border-radius: 10px; 
}


.custom-checkbox:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}


.custom-table {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.custom-table .list-group-item {
  border-color: rgba(0,0,0,0.05);
}


.clear-button {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: #aaa;
}

.clear-button:hover {
  color: var(--text-color-dark);
}

.custom-card {
  border: 1px solid rgba(0,0,0,0.1); 
  border-radius: 12px; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.custom-btn {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #A68307 100%) !important;
  border: none !important;
  color: #fff !important;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 5px;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.custom-btn:hover {
  background: linear-gradient(135deg, #A68307 0%, var(--secondary-color) 100%) !important;
  color: #fff !important; 
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.3);
}

.custom-btn:active {
  transform: scale(0.95);
}

/* Additional styles for the file input label */
label.custom-btn {
  display: inline-block;
  margin-bottom: 0;
}


.custom-danger-btn {
  background: linear-gradient(90deg, rgba(255, 77, 77, 1) 0%, rgba(204, 0, 0, 1) 100%) !important;
  border: none !important;
  color: #fff !important;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 5px;
  transition: background 0.3s ease, transform 0.3s ease;
}

.custom-danger-btn:hover {
  background: linear-gradient(90deg, rgba(204, 0, 0, 1) 0%, rgba(255, 77, 77, 1) 100%) !important;
  color: #fff !important;
  transform: scale(1.05);
}

.custom-danger-btn:active {
  transform: scale(0.95);
}


/* Hide the original file input */
input[type="file"] {
  display: none;
}


/* Ensure proper alignment of table rows and cells */
.table tbody tr {
  margin: 0;
  padding: 0;
}

.table tbody tr td {
  padding: 0.5rem 0; /* Adjust padding as needed */
}

.table tbody tr td p {
  margin: 0;
  padding: 0;
}

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


/* Custom styles for language switcher buttons */
.language-switcher .btn-outline-secondary {
  color: var(--secondary-color);
  border-color: var(--secondary-color);
}

.language-switcher .btn-outline-secondary.active {
  background-color: var(--secondary-color);
  color: white;
}


/* Stable gradient button - no animation */
.color-wave {
  background: linear-gradient(135deg, var(--primary-color) 0%, #3B82F6 50%, var(--secondary-color) 100%);
  transition: all 0.3s ease;
}

.color-wave:hover {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #3B82F6 50%, var(--primary-color) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

/* Recommended pricing card highlight */
.card-recommended {
  border-color: var(--primary-color) !important;
}

/* Stable small gradient button - no animation */
.color-wave-small {
  background: linear-gradient(135deg, var(--primary-color) 0%, #3B82F6 50%, var(--secondary-color) 100%);
  border: none;
  color: #fff;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.color-wave-small:hover {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #3B82F6 50%, var(--primary-color) 100%);
}


/* Dark Professional Hero Section */
.hero-dark-professional {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  min-height: 600px;
  position: relative;
}

/* Animated Grid Background */
.hero-grid-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(6, 182, 212, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
  opacity: 0.4;
}

@keyframes gridMove {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(50px, 50px);
  }
}

/* Text Colors */
.text-cyan {
  color: #06b6d4 !important;
}

.text-light-gray {
  color: #cbd5e1 !important;
}

/* Hero Strikethrough Text */
.hero-strikethrough {
  animation: fadeInSlide 0.8s ease-out;
}

/* Hero Static Text */
.hero-static-text {
  color: #ffffff;
  font-weight: 700;
}

/* Typewriter Container */
.hero-typewriter {
  color: #06b6d4;
  font-weight: 600;
  display: inline-block;
  min-width: 200px;
}

/* Blinking Cursor */
.hero-cursor {
  color: #06b6d4;
  animation: blink 1s infinite;
  font-weight: 400;
}

@keyframes blink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

@keyframes fadeInSlide {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Trust Badges */
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 20px;
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.trust-badge:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.5);
  transform: translateY(-2px);
}

.trust-badge i {
  font-size: 1rem;
}

/* Glassmorphism Card */
.hero-glass-card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.hero-glass-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 12px 40px rgba(6, 182, 212, 0.2);
}

/* Form Styling for Dark Theme */
.hero-glass-card .form-control {
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(6, 182, 212, 0.3) !important;
  color: #ffffff !important;
  transition: all 0.3s ease;
}

.hero-glass-card .form-control:focus {
  background: rgba(15, 23, 42, 0.8) !important;
  border-color: #06b6d4 !important;
  box-shadow: 0 0 0 0.2rem rgba(6, 182, 212, 0.25) !important;
  color: #ffffff !important;
}

.hero-glass-card .form-control::placeholder {
  color: #94a3b8;
}

.hero-glass-card .form-check-input {
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(6, 182, 212, 0.3) !important;
}

.hero-glass-card .form-check-input:checked {
  background-color: #06b6d4 !important;
  border-color: #06b6d4 !important;
}

.hero-glass-card .form-check-input:focus {
  border-color: #06b6d4 !important;
  box-shadow: 0 0 0 0.25rem rgba(6, 182, 212, 0.25) !important;
}

/* CTA Button */
.hero-cta-btn {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
  border: none;
  color: #fff;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.hero-cta-btn:hover {
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  color: #fff;
}

.hero-cta-btn:active {
  transform: translateY(0);
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
  .hero-dark-professional {
    min-height: auto;
    padding: 3rem 0;
  }
  
  .hero-typewriter {
    min-width: 180px;
    font-size: 1.5rem;
  }
  
  .display-4 {
    font-size: 2rem;
  }
  
  .display-6 {
    font-size: 1.5rem;
  }
  
  .trust-badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }
  
  .hero-glass-card {
    margin-top: 2rem;
  }
}

@media (max-width: 576px) {
  .hero-dark-professional {
    padding: 2rem 0;
  }
  
  .display-4 {
    font-size: 1.75rem;
  }
  
  .display-6 {
    font-size: 1.25rem;
  }
  
  .hero-typewriter {
    min-width: 150px;
    font-size: 1.25rem;
  }
  
  .trust-badge {
    font-size: 0.7rem;
    padding: 0.35rem 0.7rem;
  }
  
  .trust-badge i {
    font-size: 0.85rem;
  }
  
  .hero-glass-card {
    padding: 1rem !important;
  }
  
  .hero-glass-card .card-body {
    padding: 1rem !important;
  }
  
  .hero-cta-btn {
    width: 100%;
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* Old Wave Background - Keep for other sections */
.wave-bg {
  background: linear-gradient(45deg, 
    #60A5FA,   /* Blue-400 */
    #6dabf2,   /* Lighter purple */
    rgba(167, 139, 250, 0.7)   /* Violet-400 */
  );
  background-size: 200% 200%;
  animation: backgroundWave 15s ease-in-out infinite;
}

@keyframes backgroundWave {
  0% {
      background-position: 0% 25%;
  }
  25% {
      background-position: 50% 50%;
  }
  50% {
      background-position: 100% 75%;
  }
  75% {
      background-position: 50% 50%;
  }
  100% {
      background-position: 0% 25%;
  }
}


.form-control {
  border: 1px solid rgba(0,0,0,0.15) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  width: 100%;
  font-size: 1rem;
}

/* Remove any special focus underline glow on inputs */
.form-control:focus {
  border-color: var(--primary-color) !important;
  outline: none;
  box-shadow: 0 0 0 0.15rem rgba(30, 58, 138, 0.15) !important;
}

.form-check-input {
  border: 1px solid rgba(0,0,0,0.2) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  width: 1.2em;
  height: 1.2em;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
  position: relative;
  margin-top: 0.25em;
}

.form-check-input:checked {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

.form-check-input:focus {
  outline: none;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 0.25rem rgba(30, 58, 138, 0.25); /* Based on your primary color */
}

.form-check-input:hover {
  transform: scale(1.05);
  border-color: var(--primary-color) !important;
}

.form-check-input:checked[type="checkbox"] {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check-label {
  margin-left: 0.5rem;
  font-size: 0.9rem;
  vertical-align: middle;
}

.form-check {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Chart section styling */
#predictions {
  background: #FAFBFC;
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 12px;
  margin: 0;
  padding: 2rem;
}

/* Mobile-first chart padding */
@media (max-width: 768px) {
  #predictions {
    padding: 1rem;
    border-radius: 10px;
  }
}

#marketBarometerChart {
  max-height: 400px;
}

/* Market chart container height control */
#market-chart-container {
  height: 400px;
}

/* Mobile chart height adjustment */
@media (max-width: 768px) {
  #marketBarometerChart {
    max-height: 350px;
  }
  
  #market-chart-container {
    height: 350px !important;
  }
}

/* Even taller for small phones */
@media (max-width: 576px) {
  #market-chart-container {
    height: 320px !important;
  }
}

/* Custom Legend Styling */
.legend-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--primary-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  user-select: none;
  min-width: 120px;
  margin: 2px;
  font-size: 0.85rem;
  text-align: left;
  width: auto;
}

.legend-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border-color: var(--secondary-color);
}

.legend-item.disabled {
  opacity: 0.5;
  background: #f8f9fa;
  border-color: #dee2e6;
}

.legend-item.disabled:hover {
  transform: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border-color: #dee2e6;
}

.legend-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.legend-label {
  font-weight: 500;
  color: var(--text-color-dark);
  margin-right: auto;
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.legend-toggle {
  margin-left: 6px;
  color: var(--primary-color);
  font-size: 0.9rem;
}

.legend-item.disabled .legend-label {
  color: #6c757d;
}

.legend-item.disabled .legend-toggle {
  color: #6c757d;
}

/* Enhanced responsive legend adjustments */
@media (max-width: 768px) {
  .legend-item {
    padding: 10px 14px;
    margin: 3px 1px;
    min-width: 140px;
    max-width: calc(50% - 6px);
    font-size: 0.9rem;
    border-radius: 8px;
    justify-content: flex-start;
    text-align: left;
  }
  
  .legend-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }
  
  .legend-indicator {
    width: 12px;
    height: 12px;
    margin-right: 10px;
    flex-shrink: 0;
  }
  
  .legend-toggle {
    margin-left: 8px;
    font-size: 1rem;
    flex-shrink: 0;
  }
  
  /* Stack legend items in a more compact grid on mobile */
  #custom-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
  }
  
  /* Apply same legend improvements to ALL ticker chart legends */
  [id$="-legend"] {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
  }
  
  /* Enhanced legend items for all charts - readable but compact */
  .legend-item {
    padding: 10px 14px;
    margin: 3px 1px;
    min-width: 140px;
    max-width: calc(50% - 6px);
    font-size: 0.9rem;
    border-radius: 8px;
    justify-content: flex-start;
    text-align: left;
  }
  
  /* Make legend indicators properly visible */
  .legend-item .legend-indicator {
    width: 12px;
    height: 12px;
    margin-right: 10px;
    flex-shrink: 0;
  }
  
  .legend-item .legend-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }
  
  /* Even more compact for very small screens */
  @media (max-width: 576px) {
    .legend-item {
      padding: 12px 16px;
      margin: 4px 2px;
      min-width: 160px;
      max-width: calc(100% - 8px);
      font-size: 0.95rem;
      justify-content: flex-start;
      text-align: left;
    }
    
    .legend-label {
      font-size: 0.9rem;
      font-weight: 600;
      text-align: left;
    }
    
    .legend-indicator {
      width: 14px;
      height: 14px;
      margin-right: 12px;
    }
    
    .legend-toggle {
      font-size: 1.1rem;
      margin-left: 10px;
    }
    
    #custom-legend,
    [id$="-legend"] {
      flex-direction: column;
      align-items: stretch;
      gap: 6px;
    }
  }
}

/* Magnificent Seven Section Styling */
#magnificent-seven {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

/* Mobile-first magnificent seven padding */
@media (max-width: 768px) {
  #magnificent-seven {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

#magnificent-seven .nav-pills .nav-link {
  color: var(--text-color-dark);
  background: white;
  border: 1px solid rgba(0,0,0,0.1);
  margin: 0 2px;
  border-radius: 20px;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 600;
}

#magnificent-seven .nav-pills .nav-link:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#magnificent-seven .nav-pills .nav-link.active {
  background: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.3); /* Match new secondary color shadow */
}

/* Magnificent Seven Chart Cards */
.magnificent-seven-chart .card-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 2px solid var(--primary-color);
}

.magnificent-seven-chart .card-body {
  padding: 1.5rem;
}

/* Mobile-specific Magnificent Seven improvements */
@media (max-width: 768px) {
  .magnificent-seven-chart .card-header {
    padding: 0.3rem;
  }
  
  .magnificent-seven-chart .card-body {
    padding: 0.3rem;
  }
  
  .magnificent-seven-chart .card-header h4 {
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
  }
  
  .magnificent-seven-chart .card-header .row {
    text-align: center;
  }
  
  .magnificent-seven-chart .card-header .col-md-8,
  .magnificent-seven-chart .card-header .col-md-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .magnificent-seven-chart .card-header .col-md-4 {
    margin-top: 0.15rem;
  }
  
  /* Drastically reduce chart container height on mobile */
  .magnificent-seven-chart .card-body > div[style*="height: 400px"] {
    height: 80px !important;
  }
  
  /* Make chart info more compact */
  .magnificent-seven-chart .card-header p {
    font-size: 0.7rem;
    margin-bottom: 0.1rem;
  }
  
  .magnificent-seven-chart .card-header .text-muted {
    font-size: 0.65rem;
  }
  
  /* Remove any extra margins from chart cards */
  .magnificent-seven-chart {
    margin-bottom: 0.75rem !important;
  }
}

/* Extra compact for very small screens */
@media (max-width: 576px) {
  .magnificent-seven-chart .card-header {
    padding: 0.25rem;
  }
  
  .magnificent-seven-chart .card-body {
    padding: 0.25rem;
  }
  
  .magnificent-seven-chart .card-header h4 {
    font-size: 0.75rem;
  }
  
  /* Even smaller chart height for phones */
  .magnificent-seven-chart .card-body > div[style*="height: 400px"] {
    height: 60px !important;
  }
  
  .magnificent-seven-chart .card-header p {
    font-size: 0.65rem;
    margin-bottom: 0.05rem;
  }
  
  .magnificent-seven-chart .card-header .text-muted {
    font-size: 0.6rem;
  }
  
  /* Make cards extremely compact */
  .magnificent-seven-chart {
    margin-bottom: 0.5rem !important;
  }
}

/* Tab Content Animation */
.tab-pane {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tab-pane.show.active {
  opacity: 1;
}

/* Loading Animation */
#magnificent-seven-loading .spinner-border {
  width: 3rem;
  height: 3rem;
  color: var(--primary-color);
}

/* Chart Stats Styling */
.chart-stats {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
}

.chart-stats .stat-item {
  text-align: center;
  padding: 0.5rem;
}

.chart-stats .stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary-color);
}

.chart-stats .stat-label {
  font-size: 0.8rem;
  color: var(--text-color-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Enhanced Mobile Responsive Adjustments */
@media (max-width: 768px) {
  #magnificent-seven .nav-pills .nav-link {
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
    margin: 1px;
    border-radius: 15px;
    white-space: nowrap;
  }
  
  #magnificent-seven .nav-pills {
    gap: 0.15rem;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .chart-stats {
    padding: 0.5rem;
  }
  
  .chart-stats .stat-value {
    font-size: 0.9rem;
  }
  
  .chart-stats .stat-label {
    font-size: 0.65rem;
  }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 576px) {
  #predictions {
    padding: 0.5rem;
    margin: 0 -0.25rem;
  }
  
  #marketBarometerChart {
    max-height: 280px;
  }
  
  .legend-item {
    padding: 4px 8px;
    min-width: 80px;
    font-size: 0.7rem;
    min-height: 32px;
  }
  
  .legend-label {
    font-size: 0.65rem;
  }
  
  .legend-indicator {
    width: 6px;
    height: 6px;
  }
  
  #magnificent-seven .nav-pills .nav-link {
    font-size: 0.6rem;
    padding: 0.25rem 0.4rem;
  }
  
  #magnificent-seven {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
  }
  
  /* Responsive chart card body - more aggressive */
  .card-body {
    padding: 0.25rem !important;
  }
  
  .card-body[style*="height: 400px"] {
    height: 60px !important;
  }
  
  /* Reduce spacing around chart sections */
  .magnificent-seven-chart {
    margin-bottom: 0.5rem !important;
  }
  
  .magnificent-seven-chart .card {
    border-radius: 6px;
  }
  
  /* Make chart stats more compact */
  .chart-stats {
    padding: 0.15rem;
    margin-top: 0.15rem;
  }
  
  .chart-stats .stat-item {
    padding: 0.1rem;
  }
  
  .chart-stats .stat-value {
    font-size: 0.75rem;
  }
  
  .chart-stats .stat-label {
    font-size: 0.6rem;
  }
}

/* SEO Content Styling */
.seo-content {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  border-left: 4px solid var(--secondary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.seo-content h5 {
  color: var(--primary-color);
  margin-bottom: 0.75rem;
}

.seo-content ul li {
  margin-bottom: 0.5rem;
}

.seo-content .alert {
  margin-top: 1rem;
  border: none;
  border-left: 4px solid #17a2b8;
}

/* Suggestions dropdown for ticker search */
#suggestions.list-group {
  border: 1px solid rgba(0,0,0,0.1);
  border-top: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* When suggestions are hidden or empty, ensure no residual line appears */
#suggestions.list-group.d-none { display: none !important; border: 0 !important; box-shadow: none !important; }

/* ============================================
   HOW-TO-USE INSTRUCTIONS BOX (Tools Pages)
   ============================================ */
.how-to-use {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
}
.how-to-use .step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.how-to-use .step:last-child {
  margin-bottom: 0;
}
.how-to-use .step-number {
  background: var(--primary-color);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.how-to-use .step-text {
  font-size: 0.78rem;
  color: var(--text-color-light);
  line-height: 1.4;
}

/* ============================================
   FOOTER
   ============================================ */
.analysis-card {
  background: #f8fafc;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.analysis-card a {
  color: var(--text-color-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ============================================
   GLOBAL CARD POLISH
   ============================================ */
.card {
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
  background: #f8fafc;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* ============================================
   SEGMENTED CONTROLS
   ============================================ */
.segmented-control .btn {
  transition: all 0.2s ease;
  border: none;
}
.segmented-control .btn.active {
  background: white;
  color: var(--text-color-dark) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.segmented-control .btn:not(.active):hover {
  background: rgba(0,0,0,0.05);
}

/* ============================================================
   TOOLS PAGES — MODERN RESTYLE (match the app product pages)
   Visual only, scoped to body.tools-page (set in base.html for
   /tools/*). Restyles the shared hero + cards across the tools
   index and every calculator page without touching any template
   markup or content. Mirrors the .spd-hero look from
   product-page.css (dark navy + animated grid + gold accent).
   ============================================================ */

/* Dark professional hero — replaces the old light "wave" gradient.
   Hero text on these pages is already white, so it reads cleanly. */
.tools-page .wave-bg {
  position: relative;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
  animation: none !important;
}
.tools-page .wave-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.10) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
  opacity: 0.35;
  pointer-events: none;
}
.tools-page .wave-bg .container,
.tools-page .wave-bg .container-xxl,
.tools-page .wave-bg .container-fluid {
  position: relative;
  z-index: 1;
}
/* Signature gold accent bar under the hero title */
.tools-page .wave-bg h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin: 0.85rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--secondary-color), #f59e0b);
}
/* Breadcrumb divider readable on the dark hero */
.tools-page .wave-bg .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.5);
}

/* Softer, modern card shadows across all tool pages */
.tools-page main .card {
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
}
.tools-page main .card.shadow-sm,
.tools-page main .card.shadow {
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.07) !important;
}

/* Tools index — modern tool cards + section headings */
.tools-page .tool-card {
  border-radius: 16px !important;
  border: 1px solid rgba(15, 23, 42, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.tools-page .tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12) !important;
  border-color: rgba(30, 58, 138, 0.18);
}
.tools-page .category-header h2 {
  color: var(--primary-color);
}


/* ───────────────────────────────────────────────────────────────
   Mobile app cards
   Styles for the shared {% app_store_links style='card' %} partial.
   These lived inline in home.html, which meant the partial rendered
   unstyled on every other page that used it. The partial is shared,
   so its styles belong somewhere shared too.
   ─────────────────────────────────────────────────────────────── */
/* ── Mobile apps grid ── */
.app-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}
.app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.09);
    border-color: rgba(30, 58, 138, 0.12);
}
.app-card .app-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.app-card .store-badge { transition: opacity 0.2s ease; }
.app-card .store-badge:hover { opacity: 0.85; }


/* ───────────────────────────────────────────────────────────────
   App showcase
   Replaces the paywall overlays. Deliberately a normal section of
   the page: bordered, on the page background, sitting after the
   content rather than over it. An overlay reads as a gate whatever
   it says, which is the thing being removed.
   ─────────────────────────────────────────────────────────────── */
.app-showcase {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    /* Capped and centred: stretched across a 1400px container the text used
       barely half the width and the rest read as a gap rather than a block. */
    max-width: 820px;
    margin-inline: auto;
    background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
    border: 1px solid rgba(30, 58, 138, 0.10);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}
.app-showcase-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}
.app-showcase-body { min-width: 0; }
/* A step above body text, never headline-sized: this block sits inside
   other content and must not compete with the section heading above it. */
.app-showcase-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 0.35rem;
}
.app-showcase-text {
    font-size: 0.95rem;
    color: #475569;
    margin: 0 0 1rem;
    max-width: 52ch;
}
.app-showcase-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
.app-showcase-more {
    display: inline-block;
    margin-top: 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
}
@media (max-width: 575.98px) {
    .app-showcase {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.25rem;
    }
    .app-showcase-badges { justify-content: center; }
    .app-showcase-text { margin-left: auto; margin-right: auto; }
}


/* ───────────────────────────────────────────────────────────────
   Tools sidebar app cards
   The inline styles these replace were repeated per card, and the
   "Learn more" link sat at a different height in every one because
   the taglines wrap to different numbers of lines. A min-height on
   the tagline lines them up.
   ─────────────────────────────────────────────────────────────── */
.app-promo-sidebar { box-shadow: 0 4px 15px rgba(102, 51, 153, 0.15); }
.app-promo-sidebar .card-header {
    background: linear-gradient(135deg, #663399 0%, #8B5CF6 100%);
}
.app-promo-sidebar .card-body {
    background: linear-gradient(180deg, rgba(102, 51, 153, 0.03) 0%, rgba(255, 255, 255, 1) 100%);
}
.app-promo-card {
    background-color: rgba(102, 51, 153, 0.06);
    border-left: 3px solid #8B5CF6;
}
.app-promo-name {
    font-size: 1.02rem;
    font-weight: 700;
    color: #4c1d95;
    line-height: 1.25;
}
.app-promo-tagline {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.3;
    min-height: 2.6em;          /* two lines, so every card aligns */
}
.app-promo-more {
    font-size: 0.875rem;
    font-weight: 600;
    color: #663399;
}
.app-promo-badges { margin-top: 0.5rem; padding-left: 52px; }
@media (max-width: 575.98px) {
    .app-promo-badges { padding-left: 0; }
    .app-promo-tagline { min-height: 0; }
}
