/*
 * ==========================================================================
 * responsive.css - TheFlashCoupon
 * Covers: Mobile (<=767px) | Tablet (768px-1023px) | Desktop (>=1024px)
 * Applies to: index.html, Stores.html, Categories.html, TopBrands.html,
 *             Contact.html, Terms.html, storepage/*.html
 * ==========================================================================
 */

/* ==========================================================================
   1.  NAVIGATION — MOBILE ONLY HAMBURGER (≤ 767px)
       Tablet (768px+) and Desktop (1024px+) show full desktop navigation
   ========================================================================== */

/* ── MOBILE: show hamburger, hide desktop nav ── */
@media (max-width: 767px) {
  .desktop-nav {
    display: none !important;
  }

  .header-cta {
    display: none !important;
  }

  /* Show hamburger button */
  .nav-toggle {
    display: inline-flex !important;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1.5px solid var(--card-border);
    background: var(--white);
    color: var(--dark);
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    cursor: pointer;
    transition:
      background var(--transition),
      color var(--transition);
    font-size: 1.1rem;
  }

  .nav-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
  }

  /* Ensure drawer and overlay are visible when activated on mobile */
  .mobile-drawer {
    display: flex !important;
  }

  .nav-overlay {
    display: block !important;
  }
}

/* ── TABLET & DESKTOP: hide hamburger, show full navigation ── */
@media (min-width: 768px) {
  /* Always hide the hamburger button */
  .nav-toggle {
    display: none !important;
  }

  /* Always hide mobile drawer and overlay */
  .mobile-drawer {
    display: none !important;
  }

  .nav-overlay {
    display: none !important;
  }

  /* Always show the desktop nav */
  .desktop-nav {
    display: block !important;
  }

  .header-cta {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 700;
    transition:
      background var(--transition),
      color var(--transition);
  }

  .header-cta:hover {
    background: var(--brand-gradient);
    color: var(--white);
  }
}

/* ==========================================================================
   2.  GLOBAL UTILITY - all pages
   ========================================================================== */

@media (max-width: 767px) {
  .navbar {
    min-height: 64px;
    padding: 0 0.25rem;
  }

  .logo--img-only img {
    height: 54px !important;
  }

  .marquee span {
    font-size: 0.82rem;
  }

  .section {
    padding: 2rem 0;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .hero-controls {
    left: 0.75rem;
    right: 0.75rem;
    justify-content: space-between;
  }

  .stats-grid,
  .popular-stores-grid,
  .promo-grid,
  .brands-grid,
  .categories-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .navbar {
    min-height: 72px;
  }

  .logo--img-only img {
    height: 64px !important;
  }

  .section {
    padding: 2.8rem 0;
  }
}

/* ==========================================================================
   3.  HOME PAGE (index.html)
   ========================================================================== */

@media (max-width: 767px) {
  .hero-section {
    padding: 0.8rem 0 1.5rem;
  }

  .hero-swiper {
    border-radius: 18px;
  }

  .hero-slide {
    min-height: 340px;
  }

  .hero-slide__content {
    padding: 1.4rem 1rem 1.8rem;
  }

  .hero-slide__content h1,
  .hero-slide__content h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    margin: 0.5rem 0;
  }

  .hero-slide__content p {
    font-size: 0.9rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .coupon-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .coupon-card:not(.store-listing) {
    display: grid !important;
    grid-template-areas:
      "discount logo"
      "body body"
      "tear tear"
      "actions actions" !important;
    grid-template-columns: auto 1fr !important;
    grid-template-rows: auto auto auto auto !important;
    align-items: center !important;
    min-height: auto !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: visible !important; /* Make sure negative margin cutouts are visible */
  }

  .coupon-card:not(.store-listing) .coupon-card__discount {
    grid-area: discount !important;
    min-width: 0 !important;
    width: auto !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 0.5rem 0.8rem !important;
    gap: 0.2rem !important;
    border-radius: 15px 0 12px 0 !important; /* Ticket cutout corner style, matches parent top-left */
    align-self: flex-start !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__discount strong {
    font-size: 1.15rem !important;
    line-height: 1 !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__discount small {
    font-size: 0.58rem !important;
    margin-top: 0.1rem !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__logo-box {
    grid-area: logo !important;
    width: auto !important;
    border-right: none !important;
    padding: 0.5rem 0.8rem !important;
    justify-content: flex-end !important;
    align-self: center !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__logo {
    width: auto !important;
    height: 32px !important;
    max-width: 80px !important;
    object-fit: contain !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__body {
    grid-area: body !important;
    padding: 0.85rem 1rem 0.4rem !important;
    width: 100% !important;
    text-align: left !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__category-wrap {
    margin-bottom: 0.25rem !important;
  }

  .coupon-card:not(.store-listing) .coupon-title {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    margin: 0.15rem 0 !important;
  }

  .coupon-card:not(.store-listing) .coupon-desc {
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
    -webkit-line-clamp: 3 !important; /* Allow slightly longer text if needed */
    margin-bottom: 0.3rem !important;
  }

  .coupon-card:not(.store-listing) .coupon-meta {
    margin-top: 0.3rem !important;
    gap: 0.3rem 0.8rem !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__tear {
    grid-area: tear !important;
    width: 100% !important;
    height: 0 !important;
    border-left: none !important;
    border-top: 1.5px dashed rgba(212, 75, 163, 0.2) !important;
    margin: 0.3rem 0 !important;
    position: relative !important;
    flex-shrink: 0 !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__tear::before,
  .coupon-card:not(.store-listing) .coupon-card__tear::after {
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 14px !important;
    height: 14px !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__tear::before {
    left: -8px !important;
    right: auto !important;
  }

  .coupon-card:not(.store-listing) .coupon-card__tear::after {
    right: -8px !important;
    left: auto !important;
  }

  .coupon-card:not(.store-listing) .coupon-actions {
    grid-area: actions !important;
    padding: 0.75rem 1rem 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .coupon-card:not(.store-listing) .btn-deal {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
    border-radius: 10px !important;
  }

  .promo-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .promo-card {
    min-height: 200px;
    padding: 1.5rem;
    border-radius: 18px;
  }

  .promo-card h3 {
    font-size: 1.3rem;
  }

  .newsletter-card {
    grid-template-columns: 1fr;
    border-radius: 20px;
  }

  .newsletter-media {
    min-height: 200px;
  }

  .newsletter-content {
    padding: 1.5rem;
  }

  .newsletter-content h2 {
    font-size: 1.3rem;
  }

  .newsletter-form {
    grid-template-columns: 1fr;
  }

  .newsletter-form .btn {
    width: 100%;
  }

  .category-card {
    min-height: 160px;
    padding: 1.1rem 0.8rem;
  }

  .category-card__icon {
    width: 52px;
    height: 52px;
    font-size: 1.1rem;
  }

  .category-card h3 {
    font-size: 0.92rem;
  }

  .category-card p {
    font-size: 0.82rem;
  }
}

@media (max-width: 479px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card {
    padding: 1rem;
    flex-direction: column;
    text-align: center;
    gap: 0.6rem;
  }

  .stat-card i {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .stat-card strong {
    font-size: 1.1rem;
  }

  .stat-card span {
    font-size: 0.82rem;
  }

  .popular-stores-grid {
    grid-template-columns: 1fr 1fr;
  }

  .store-card {
    min-height: 140px;
    padding: 1rem 0.75rem;
  }

  .store-card img {
    width: 90px;
    height: 48px;
  }

  .store-card h3 {
    font-size: 0.88rem;
    margin-top: 0.75rem;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .popular-stores-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .hero-slide {
    min-height: 400px;
  }

  .hero-slide__content {
    padding: 2rem 1.8rem 2.4rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .coupon-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .popular-stores-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .promo-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .newsletter-card {
    grid-template-columns: 1fr 1.3fr;
  }

  .newsletter-content {
    padding: 2rem;
  }
}

/* ==========================================================================
   4.  STORES PAGE (Stores.html)
   ========================================================================== */

@media (max-width: 479px) {
  .store-directory-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  .store-directory-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 768px) and (max-width: 899px) {
  .store-directory-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }
}

@media (min-width: 900px) and (max-width: 1139px) {
  .store-directory-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
  }
}

@media (min-width: 1140px) {
  .store-directory-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }
}

@media (max-width: 767px) {
  .store-listing {
    min-height: 300px;
    border-radius: 18px;
  }

  .store-card__content {
    padding: 1.1rem;
  }

  .store-card__brand-info h3 {
    font-size: 1.1rem;
  }

  .store-card__brand-info .store-listing__logo {
    width: 42px;
    height: 42px;
  }

  .store-card__desc {
    font-size: 0.82rem;
    -webkit-line-clamp: 2;
  }

  .search-panel {
    padding: 1.2rem;
    border-radius: 18px;
    margin-bottom: 1.5rem;
  }

  .search-form input {
    font-size: 0.9rem;
    padding: 0.85rem 0.85rem 0.85rem 3rem;
  }

  .filter-tabs {
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
  }

  .filter-tab {
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .store-listing {
    min-height: 340px;
  }
}

/* ==========================================================================
   5.  STORE DETAIL PAGES (storepage/*.html)
   ========================================================================== */

@media (max-width: 767px) {
  .inner-hero {
    padding: 1.2rem 0;
    margin-bottom: 1.2rem;
  }

  .inner-hero h1 {
    font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  }

  .breadcrumb {
    font-size: 0.82rem;
    gap: 0.4rem;
  }

  .brand-detail-section {
    padding: 1.2rem;
    border-radius: 18px;
    margin-bottom: 1.5rem;
  }

  .brand-detail-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .brand-logo-wrapper {
    max-width: 130px;
    padding: 0.75rem;
    margin: 0 auto;
  }

  .brand-logo-wrapper img {
    border-radius: 14px;
  }

  .brand-detail-text h1 {
    font-size: clamp(1.3rem, 4vw, 1.65rem);
  }

  .brand-detail-text p {
    font-size: 0.9rem;
  }

  .deal-card {
    flex-direction: column;
    border-radius: 16px;
  }

  .deal-header {
    flex-direction: row;
    align-items: stretch;
  }

  .deal-discount {
    min-width: 72px;
    font-size: 1rem;
    padding: 0.85rem 0.4rem;
  }

  .deal-content {
    padding: 0.9rem 1rem;
    gap: 0.35rem;
  }

  .deal-content h3 {
    font-size: 0.95rem;
  }

  .deal-badge {
    font-size: 0.72rem;
    padding: 0.25rem 0.55rem;
  }

  .deal-actions {
    padding: 0.9rem 1rem;
    border-top: 1px dashed var(--card-border);
    border-left: none;
    justify-content: stretch;
  }

  .btn-view {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
  }

  .about-card {
    padding: 1.3rem;
    border-radius: 18px;
  }

  .about-card h2 {
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
  }

  .about-card p {
    font-size: 0.9rem;
    line-height: 1.6;
  }
}

@media (min-width: 768px) {
  .brand-detail-grid {
    grid-template-columns: 160px 1fr;
    gap: 2rem;
  }

  .brand-logo-wrapper {
    margin: 0;
  }

  .deal-card {
    flex-direction: row;
    align-items: stretch;
  }

  .deal-actions {
    border-top: none;
    border-left: 2px dashed rgba(212, 75, 163, 0.18);
    padding: 1.2rem 2rem;
    justify-content: center;
    min-width: 180px;
  }

  .btn-view {
    width: auto;
    min-width: 130px;
  }
}

/* ==========================================================================
   6.  CATEGORIES PAGE (Categories.html)
   ========================================================================== */

@media (max-width: 479px) {
  .categories-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .category-page-card {
    padding: 1.3rem;
    border-radius: 16px;
  }

  .category-icon-box {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
    border-radius: 12px;
  }

  .category-info h2 {
    font-size: 1.1rem;
  }

  .category-info span {
    font-size: 0.82rem;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }
}

@media (min-width: 1024px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   7.  TOP BRANDS PAGE (TopBrands.html)
   ========================================================================== */

@media (max-width: 479px) {
  .brands-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .brand-directory-card {
    padding: 1.2rem;
    border-radius: 16px;
    gap: 0.9rem;
  }

  .brand-card-logo img {
    width: 82px;
    height: 44px;
  }

  .brand-card-meta h2 {
    font-size: 1.05rem;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  .brands-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .brands-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }
}

@media (min-width: 1024px) {
  .brands-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .brand-hero {
    padding: 1.3rem;
    border-radius: 18px;
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .brand-logo-card img {
    width: 100px;
    height: 52px;
  }

  .brand-hero__right h1 {
    font-size: clamp(1.4rem, 4vw, 2rem);
  }
}

/* ==========================================================================
   8.  TERMS PAGE (Terms.html)
   ========================================================================== */

@media (max-width: 767px) {
  .legal-content-card {
    padding: 1.3rem;
    border-radius: 18px;
  }

  .legal-section h2 {
    font-size: 1.15rem;
  }

  .legal-section p {
    font-size: 0.92rem;
  }

  .legal-section ul {
    padding-left: 1.2rem;
  }
}

/* ==========================================================================
   9.  CONTACT PAGE (Contact.html)
   ========================================================================== */

@media (max-width: 767px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .contact-form-panel {
    padding: 1.3rem;
    border-radius: 18px;
  }

  .contact-card-item {
    padding: 1.2rem;
    border-radius: 16px;
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-group-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-field input,
  .form-field select,
  .form-field textarea {
    font-size: 0.9rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .contact-grid {
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
  }

  .form-group-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   10. MOBILE DRAWER
   ========================================================================== */

@media (max-width: 767px) {
  .mobile-drawer {
    width: min(88vw, 340px);
    padding: 1rem 1rem 2rem;
    gap: 1.2rem;
    overflow-y: auto;
    z-index: 200;
  }

  .mobile-drawer__top {
    align-items: center;
    justify-content: space-between;
  }

  .mobile-drawer__top .logo--img-only img {
    height: 50px !important;
  }

  .mobile-nav__links > a,
  .mobile-nav__dropdown-toggle {
    padding: 0.85rem 1rem;
    font-size: 0.98rem;
    border-radius: 12px;
  }

  .mobile-nav__dropdown-menu {
    padding: 0.4rem 0 0.4rem 0.6rem;
  }

  .mobile-nav__dropdown-menu a {
    padding: 0.65rem 0.75rem !important;
    font-size: 0.9rem !important;
  }

  .nav-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.1rem;
    flex-shrink: 0;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .mobile-drawer {
    width: min(72vw, 380px);
    padding: 1.2rem 1.4rem 2rem;
  }
}

/* ==========================================================================
   11. REDIRECT POPUP
   ========================================================================== */

@media (max-width: 479px) {
  .redirect-popup__card {
    padding: 1.8rem 1.2rem 1.4rem;
    border-radius: 20px;
    max-width: calc(100% - 1.5rem);
  }

  .redirect-popup__title {
    font-size: 1.1rem;
  }

  .redirect-popup__ring {
    width: 64px;
    height: 64px;
  }

  .redirect-ring-svg {
    width: 64px;
    height: 64px;
  }
}

/* ==========================================================================
   12. INNER HERO BANNER
   ========================================================================== */

@media (max-width: 767px) {
  .inner-hero__card {
    padding: 1.4rem 1rem;
    border-radius: 18px;
    text-align: left;
  }

  .inner-hero__card h1 {
    font-size: clamp(1.4rem, 5vw, 1.85rem);
  }

  .inner-hero__card p {
    font-size: 0.9rem;
  }
}

/* ==========================================================================
   13. FOOTER
   ========================================================================== */

@media (max-width: 767px) {
  .site-footer {
    padding: 2.5rem 0 1rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-column h3 {
    font-size: 1rem;
    margin-bottom: 0.7rem;
  }

  .footer-links {
    gap: 0.5rem;
  }

  .footer-links a {
    font-size: 0.9rem;
  }

  .social-links {
    gap: 0.6rem;
    margin-top: 0.9rem;
  }

  .social-links a {
    width: 38px;
    height: 38px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 1.5rem;
  }

  .legal-note {
    font-size: 0.82rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .footer-grid {
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* ==========================================================================
   14. MISC - badges, pills, filter tabs, top-bar
   ========================================================================== */

@media (max-width: 479px) {
  .filter-tabs {
    gap: 0.4rem;
  }

  .filter-tab {
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
  }

  .badge {
    font-size: 0.68rem;
    padding: 2px 8px;
  }

  .category-pill {
    font-size: 0.78rem;
    padding: 0.35rem 0.65rem;
  }

  .marquee {
    min-height: 34px;
  }

  .marquee span {
    font-size: 0.78rem;
    animation-duration: 12s;
  }
}
