/* ==========================================================================
   Responsive - Mobile-first breakpoints
   ========================================================================== */

/* ===== SMALL SCREENS (640px+) ===== */
@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .casino-card {
    flex-direction: row;
  }
  
  .casino-logo {
    width: 180px;
    flex-shrink: 0;
  }
  
  .casino-actions {
    flex-direction: row;
    justify-content: flex-start;
  }
  
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .pros-cons {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== MEDIUM SCREENS (768px+) ===== */
@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .container {
    padding: 0 var(--space-lg);
  }
  
  .layout-sidebar {
    grid-template-columns: 1fr 300px;
  }
  
  .sidebar {
    order: 2;
  }
  
  .content-area {
    order: 1;
  }
  
  .hero {
    padding: var(--space-3xl) 0;
  }

  .hero-content {
    flex-direction: row;
  }

  .hero-image {
    flex: 0 0 350px;
  }
  
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

/* ===== LARGE SCREENS (1024px+) ===== */
@media (min-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .nav-desktop {
    display: flex;
  }
  
  .mobile-menu-btn {
    display: none;
  }
  
  .mobile-menu {
    display: none;
  }
  
  .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
  }
  
  .layout-sidebar {
    grid-template-columns: 1fr 320px;
    gap: var(--space-2xl);
  }
  
  .sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
    align-self: start;
  }
}

/* ===== EXTRA LARGE SCREENS (1280px+) ===== */
@media (min-width: 1280px) {
  .container {
    padding: 0 var(--space-xl);
  }
  
  .grid-5 {
    grid-template-columns: repeat(5, 1fr);
  }
  
  .grid-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .header,
  .footer,
  .sidebar,
  .mobile-menu,
  .btn,
  .pagination {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  a {
    text-decoration: underline;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .carousel-row--1,
  .carousel-row--2,
  .carousel-row--3 {
    animation: none;
  }
}

/* ===== HIGH CONTRAST ===== */
@media (prefers-contrast: high) {
  :root {
    --color-text: #FFFFFF;
    --color-text-muted: #E0E0E0;
    --color-bg: #000000;
    --color-bg-light: #1A1A1A;
  }
  
  .btn,
  .card,
  .form-input {
    border-width: 2px;
  }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
  .btn:hover,
  .card:hover,
  .nav-link:hover {
    transform: none;
  }
  
  .btn,
  .nav-link,
  .page-link {
    min-height: 48px;
  }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .header {
    --header-height: 56px;
  }
  
  .mobile-menu {
    top: 56px;
  }
  
  .hero {
    padding: var(--space-xl) 0;
    min-height: auto;
  }

  .hero-content {
    flex-direction: column;
    text-align: center;
  }

  .hero-text {
    text-align: center;
  }

  .hero-image {
    flex: none;
    max-width: 280px;
    margin: 0 auto;
  }

  .hero-deco {
    opacity: 0.15;
  }

  .hero-deco-dice,
  .hero-deco-chip,
  .hero-deco-roulette {
    width: 50px;
  }

  .hero-deco-spade,
  .hero-deco-heart,
  .hero-deco-dollar {
    width: 30px;
  }
}

/* ===== MOBILE STYLES (max-width: 767px) ===== */
@media (max-width: 767px) {
  /* Typography */
  .text-3xl {
    font-size: 1.75rem;
  }
  
  .text-2xl {
    font-size: 1.5rem;
  }
  
  .text-xl {
    font-size: 1.25rem;
  }
  
  /* Hero Section */
  .hero {
    padding: var(--space-xl) 0;
  }
  
  .hero-content {
    flex-direction: column;
    text-align: center;
  }
  
  .hero-text {
    text-align: center;
  }
  
  .hero-title {
    font-size: 1.75rem;
    line-height: 1.3;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .hero-image {
    max-width: 280px;
    margin: var(--space-lg) auto 0;
  }
  
  .hero-deco {
    opacity: 0.15;
  }
  
  .hero-deco-dice,
  .hero-deco-chip,
  .hero-deco-roulette {
    width: 50px;
  }
  
  .hero-deco-spade,
  .hero-deco-heart,
  .hero-deco-dollar {
    width: 30px;
  }
  
  /* Cards */
  .card-body {
    padding: var(--space-md);
  }
  
  /* Category Cards */
  .category-card {
    padding: var(--space-md);
  }
  
  .category-icon {
    width: 48px;
    height: 48px;
  }
  
  .category-icon svg {
    width: 24px;
    height: 24px;
  }
  
  /* Article Cards */
  .article-card-compact {
    padding: var(--space-sm);
  }
  
  .article-title-compact {
    font-size: var(--text-sm);
  }
  
  .article-excerpt {
    font-size: var(--text-xs);
  }
  
  /* Grids */
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  /* Carousel */
  .carousel-section {
    padding: var(--space-sm) 0;
  }
  
  .carousel-item {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
  }
  
  /* Tags */
  .tags-cloud {
    gap: var(--space-xs);
  }
  
  .tag {
    font-size: var(--text-xs);
    padding: 0.25rem 0.5rem;
  }
  
  /* Sidebar */
  .sidebar {
    margin-top: var(--space-xl);
  }
  
  /* Popup Modal */
  .popup-modal {
    max-height: 90vh;
    margin: var(--space-sm);
  }
  
  .popup-title {
    font-size: var(--text-lg);
    padding: var(--space-md);
    padding-right: 50px;
  }
  
  .popup-content {
    padding: var(--space-md);
  }
  
  .popup-close {
    width: 36px;
    height: 36px;
    top: var(--space-sm);
    right: var(--space-sm);
  }
  
  /* Forms */
  .form-input,
  .form-textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Buttons - only CTA buttons full width */
  .btn-cta,
  .card .btn-primary,
  form .btn {
    width: 100%;
    justify-content: center;
  }

  .btn-sm {
    width: auto;
  }

  .btn-cta {
    padding: 0.875rem 1.5rem;
  }
  
  /* Feature boxes */
  .feature-box {
    padding: var(--space-md);
  }
  
  .feature-icon {
    width: 40px;
    height: 40px;
  }
  
  .feature-icon svg {
    width: 22px;
    height: 22px;
  }
  
  /* Tips */
  .tip-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  /* Tools grid */
  .tools-grid {
    grid-template-columns: 1fr;
  }
  
  /* Breadcrumbs */
  .breadcrumbs {
    font-size: var(--text-xs);
    flex-wrap: wrap;
  }
  
  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .footer-links {
    justify-content: center;
  }
  
  /* SEO Content */
  .seo-content h3 {
    font-size: var(--text-base);
  }
  
  .seo-content p {
    font-size: var(--text-sm);
  }
  
  /* Casino cards in article */
  .casino-ranking-grid {
    grid-template-columns: 1fr;
  }
  
  .casino-card-article {
    padding: var(--space-md);
  }
  
  .casino-rank-badge {
    width: 28px;
    height: 28px;
    font-size: var(--text-sm);
  }
  
}

/* ===== VERY SMALL SCREENS (max-width: 380px) ===== */
@media (max-width: 380px) {
  .container {
    padding: 0 var(--space-sm);
  }
  
  .hero-title {
    font-size: 1.5rem;
  }
  
  .card-body {
    padding: var(--space-sm);
  }
  
  .article-title-compact .article-icon {
    display: none;
  }
}

/* ===== CATEGORY PAGE MOBILE STYLES ===== */
@media (max-width: 767px) {
  /* Category cards grid - 2 columns on mobile */
  .grid-3.gap-lg {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
  
  /* Category card compact on mobile */
  .category-card {
    padding: var(--space-md);
  }
  
  .category-card .category-name {
    font-size: var(--text-base);
  }
  
  .category-card .card-text {
    font-size: var(--text-xs);
    margin-top: var(--space-xs);
  }
  
  /* Category icon smaller */
  .category-icon {
    width: 48px;
    height: 48px;
  }
  
  .category-icon svg {
    width: 24px;
    height: 24px;
  }
  
  /* Page headers */
  .section-sm .text-lg {
    font-size: var(--text-base);
  }
  
  /* Card body on mobile */
  .card .card-body {
    padding: var(--space-md);
  }
  
  .card-title.text-xl {
    font-size: var(--text-lg);
  }
  
  .card-text p {
    font-size: var(--text-sm);
    margin-bottom: var(--space-sm);
  }
}

/* Very small screens - single column */
@media (max-width: 480px) {
  .grid-3.gap-lg {
    grid-template-columns: 1fr;
  }
}

/* ===== ARTICLE CARDS MOBILE STYLES ===== */
@media (max-width: 639px) {
  /* Article cards - single column on small screens */
  .grid-2.gap-lg {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  /* Article card compact */
  .article-card-compact {
    padding: var(--space-sm);
  }
  
  .article-title-compact {
    font-size: var(--text-sm);
    gap: var(--space-xs);
  }
  
  .article-title-compact .article-icon {
    width: 20px;
    height: 20px;
  }
  
  .article-title-compact .article-icon svg {
    width: 16px;
    height: 16px;
  }
  
  .article-excerpt {
    font-size: var(--text-xs);
    margin-top: var(--space-xs);
    margin-bottom: var(--space-xs);
  }
  
  .article-link {
    font-size: var(--text-xs);
  }
}

/* Tablets - 2 columns */
@media (min-width: 640px) and (max-width: 767px) {
  .grid-2.gap-lg {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
}

/* ===== TOP CASINOS SIDEBAR MOBILE STYLES ===== */
@media (max-width: 767px) {
  .top-casinos {
    padding: var(--space-md);
  }

  .top-casinos-title {
    font-size: var(--text-base);
    gap: var(--space-xs);
  }

  .top-casinos-title svg {
    width: 20px;
    height: 20px;
  }

  .top-casino-item {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
  }

  .top-casino-rank {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .top-casino-info {
    min-width: 0;
    overflow: hidden;
  }

  .top-casino-name {
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .top-casino-bonus {
    font-size: 10px;
    margin-top: 2px;
  }

  .top-casino-item .btn-sm {
    padding: 0.35rem 0.5rem;
    font-size: 10px;
    min-height: auto;
    width: auto;
  }
}

@media (max-width: 480px) {
  .top-casinos {
    padding: var(--space-sm);
  }

  .top-casino-item {
    grid-template-columns: 22px 1fr 45px;
    gap: var(--space-xs);
  }

  .top-casino-rank {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }

  .top-casino-name {
    font-size: 11px;
  }

  .top-casino-item .btn-sm {
    padding: 0.25rem 0.4rem;
    font-size: 9px;
  }
}

/* ===== FOOTER MOBILE STYLES ===== */
@media (max-width: 767px) {
  .footer-brand {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-brand .logo {
    justify-content: center;
  }

  .footer-brand p {
    text-align: center;
    max-width: 100%;
  }
}

/* ===== CATEGORY CARDS ICON ALIGNMENT ===== */
@media (max-width: 767px) {
  .category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .category-icon {
    margin: 0 auto var(--space-sm);
  }

  .category-icon svg {
    display: block;
    margin: 0 auto;
  }
}
