/* ==========================================================================
   Responsive Styles for casinoenlineabono.com
   Mobile-first breakpoints
   ========================================================================== */

/* ==========================================================================
   Base Mobile Styles (Default - < 640px)
   ========================================================================== */

/* Typography adjustments for mobile */
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }

/* Mobile container padding */
.container {
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

/* Stack all grids on mobile */
.grid-cards {
  grid-template-columns: 1fr;
}

/* Full width buttons on mobile */
.btn-mobile-full {
  width: 100%;
}

/* Adjust hero for mobile */
.hero {
  padding: var(--space-xl) 0;
}

.hero__title {
  font-size: var(--text-2xl);
}

.hero__subtitle {
  font-size: var(--text-base);
  padding: 0 var(--space-sm);
}

/* Mobile-friendly tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Casino cards stack on mobile */
.casino-card {
  flex-direction: column;
}

.casino-card__logo {
  width: 100%;
  padding: var(--space-xl);
}

.casino-card__bonus {
  border-left: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Simplified footer on mobile */
.footer__grid {
  grid-template-columns: 1fr;
  text-align: center;
}

.footer__brand {
  max-width: 100%;
}

/* ==========================================================================
   Small Tablets (640px+)
   ========================================================================== */

@media (min-width: 640px) {
  /* Typography */
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }

  /* Container */
  .container {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }

  /* 2-column grids */
  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Hero adjustments */
  .hero {
    padding: var(--space-2xl) 0;
  }

  .hero__title {
    font-size: var(--text-3xl);
  }

  /* Footer 2-column */
  .footer__grid {
    grid-template-columns: repeat(2, 1fr);
    text-align: left;
  }

  /* Pros/Cons side by side */
  .pros-cons {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Inline buttons */
  .btn-group {
    display: flex;
    gap: var(--space-sm);
  }

  .btn-mobile-full {
    width: auto;
  }
}

/* ==========================================================================
   Tablets (768px+)
   ========================================================================== */

@media (min-width: 768px) {
  /* Typography */
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
  h4 { font-size: var(--text-xl); }

  /* Container */
  .container {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }

  /* 3-column grids */
  .grid-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Hero */
  .hero {
    padding: var(--space-3xl) 0;
  }

  .hero__title {
    font-size: var(--text-4xl);
  }

  .hero__subtitle {
    font-size: var(--text-lg);
  }

  /* Casino cards horizontal */
  .casino-card {
    flex-direction: row;
    align-items: center;
  }

  .casino-card__logo {
    width: 180px;
    flex-shrink: 0;
  }

  .casino-card__bonus {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-top: none;
    min-width: 180px;
  }

  /* TOC side layout option */
  .article-with-toc {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-xl);
  }

  .article-with-toc .toc {
    position: sticky;
    top: calc(var(--header-height) + var(--space-md));
    height: fit-content;
    margin-bottom: 0;
  }

  /* Footer bottom row */
  .footer__bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ==========================================================================
   Desktop (1024px+)
   ========================================================================== */

@media (min-width: 1024px) {
  /* Show desktop navigation */
  .header__nav {
    display: flex;
  }

  /* Hide mobile menu */
  .mobile-menu,
  .mobile-menu-btn {
    display: none;
  }

  /* 4-column grids */
  .grid-cards {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Main grid with sidebar */
  .main-grid {
    grid-template-columns: 1fr var(--sidebar-width);
  }

  .main-grid--reverse {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  /* Show sidebar */
  .sidebar {
    display: block;
  }

  /* Footer 4-column */
  .footer__grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }

  /* Category cards larger */
  .category-card {
    padding: var(--space-2xl);
    min-height: 200px;
  }

  .category-card__icon {
    width: 72px;
    height: 72px;
  }

  /* Casino card expanded info */
  .casino-card__logo {
    width: 200px;
  }

  .casino-card__bonus {
    min-width: 220px;
  }

  /* Hero section */
  .hero {
    padding: var(--space-3xl) 0 var(--space-2xl);
  }

  .hero__title {
    font-size: var(--text-5xl);
  }
}

/* ==========================================================================
   Large Desktop (1280px+)
   ========================================================================== */

@media (min-width: 1280px) {
  /* Wider container */
  .container {
    max-width: var(--container-xl);
  }

  /* Larger gaps */
  .grid-cards {
    gap: var(--space-lg);
  }

  /* Casino card even larger */
  .casino-card__logo {
    width: 220px;
  }

  .casino-card__bonus {
    min-width: 250px;
    padding: var(--space-xl);
  }

  .casino-card__bonus-value {
    font-size: var(--text-3xl);
  }
}

/* ==========================================================================
   Extra Large Desktop (1400px+)
   ========================================================================== */

@media (min-width: 1400px) {
  .container-2xl {
    max-width: var(--container-2xl);
  }

  /* 5-column option for category cards */
  .grid-categories {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ==========================================================================
   Touch Device Optimizations
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn {
    min-height: 48px;
  }

  /* Remove hover effects that don't work on touch */
  .card:hover {
    transform: none;
  }

  .btn:hover {
    transform: none;
  }

  /* Add active states instead */
  .card:active {
    transform: scale(0.98);
  }

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

  /* Ensure all links have enough spacing */
  .footer__link {
    padding: var(--space-xs) 0;
  }

  .mobile-menu__link {
    padding: var(--space-md) var(--space-lg);
  }
}

/* ==========================================================================
   High DPI / Retina Displays
   ========================================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Thinner borders for retina */
  .card,
  .btn-outline,
  .form-input,
  .form-textarea,
  .form-select {
    border-width: 0.5px;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  /* Hide non-essential elements */
  .header,
  .footer,
  .sidebar,
  .mobile-menu,
  .btn-cta,
  .carousel,
  .top-casinos-widget {
    display: none !important;
  }

  /* Reset backgrounds */
  body {
    background: white;
    color: black;
  }

  .card {
    background: white;
    border: 1px solid #ddd;
    box-shadow: none;
  }

  /* Ensure content is visible */
  .main-content {
    padding-top: 0;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  /* Show URLs for links */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Avoid page breaks in cards */
  .card,
  .casino-card {
    break-inside: avoid;
  }
}

/* ==========================================================================
   Landscape Mobile
   ========================================================================== */

@media (max-width: 767px) and (orientation: landscape) {
  /* Reduce hero height on landscape mobile */
  .hero {
    padding: var(--space-lg) 0;
  }

  .hero__title {
    font-size: var(--text-xl);
  }

  /* Smaller header */
  .header {
    height: 56px;
  }

  .main-content {
    padding-top: 56px;
  }

  /* Horizontal casino cards in landscape */
  .casino-card {
    flex-direction: row;
  }
}

/* ==========================================================================
   Safe Area Insets (Notched Devices)
   ========================================================================== */

@supports (padding: max(0px)) {
  .header {
    padding-left: max(var(--space-md), env(safe-area-inset-left));
    padding-right: max(var(--space-md), env(safe-area-inset-right));
  }

  .footer {
    padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom));
  }

  .mobile-menu {
    padding-left: max(var(--space-lg), env(safe-area-inset-left));
    padding-right: max(var(--space-lg), env(safe-area-inset-right));
    padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom));
  }
}

/* ==========================================================================
   Dark Mode Media Query (Auto Theme)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  /* Already dark by default, but this ensures consistency */
  :root {
    color-scheme: dark;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .carousel-row {
    animation: none;
  }

  .card,
  .btn,
  a {
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}
