/**
 * RTB Domains - Marketing Website Styles
 * Color scheme matches control panel aesthetic
 * Enhanced with comprehensive mobile/responsive fixes (32 improvements)
 */

/* ============================================================================
   CSS Variables
   ============================================================================ */

:root {
  /* Brand Colors - Match control panel */
  --color-navy: #2c5282;
  --color-navy-dark: #1e3a5f;
  --color-navy-light: #4a90e2;
  --color-taupe: #a89f91;
  --color-moss: #5d6b3d;
  --color-brick: #a85751;
  --color-cream: #F9F8F6;
  --color-beige: #EFE9E3;
  --color-border: #D9CFC7;
  --color-border-dark: #C9B59C;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #D9CFC7 0%, #C9B59C 100%);
  --gradient-hero: linear-gradient(135deg, #F9F8F6 0%, #EFE9E3 100%);
  --gradient-custom: linear-gradient(135deg, #2c5282 0%, #1e3a5f 100%);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.15);

  /* Spacing */
  --section-padding: 5rem;
  --max-width: 1200px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Transitions */
  --transition-base: all 0.3s ease;
}

/* ============================================================================
   Base Styles
   ============================================================================ */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--color-cream);
  color: #333;
  line-height: 1.6;
}

/* Bootstrap overrides for custom colors */
.text-primary {
  color: var(--color-navy) !important;
}

.bg-primary {
  background-color: var(--color-navy) !important;
}

.btn-primary {
  background-color: var(--color-navy);
  border-color: var(--color-navy);
}

.btn-primary:hover {
  background-color: var(--color-navy-dark);
  border-color: var(--color-navy-dark);
}

/* ============================================================================
   Custom Components
   ============================================================================ */

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-brick) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Custom Buttons */
.btn-custom-primary {
  background: var(--color-brick);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: var(--transition-base);
}

.btn-custom-primary:hover {
  background: #8d4741;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(168, 87, 81, 0.3);
  color: white;
}

.btn-outline-custom {
  background: transparent;
  color: var(--color-navy);
  border: 2px solid var(--color-navy);
  padding: 0.75rem 2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: var(--transition-base);
}

.btn-outline-custom:hover {
  background: var(--color-navy);
  color: white;
  transform: translateY(-2px);
}

/* ============================================================================
   Navigation
   ============================================================================ */

.navbar {
  background: white !important;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-navy);
}

.nav-link {
  color: #6b7280 !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--color-navy) !important;
}

/* ============================================================================
   Hero Section with Background Image
   ============================================================================ */

.hero-section-bg {
  position: relative;
  background-image: url('../images/hero-graphic.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  padding: 8rem 0;
  min-height: 95vh;
  display: flex;
  align-items: center;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(28, 58, 95, 0.92) 0%, rgba(44, 82, 130, 0.85) 50%, rgba(168, 87, 81, 0.88) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 3rem 0;
}

.hero-section-bg h1 {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.02em;
}

.hero-highlight {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.text-white-75 {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-weight: 400;
}

/* Hero Buttons */
.btn-hero-primary {
  background: linear-gradient(135deg, #a85751 0%, #8d4741 100%);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.875rem 2.5rem;
  border-radius: 50px;
  box-shadow: 0 8px 24px rgba(168, 87, 81, 0.4);
  transition: all 0.3s ease;
}

.btn-hero-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(168, 87, 81, 0.5);
  background: linear-gradient(135deg, #8d4741 0%, #a85751 100%);
  color: white;
}

.btn-hero-outline {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.875rem 2.5rem;
  border-radius: 50px;
  transition: all 0.3s ease;
}

.btn-hero-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-3px);
  color: white;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.2);
}

.hero-stat {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.hero-stat:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.3);
}

.min-vh-85 {
  min-height: 85vh;
  display: flex;
  align-items: center;
}

/* ============================================================================
   Trust Bar
   ============================================================================ */

.trust-bar {
  background: white;
}

.trust-metric {
  padding: 1rem;
}

.trust-metric .h2 {
  color: var(--color-navy);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* ============================================================================
   Feature Cards
   ============================================================================ */

.bg-light-custom {
  background: var(--color-beige) !important;
}

.section-padding {
  padding: var(--section-padding) 0;
}

.feature-card {
  background: white;
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
  border: 1px solid var(--color-border);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-navy);
}

.feature-icon {
  width: 70px;
  height: 70px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-icon i {
  font-size: 2rem;
  color: var(--color-navy);
}

.bg-gradient-primary {
  background: var(--gradient-primary);
}

/* ============================================================================
   Flow Diagram
   ============================================================================ */

.flow-step {
  position: relative;
  padding: 1.5rem;
}

.flow-icon {
  width: 80px;
  height: 80px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.flow-icon i {
  font-size: 2rem;
  color: var(--color-navy);
}

.flow-number {
  position: absolute;
  top: 0;
  right: 2rem;
  width: 32px;
  height: 32px;
  background: var(--color-brick);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

/* ============================================================================
   Code Blocks
   ============================================================================ */

pre {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  margin: 0;
  max-width: 100%;
}

pre code {
  color: #ecf0f1;
  background: none;
}

code {
  background: #f4f4f4;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--color-brick);
  font-size: 0.9em;
  font-family: 'Monaco', 'Courier New', monospace;
  word-break: break-word;
}

/* ============================================================================
   Metrics Section
   ============================================================================ */

.bg-gradient-custom {
  background: var(--gradient-custom);
}

.metric-card {
  padding: 2rem 1rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: var(--transition-base);
}

.metric-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.metric-card .display-3 {
  font-size: 3rem;
}

/* ============================================================================
   Pricing Section
   ============================================================================ */

.pricing-card-popular {
  transform: scale(1.05);
  position: relative;
  z-index: 2;
}

/* ============================================================================
   Security Section
   ============================================================================ */

.security-features .d-flex {
  padding: 1rem;
  border-radius: var(--radius-md);
  transition: var(--transition-base);
}

.security-features .d-flex:hover {
  background: var(--color-beige);
}

/* ============================================================================
   Use Cases
   ============================================================================ */

.use-case-card {
  text-align: center;
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: white;
  border: 1px solid var(--color-border);
  transition: var(--transition-base);
}

.use-case-card:hover {
  border-color: var(--color-navy);
  box-shadow: var(--shadow-md);
  transform: translateY(-5px);
}

/* ============================================================================
   Testimonials & Customer Logos
   ============================================================================ */

.avatar-placeholder {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--color-navy);
  font-size: 1.1rem;
}

.customer-logo {
  padding: 1rem;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.customer-logo:hover {
  opacity: 1;
}

/* ============================================================================
   Utilities
   ============================================================================ */

.min-vh-75 {
  min-height: 75vh;
}

.letter-spacing {
  letter-spacing: 0.1em;
}

/* ============================================================================
   Contact Section
   ============================================================================ */

.contact-info .d-flex {
  margin-bottom: 2rem;
}

/* ============================================================================
   Animations
   ============================================================================ */

.fade-in {
  animation: fadeIn 0.8s ease-out;
}

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

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger animation delays */
.reveal:nth-child(1) { transition-delay: 0.1s; }
.reveal:nth-child(2) { transition-delay: 0.2s; }
.reveal:nth-child(3) { transition-delay: 0.3s; }
.reveal:nth-child(4) { transition-delay: 0.4s; }
.reveal:nth-child(5) { transition-delay: 0.5s; }
.reveal:nth-child(6) { transition-delay: 0.6s; }

/* ============================================================================
   Footer
   ============================================================================ */

.footer {
  background: #1f2937;
  color: #d1d5db;
}

.footer h5, .footer h6 {
  color: white;
  font-weight: 600;
}

.footer a {
  color: #9ca3af !important;
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: #fbbf24 !important;
}

/* ============================================================================
   RESPONSIVE DESIGN - COMPREHENSIVE MOBILE FIXES
   ============================================================================ */

/* Tablet Specific (768px-991px) - iPad optimization */
@media (max-width: 991px) and (min-width: 768px) {
  /* Fix 1: Tablet hero font scaling */
  .hero-section-bg h1 {
    font-size: 3.5rem;
  }

  /* Fix 16: Metric cards on iPad */
  .metric-card {
    padding: 1.75rem 1rem;
  }

  .metric-card .display-3 {
    font-size: 2.5rem;
  }

  /* Better spacing for two-column layouts */
  .col-lg-6 {
    margin-bottom: 2rem;
  }

  /* Flow steps better layout */
  .flow-step {
    padding: 1.25rem;
  }
}

/* Tablet and below (991px) */
@media (max-width: 991px) {
  /* Fix 2 & 17: Hero section optimization */
  .hero-section-bg {
    padding: 5rem 0;
    min-height: 80vh;
    background-attachment: scroll; /* Better mobile performance */
  }

  .min-vh-85 {
    min-height: auto;
  }

  /* Fix 14: Mobile navigation menu */
  .navbar-collapse {
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    margin-top: 0.5rem;
  }

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

  .navbar-toggler:focus {
    box-shadow: none;
    border-color: var(--color-navy);
  }

  .nav-link {
    padding: 0.5rem 0 !important;
    border-bottom: 1px solid transparent;
  }

  .nav-link:hover {
    border-bottom-color: var(--color-navy);
  }

  /* Fix 12: Pricing card on tablet */
  .pricing-card-popular {
    transform: scale(1) !important;
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
  }

  /* Fix 13: Security/Contact sections stack on tablets */
  .security-features .col-lg-6,
  .contact-info .col-lg-6 {
    margin-bottom: 2rem;
  }

  /* Fix 9: Flow steps on tablet */
  .flow-step {
    margin-bottom: 2rem;
  }

  .flow-number {
    right: 1rem;
    top: -0.25rem;
  }

  /* General section padding */
  .section-padding {
    padding: 4rem 0;
  }
}

/* Mobile specific (<768px) */
@media (max-width: 767px) {
  /* Hero adjustments for mobile */
  .hero-section-bg {
    padding: 4rem 0;
    min-height: 70vh;
  }

  .hero-section-bg h1 {
    font-size: 2.5rem;
  }

  /* Feature cards mobile */
  .feature-card {
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
  }

  /* Trust metrics mobile */
  .trust-metric {
    padding: 0.75rem;
    text-align: center;
  }

  .trust-metric .h2 {
    font-size: 2rem;
  }

  /* Use case cards mobile */
  .use-case-card {
    padding: 1.75rem 1.25rem;
    margin-bottom: 1.5rem;
  }

  .use-case-card .fs-1 {
    font-size: 2.25rem !important;
  }
}

/* Small Mobile specific (<576px) */
@media (max-width: 575px) {
  /* Fix 1 & 3: Hero mobile optimization */
  .hero-section-bg h1 {
    font-size: 2rem !important;
    line-height: 1.2;
    margin-bottom: 1.5rem;
  }

  .hero-content {
    padding: 1.5rem 0;
  }

  /* Fix 3 & 4: Hero buttons mobile */
  .btn-hero-primary,
  .btn-hero-outline {
    font-size: 0.95rem;
    padding: 0.65rem 1.5rem !important;
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
  }

  /* Remove margin from last button */
  .hero-content .d-flex {
    flex-direction: column;
    gap: 0;
  }

  .hero-content .btn:last-child {
    margin-bottom: 0;
  }

  /* Fix 5: Hero stats mobile */
  .hero-stat {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .hero-stat .display-4 {
    font-size: 2rem;
  }

  .hero-stat small {
    font-size: 0.875rem;
  }

  /* Fix 6: Trust metrics mobile */
  .trust-metric .h2 {
    font-size: 1.75rem;
  }

  .trust-metric small {
    font-size: 0.8rem;
  }

  /* Fix 7 & 8: Feature cards mobile */
  .feature-card {
    padding: 1.25rem 1rem;
  }

  .feature-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 1rem;
  }

  .feature-icon i {
    font-size: 1.5rem;
  }

  /* Fix 10: Flow icons mobile */
  .flow-step {
    padding: 1rem;
  }

  .flow-icon {
    width: 60px;
    height: 60px;
  }

  .flow-icon i {
    font-size: 1.5rem;
  }

  .flow-number {
    right: 0.5rem;
    top: -0.5rem;
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  /* Fix 11: Code blocks mobile */
  pre {
    font-size: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  code {
    font-size: 0.75rem;
  }

  /* Metric cards mobile */
  .metric-card {
    padding: 1.5rem 0.5rem;
    margin-bottom: 1rem;
  }

  .metric-card .display-3 {
    font-size: 2rem;
  }

  .metric-card p {
    font-size: 0.9rem;
  }

  /* Use case cards mobile */
  .use-case-card {
    padding: 1.5rem;
  }

  .use-case-card .fs-1 {
    font-size: 2rem !important;
  }

  /* Contact info mobile */
  .contact-info .d-flex {
    margin-bottom: 1.5rem;
    flex-direction: column;
    text-align: center;
  }

  .contact-info .fs-3 {
    font-size: 1.75rem !important;
    margin-bottom: 0.5rem;
  }

  /* Fix 14: Navbar mobile */
  .navbar-brand {
    font-size: 1.25rem;
  }

  .navbar-brand i {
    font-size: 1.25rem;
  }

  /* Fix 15: Section padding mobile */
  .section-padding {
    padding: 3rem 0;
  }

  /* Pricing cards mobile */
  .pricing-card {
    margin-bottom: 1.5rem;
  }

  /* Footer mobile */
  .footer {
    text-align: center;
  }

  .footer .col-md-3 {
    margin-bottom: 2rem;
  }

  .footer h5,
  .footer h6 {
    margin-top: 1.5rem;
  }
}

/* Very small mobile (< 376px) */
@media (max-width: 375px) {
  /* Container padding for very small screens */
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Even smaller section padding */
  .section-padding {
    padding: 2rem 0;
  }

  /* Smaller fonts for tiny screens */
  .hero-section-bg h1 {
    font-size: 1.75rem !important;
  }

  .lead {
    font-size: 1rem;
  }

  .contact-info .fs-3 {
    font-size: 1.5rem !important;
  }

  /* Adjust button sizes */
  .btn-hero-primary,
  .btn-hero-outline {
    font-size: 0.875rem;
    padding: 0.5rem 1rem !important;
  }

  /* Smaller metric displays */
  .metric-card .display-3 {
    font-size: 1.75rem;
  }

  .hero-stat .display-4 {
    font-size: 1.75rem;
  }

  /* Smaller trust metrics */
  .trust-metric .h2 {
    font-size: 1.5rem;
  }
}

/* Landscape mobile adjustments */
@media (max-width: 767px) and (orientation: landscape) {
  .hero-section-bg {
    min-height: 100vh;
    padding: 3rem 0;
  }

  .hero-section-bg h1 {
    font-size: 2rem;
  }

  .hero-stat {
    padding: 0.75rem;
  }
}

/* High resolution mobile (retina) optimizations */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
  /* Ensure sharp borders and shadows */
  .feature-card,
  .use-case-card,
  .pricing-card {
    border-width: 0.5px;
  }

  /* Optimize backdrop filters for performance */
  .hero-stat,
  .metric-card {
    -webkit-backdrop-filter: blur(10px);
  }
}

/* Print styles */
@media print {
  .navbar,
  .btn,
  .footer {
    display: none !important;
  }

  .hero-section-bg {
    background: none;
    padding: 2rem 0;
    min-height: auto;
  }

  .section-padding {
    padding: 2rem 0;
  }
}

/* ============================================================================
   Smooth Scrolling
   ============================================================================ */

html {
  scroll-behavior: smooth;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================================
   Loading States
   ============================================================================ */

.loading {
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-navy);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================================
   Dashboard Mockup Section
   ============================================================================ */

#dashboard .card-header {
  font-size: 0.95rem;
}

#dashboard .progress {
  border-radius: var(--radius-sm);
}

#dashboard .progress-bar {
  transition: width 1s ease-out;
}

/* Simulated chart bars animation */
#dashboard .bg-primary[style*="height"] {
  transition: height 0.5s ease-out;
  border-radius: 4px 4px 0 0;
}

/* ============================================================================
   NEW Feature Badges
   ============================================================================ */

.badge.bg-success.small {
  font-size: 0.65rem;
  padding: 0.25em 0.5em;
  vertical-align: middle;
  margin-left: 0.5rem;
}

/* ============================================================================
   Improved Flow Step Display (6 steps)
   ============================================================================ */

@media (max-width: 991px) {
  #how-it-works .flow-step {
    margin-bottom: 1rem;
  }

  #how-it-works .flow-step .flow-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  #how-it-works .flow-number {
    font-size: 0.75rem;
    width: 20px;
    height: 20px;
  }
}

/* ============================================================================
   9 Feature Cards Layout
   ============================================================================ */

/* Make feature cards slightly smaller for 9-up layout */
@media (min-width: 992px) {
  #features .feature-card {
    padding: 1.75rem;
  }

  #features .feature-card h3 {
    font-size: 1.1rem;
  }

  #features .feature-card p {
    font-size: 0.9rem;
  }
}

/* ============================================================================
   Better Mobile Touch Targets
   ============================================================================ */

@media (max-width: 767px) {
  /* Larger tap targets for accordion buttons */
  .accordion-button {
    padding: 1rem 1.25rem;
    font-size: 1rem;
  }

  /* Better touch targets for nav links */
  .nav-link {
    padding: 0.75rem 1rem !important;
  }

  /* Dashboard mockup mobile */
  #dashboard .card-body {
    padding: 1.25rem;
  }

  #dashboard .h4 {
    font-size: 1.25rem;
  }

  /* Click flow cards mobile */
  #how-it-works .bg-light.rounded.p-3 {
    padding: 1rem !important;
  }
}

/* ============================================================================
   Testimonial Improvements
   ============================================================================ */

.text-muted.small i.bi-info-circle {
  color: var(--color-navy);
}