/**
 * Shirkat Al Nahal — Responsive Viewport Rules
 *
 * @package ShirkatAlNahal
 */

/* -------------------------------------------------------------
   Desktop Default (min-width: 1024px)
------------------------------------------------------------- */
@media (min-width: 1024px) {
  .hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: var(--space-64);
    min-height: 80vh;
    padding: var(--space-64) 0;
  }

  .story-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: var(--space-48);
  }

  .mobile-menu-toggle {
    display: none;
  }
}

/* -------------------------------------------------------------
   Tablet & Mobile Viewports (< 1024px)
------------------------------------------------------------- */
@media (max-width: 1023px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--brown-900);
    cursor: pointer;
    padding: 8px;
    z-index: 2;
  }

  .shirkat-header-inner {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative !important;
    padding: 10px 0 !important;
  }

  .shirkat-branding {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    text-align: center !important;
    z-index: 1 !important;
    margin: 0 !important;
  }

  .shirkat-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    z-index: 2 !important;
    margin-left: auto !important;
  }

  .shirkat-nav-list {
    display: none !important; /* Collapses into mobile drawer */
  }

  .hero-grid {
    display: flex;
    flex-direction: column-reverse;
    text-align: center;
    gap: var(--space-32);
    padding: var(--space-48) 0;
  }

  .hero-actions {
    justify-content: center;
  }

  .story-grid {
    display: flex;
    flex-direction: column;
    text-align: center;
  }

  .announcement-message-center {
    display: none;
  }
}

/* -------------------------------------------------------------
   Mobile Viewports (320px - 767px)
------------------------------------------------------------- */
@media (max-width: 767px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .desktop-only {
    display: none !important;
  }

  .shirkat-container {
    width: min(100% - 24px, var(--container-max)) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .cart-drawer-content {
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .shirkat-header-inner {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .shirkat-header-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    position: relative !important;
    z-index: 5 !important;
    margin-left: auto !important;
  }

  .cart-icon-btn.header-action-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--brown-900) !important;
    padding: 6px !important;
  }

  /* Announcement Bar on Mobile */
  .shirkat-announcement-bar {
    padding: 6px var(--space-12);
    font-size: 0.76rem;
  }

  .announcement-bar-inner {
    justify-content: space-between;
    gap: 8px;
  }

  .announcement-message-center {
    display: none;
  }

  .announcement-contact-left .topbar-link,
  .announcement-email-right .topbar-link {
    font-size: 0.74rem;
  }

  /* Header Branding (Mobile: 35% logo size reduction) */
  .shirkat-branding .shirkat-logo-img {
    max-height: 26px !important;
    height: 26px !important;
    margin-bottom: 2px !important;
  }

  .shirkat-branding .logo-title {
    font-size: 0.68rem !important;
    line-height: 1.1 !important;
  }

  .logo-title {
    font-size: 0.68rem !important;
  }

  .logo-accent {
    font-size: 0.65rem !important;
  }

  .logo-subtitle {
    display: none !important;
  }

  /* Remove Search Icon from Header in Mobile View Only */
  #headerSearchTrigger,
  .shirkat-header-actions .search-trigger,
  .search-trigger.header-action-btn {
    display: none !important;
  }

  h1 {
    font-size: clamp(1.85rem, 7vw, 2.5rem);
  }

  h2 {
    font-size: clamp(1.35rem, 5.5vw, 1.85rem);
  }

  .btn-shirkat {
    width: 100%;
  }

  /* Product Card Grid on Mobile */
  .woocommerce ul.products,
  ul.products,
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .woocommerce ul.products li.product,
  .shirkat-product-card {
    padding: 10px !important;
    border-radius: var(--radius-sm) !important;
  }

  .product-card-badge {
    top: 6px !important;
    left: 6px !important;
    font-size: 0.65rem !important;
    padding: 2px 7px !important;
  }

  .product-card-title,
  .woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 0.85rem !important;
    min-height: 2.3em !important;
    line-height: 1.25 !important;
  }

  .product-card-price,
  .woocommerce ul.products li.product .price {
    font-size: 0.9rem !important;
  }

  .product-loop-cta,
  .product-add-to-cart-btn,
  .woocommerce ul.products li.product .button {
    padding: 8px 10px !important;
    font-size: 0.75rem !important;
  }

  /* Search Overlay Modal on Mobile */
  .shirkat-search-overlay {
    padding: 10px !important;
    align-items: flex-start !important;
  }

  .search-overlay-inner {
    padding: 18px 14px !important;
    border-radius: var(--radius-md) !important;
    margin-top: 6px !important;
    width: 100% !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
  }

  .search-box-wrapper .search-form {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .shirkat-search-input {
    width: 100% !important;
    font-size: 16px !important; /* Disables auto-zoom in mobile iOS Safari */
    padding: 10px 14px 10px 38px !important;
  }

  .search-submit {
    width: 100% !important;
  }

  .shirkat-live-search-results {
    max-height: 240px !important;
  }

  .shirkat-live-search-results .search-result-link {
    padding: 8px 10px !important;
    gap: 10px !important;
  }

  .shirkat-live-search-results .search-result-thumb {
    width: 40px !important;
    height: 40px !important;
  }

  .shirkat-live-search-results .search-result-title {
    font-size: 0.85rem !important;
  }

  .shirkat-live-search-results .search-result-price {
    font-size: 0.82rem !important;
  }

  /* Single Product Layout on Mobile */
  .shirkat-single-product-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-24) !important;
  }

  /* Sticky Bottom Purchase Bar for Mobile PDP */
  .sticky-mobile-add-to-cart {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 10px var(--space-16);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  /* Floating WhatsApp Widget Safe Position */
  .floating-whatsapp-widget {
    bottom: 20px;
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .floating-whatsapp-widget svg {
    width: 26px;
    height: 26px;
  }

  /* -------------------------------------------------------------
     Mobile View: Explore Our Specialties (2 items in a row)
  ------------------------------------------------------------- */
  .categories-grid,
  .categories-3col-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .categories-grid .category-card,
  .categories-3col-grid .category-card {
    display: flex !important;
    flex-direction: column !important;
  }

  .categories-grid .category-card-body,
  .categories-3col-grid .category-card-body {
    padding: 12px 8px !important;
  }

  .categories-grid .category-card-body h3,
  .categories-3col-grid .category-card-body h3 {
    font-size: 0.92rem !important;
    line-height: 1.2 !important;
  }

  .categories-grid .category-card-body p,
  .categories-3col-grid .category-card-body p {
    font-size: 0.76rem !important;
    line-height: 1.35 !important;
    margin-bottom: 10px !important;
  }

  .categories-grid .category-card-body .btn-shirkat,
  .categories-3col-grid .category-card-body .btn-shirkat {
    padding: 6px 8px !important;
    font-size: 0.78rem !important;
  }

  /* -------------------------------------------------------------
     Mobile View: Strategic Collaboration (Center Aligned)
  ------------------------------------------------------------- */
  .shirkat-tika-collab {
    text-align: center !important;
  }

  .shirkat-tika-collab .tika-collab-content {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .shirkat-tika-collab .tika-collab-badge {
    margin: 0 auto 16px !important;
  }

  .shirkat-tika-collab h2 {
    text-align: center !important;
  }

  .shirkat-tika-collab p {
    text-align: center !important;
  }

  .shirkat-tika-collab .tika-collab-actions {
    justify-content: center !important;
    margin: 0 auto !important;
  }

  /* -------------------------------------------------------------
     Mobile View: Verified Reviews, Stars & Boxes (Center Aligned)
  ------------------------------------------------------------- */
  .shirkat-reviews-section {
    text-align: center !important;
  }

  .shirkat-reviews-section .text-center {
    text-align: center !important;
  }

  .shirkat-reviews-section .reviews-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .shirkat-reviews-section .review-card {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: var(--space-20) !important;
  }

  .shirkat-reviews-section .review-card .stars {
    text-align: center !important;
    margin: 0 auto var(--space-12) !important;
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    font-size: 1.15rem !important;
  }

  .shirkat-reviews-section .review-card p {
    text-align: center !important;
    margin-bottom: 10px !important;
  }

  .shirkat-reviews-section .review-card div {
    text-align: center !important;
    width: 100% !important;
  }

  /* Single Product Page Customer Reviews Tab on Mobile */
  .review-summary-banner {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    justify-content: center !important;
    gap: 16px !important;
    padding: 18px 14px !important;
  }

  .review-summary-banner > div {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    justify-content: center !important;
  }

  .pdp-review-card {
    text-align: center !important;
    padding: 16px 14px !important;
  }

  .pdp-review-card > div:first-child {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 6px !important;
  }

  .pdp-review-card .pdp-review-rating {
    justify-content: center !important;
    text-align: center !important;
  }

  .pdp-review-card p {
    text-align: center !important;
  }

  #pdp-review-form {
    text-align: center !important;
  }

  #pdp-review-form .star-picker {
    justify-content: center !important;
  }

  /* -------------------------------------------------------------
     Mobile View: Footer (Hide Navigation & Center All Content)
  ------------------------------------------------------------- */
  .shirkat-footer {
    text-align: center !important;
  }

  .footer-top-grid {
    grid-template-columns: 1fr !important;
    text-align: center !important;
    justify-items: center !important;
    gap: var(--space-24) !important;
  }

  .footer-col {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
  }

  /* In mobile view do not show navigation etc to save space */
  .footer-nav-col,
  .footer-top-grid > .footer-nav-col,
  .footer-top-grid > .footer-col.footer-nav-col,
  .footer-top-grid > .footer-col:nth-child(2),
  .footer-top-grid > .footer-col:nth-child(3) {
    display: none !important;
  }

  .footer-col .footer-logo {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
  }

  .footer-col .footer-logo img {
    margin: 0 auto 6px !important;
  }

  .footer-col .footer-brand-desc {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 90% !important;
  }

  .contact-col {
    align-items: center !important;
    text-align: center !important;
  }

  .contact-item {
    text-align: center !important;
  }

  .footer-bottom-inner {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 12px !important;
  }

  .payment-methods-icons {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
}

/* Extra Small Mobile (below 380px) */
@media (max-width: 380px) {
  .woocommerce ul.products,
  ul.products,
  .product-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* Ultra-wide Screen Safeguard (1920px+) */
@media (min-width: 1920px) {
  .shirkat-container {
    max-width: 1400px;
  }
}
