/* ============================================================================
   Mobile Overrides — Diseño responsive profundo para <= 900px
   Objetivo: versión móvil compacta, perfecta y atractiva
   Alcance: topbar, hero, chips, mini-banners, proveedores, tarjetas, modales,
            navegación inferior, footer, formularios, utilidades y animaciones
   ============================================================================ */

/* Force hide sidebar on desktop */
.mobile-sidebar-overlay {
  display: none;
}

/* Force hide only-mobile elements on desktop */
.only-mobile {
  display: none !important;
}

/* ===== Reset y variables móviles ===== */
@media (max-width: 900px) {
  :root {
    --mobile-radius: 14px;
    --mobile-gap: 12px;
    --mobile-pad: 10px;
    --mobile-font-xs: 11px;
    --mobile-font-sm: 12px;
    --mobile-font-md: 13px;
    --mobile-font-lg: 15px;
    --mobile-line: 1.25;
    --mobile-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --mobile-blur-bg: rgba(20, 20, 22, 0.72);
  }

  html,
  body {
    overscroll-behavior-y: auto;
  }
  body.with-left-rail {
    padding-left: 0 !important;
  }
  .left-rail {
    display: none !important;
  }
  .page-content {
    padding-left: 0 !important;
    padding-bottom: 84px !important;
  }
  .container-fluid {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .section {
    margin: 10px 0 16px !important;
  }
  .section .header {
    padding: 6px 8px !important;
  }
  .section-title-main {
    font-size: 18px !important;
    line-height: var(--mobile-line) !important;
  }
  .section-subtitle {
    font-size: var(--mobile-font-xs) !important;
    opacity: 0.85;
  }
  /* Botón "Mostrar todo" — evitar cortes y ajustar tamaño */
  .section .header {
    gap: 8px !important;
  }
  .section .header .right {
    flex: 0 0 auto !important;
  }
  .section .header .right .see-all,
  .see-all {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    padding: 6px 10px !important;
    font-size: var(--mobile-font-sm) !important;
    line-height: 1 !important;
    border-radius: 999px !important;
    min-height: 30px !important;
    gap: 6px;
  }
}

/* ===== Topbar ===== */
@media (max-width: 900px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
  }
  .topbar-inner {
    min-height: 52px;
    padding: 8px 12px;
    backdrop-filter: saturate(120%) blur(10px);
    background: rgba(10, 10, 12, 0.7);
  }
  .brand-logo {
    height: 26px !important;
  }
  /* ===== New Mobile Sidebar (Drawer) ===== */
  .mobile-sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition:
      opacity 0.3s ease,
      visibility 0.3s ease;
  }

  .mobile-sidebar-overlay.active {
    visibility: visible;
    opacity: 1;
  }

  .mobile-sidebar-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .mobile-sidebar-drawer {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    max-width: 85vw;
    background: linear-gradient(180deg, #150a24 0%, #0e0616 100%);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(122, 60, 255, 0.2);
  }

  .mobile-sidebar-drawer.active {
    transform: translateX(0);
  }

  .mobile-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-top: 60px; /* Space for close button */
  }

  .close-menu-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
  }

  /* Reset old nav-actions hacks */
  .nav-actions {
    /* Default flex for desktop */
    display: flex;
  }
  @media (max-width: 900px) {
    .nav-actions {
      /* Just keep it hidden or minimal on mobile if it has nothing else? */
      /* Wait, nav-actions on mobile is now empty except potentially hidden items? */
      /* Actually, we removed sidebar from it. It might be empty. */
      display: none !important;
    }
  }

  .nav-actions .btn-compact {
    font-size: var(--mobile-font-sm) !important;
    padding: 8px 16px !important;
    border-radius: 12px !important;
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 8px;
    text-align: left;
  }
  .btn-compact.btn-outline {
    border-color: rgba(255, 255, 255, 0.18) !important;
  }
}

/* ===== Hero Carousel ===== */
@media (max-width: 900px) {
  .hero-carousel-wrapper {
    margin: 0 !important;
    border-radius: 0 !important;
  }
  .hero-slide {
    border-radius: 0 !important;
  }
  .hero-content {
    left: 16px !important;
    bottom: 30px !important;
    max-width: 85% !important;
  }
  .hero-title {
    font-size: 20px !important;
    margin-bottom: 6px !important;
  }
  .hero-desc {
    font-size: 13px !important;
    -webkit-line-clamp: 2;
    margin-bottom: 12px !important;
  }
  .hero-btn {
    height: 36px !important;
    padding: 0 16px !important;
    font-size: 13px !important;
  }
  .hero-indicators {
    bottom: 10px !important;
  }
  .hero-dot {
    width: 6px !important;
    height: 6px !important;
  }
  .hero-prev,
  .hero-next {
    display: none !important;
  }
}

/* ===== Quick/Bucket Cats (Chips) ===== */
@media (max-width: 900px) {
  .quick-cats {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 10px !important;
    padding: 10px !important;
    margin: 0 !important;
    scroll-padding-left: 10px;
    -webkit-overflow-scrolling: touch;
  }
  .quick-cats .quick-card {
    flex: 0 0 120px !important;
    height: 60px !important;
    border-radius: var(--mobile-radius) !important;
    padding: 8px !important;
  }
  .quick-cats .quick-image {
    width: 40px !important;
    height: 40px !important;
    right: -5px !important;
    top: 10px !important;
    opacity: 0.6 !important;
  }
  .quick-cats h3 {
    font-size: 13px !important;
    margin-bottom: 2px !important;
  }
  .quick-cats p {
    font-size: 10px !important;
  }
  .quick-cats .quick-card::after {
    display: none !important;
  }
}

/* ===== Providers ===== */
@media (max-width: 900px) {
  .providers-carousel {
    margin: 8px 0 16px !important;
  }
  .providers-carousel .scroll {
    gap: 8px !important;
    padding: 0 10px !important;
  }
  .provider-card {
    width: 90px !important;
    height: 50px !important;
    border-radius: 10px !important;
  }
  .provider-logo {
    max-width: 60px !important;
    max-height: 28px !important;
  }
}

/* ===== Game Grid / Cards ===== */
@media (max-width: 900px) {
  .game-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    padding: 0 10px !important;
  }
  .game-card {
    border-radius: 10px !important;
    aspect-ratio: 3/4 !important;
  }
  .game-thumb {
    border-radius: 10px !important;
  }
  .game-overlay {
    border-radius: 10px !important;
  }
  .game-play-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 16px !important;
  }
  .game-info {
    padding: 8px !important;
  }
  .game-title {
    font-size: 11px !important;
  }
  .game-provider {
    font-size: 9px !important;
  }
}

/* ===== Spacing & Utilities Overrides ===== */
@media (max-width: 900px) {
  .m-10 {
    margin: 10px !important;
  }
  .mt-10 {
    margin-top: 10px !important;
  }
  .mr-10 {
    margin-right: 10px !important;
  }
  .mb-10 {
    margin-bottom: 10px !important;
  }
  .ml-10 {
    margin-left: 10px !important;
  }
  .m-12 {
    margin: 12px !important;
  }
  .mt-12 {
    margin-top: 12px !important;
  }
  .mr-12 {
    margin-right: 12px !important;
  }
  .mb-12 {
    margin-bottom: 12px !important;
  }
  .ml-12 {
    margin-left: 12px !important;
  }
  .m-14 {
    margin: 14px !important;
  }
  .mt-14 {
    margin-top: 14px !important;
  }
  .mr-14 {
    margin-right: 14px !important;
  }
  .mb-14 {
    margin-bottom: 14px !important;
  }
  .ml-14 {
    margin-left: 14px !important;
  }
  .m-16 {
    margin: 16px !important;
  }
  .mt-16 {
    margin-top: 16px !important;
  }
  .mr-16 {
    margin-right: 16px !important;
  }
  .mb-16 {
    margin-bottom: 16px !important;
  }
  .ml-16 {
    margin-left: 16px !important;
  }
  .m-18 {
    margin: 18px !important;
  }
  .mt-18 {
    margin-top: 18px !important;
  }
  .mr-18 {
    margin-right: 18px !important;
  }
  .mb-18 {
    margin-bottom: 18px !important;
  }
  .ml-18 {
    margin-left: 18px !important;
  }
  .m-20 {
    margin: 20px !important;
  }
  .mt-20 {
    margin-top: 20px !important;
  }
  .mr-20 {
    margin-right: 20px !important;
  }
  .mb-20 {
    margin-bottom: 20px !important;
  }
  .ml-20 {
    margin-left: 20px !important;
  }

  /* Paddings */
  .p-0 {
    padding: 0 !important;
  }
  .pt-0 {
    padding-top: 0 !important;
  }
  .pr-0 {
    padding-right: 0 !important;
  }
  .pb-0 {
    padding-bottom: 0 !important;
  }
  .pl-0 {
    padding-left: 0 !important;
  }
  .p-10 {
    padding: 10px !important;
  }
  .pt-10 {
    padding-top: 10px !important;
  }
  .pr-10 {
    padding-right: 10px !important;
  }
  .pb-10 {
    padding-bottom: 10px !important;
  }
  .pl-10 {
    padding-left: 10px !important;
  }
  .p-12 {
    padding: 12px !important;
  }
  .pt-12 {
    padding-top: 12px !important;
  }
  .pr-12 {
    padding-right: 12px !important;
  }
  .pb-12 {
    padding-bottom: 12px !important;
  }
  .pl-12 {
    padding-left: 12px !important;
  }
  .p-14 {
    padding: 14px !important;
  }
  .pt-14 {
    padding-top: 14px !important;
  }
  .pr-14 {
    padding-right: 14px !important;
  }
  .pb-14 {
    padding-bottom: 14px !important;
  }
  .pl-14 {
    padding-left: 14px !important;
  }
  .p-16 {
    padding: 16px !important;
  }
  .pt-16 {
    padding-top: 16px !important;
  }
  .pr-16 {
    padding-right: 16px !important;
  }
  .pb-16 {
    padding-bottom: 16px !important;
  }
  .pl-16 {
    padding-left: 16px !important;
  }
  .p-18 {
    padding: 18px !important;
  }
  .pt-18 {
    padding-top: 18px !important;
  }
  .pr-18 {
    padding-right: 18px !important;
  }
  .pb-18 {
    padding-bottom: 18px !important;
  }
  .pl-18 {
    padding-left: 18px !important;
  }
  .p-20 {
    padding: 20px !important;
  }
  .pt-20 {
    padding-top: 20px !important;
  }
  .pr-20 {
    padding-right: 20px !important;
  }
  .pb-20 {
    padding-bottom: 20px !important;
  }
  .pl-20 {
    padding-left: 20px !important;
  }

  /* Radius */
  .radius-8 {
    border-radius: 8px !important;
  }
  .radius-10 {
    border-radius: 10px !important;
  }
  .radius-12 {
    border-radius: 12px !important;
  }
  .radius-14 {
    border-radius: 14px !important;
  }
  .radius-16 {
    border-radius: 16px !important;
  }
  .radius-18 {
    border-radius: 18px !important;
  }
  .radius-20 {
    border-radius: 20px !important;
  }
  .radius-24 {
    border-radius: 24px !important;
  }

  /* Text utilities */
  .text-xs {
    font-size: var(--mobile-font-xs) !important;
  }
  .text-sm {
    font-size: var(--mobile-font-sm) !important;
  }
  .text-md {
    font-size: var(--mobile-font-md) !important;
  }
  .text-lg {
    font-size: var(--mobile-font-lg) !important;
  }
  .text-center {
    text-align: center !important;
  }
  .text-right {
    text-align: right !important;
  }
  .text-muted {
    opacity: 0.8 !important;
  }

  /* Flex utilities */
  .flex {
    display: flex !important;
  }
  .inline-flex {
    display: inline-flex !important;
  }
  .flex-col {
    flex-direction: column !important;
  }
  .items-center {
    align-items: center !important;
  }
  .justify-center {
    justify-content: center !important;
  }
  .justify-between {
    justify-content: space-between !important;
  }
  .gap-8 {
    gap: 8px !important;
  }
  .gap-10 {
    gap: 10px !important;
  }
  .gap-12 {
    gap: 12px !important;
  }
}

/* ===== Microinteracciones ===== */
@media (max-width: 900px) {
  .tap:hover {
    transform: translateY(-1px) !important;
  }
  .tap:active {
    transform: scale(0.98) !important;
  }
  .soft-transition {
    transition: all 0.2s ease !important;
  }
}

/* ===== Accesibilidad móvil ===== */
@media (max-width: 900px) {
  .touch {
    min-height: 42px !important;
    min-width: 42px !important;
  }
  .focus-ring:focus {
    outline: 2px solid rgba(84, 220, 110, 0.9) !important;
    outline-offset: 2px !important;
  }
}

/* ===== Login Mobile Redesign ===== */
@media (max-width: 900px) {
  /* Fix: Remove backdrop-filter to prevent containing block for fixed children */
  .topbar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
    z-index: 1000 !important;
  }

  .login-modal {
    background: #000 !important;
    padding: 0 !important;
    align-items: flex-start !important; /* Start from top */
  }

  /* New utility classes for conditional display */
  .desktop-only {
    display: none !important;
  }
  .only-mobile {
    display: block !important;
  }

  /* Mobile Header inside Modal */
  .mobile-login-header {
    display: flex !important;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
    padding-bottom: 0;
  }
  .login-back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    padding: 0;
    line-height: 1;
    cursor: pointer;
  }
  .icon-arrow-left::before {
    content: "←";
  } /* Simple fallback */
  .mobile-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
  }

  .login-close {
    display: none !important;
  }

  .login-content {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    grid-template-columns: 1fr !important;
    background: url("/media/banner/mobile/bg.webp") no-repeat center center !important;
    background-size: cover !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column;
    overflow: hidden !important;
  }

  .login-illustration {
    display: none !important;
  }

  .login-dog-mobile {
    display: block !important;
    position: absolute;
    bottom: -10%;
    right: -75%;
    width: 170%;
    max-width: none;
    height: auto;
    z-index: 1;
    pointer-events: none;
  }

  .login-body {
    position: relative;
    z-index: 2;
    background: transparent !important;
    border: none !important;
    padding: 20px 24px !important;
    width: 100%;
    max-width: 100%;
  }

  .login-form {
    gap: 16px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .login-label {
    font-size: 14px !important;
    color: #fff !important;
    margin-bottom: 4px !important;
    font-weight: 600 !important;
  }
  .text-danger {
    color: #ef4444;
    margin-left: 2px;
  }

  .form-input {
    background: rgba(20, 10, 35, 0.85) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    border-radius: 12px !important;
    height: 50px !important;
    color: #fff !important;
    backdrop-filter: blur(10px);
  }

  .form-input::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
  }

  /* Target ONLY the modal login button */
  .login-form .btn-login {
    background: linear-gradient(90deg, #7c3aed, #6d28d9) !important;
    border-radius: 12px !important;
    height: 48px !important;
    font-size: 16px !important;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4) !important;
    width: auto !important;
    min-width: 160px;
    align-self: flex-start;
  }

  /* Fix Header Mobile Login Button size */
  .topbar-inner .btn-compact.btn-login.only-mobile {
    padding: 6px 16px !important;
    font-size: 12px !important;
    height: 34px !important;
    border-radius: 8px !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25) !important;
    width: auto !important;
    min-width: 0 !important;
    background: linear-gradient(180deg, #7c3aed, #8b5cf6) !important;
  }

  .login-links {
    display: none !important;
  }
}
