/* store-enhancements.css — Apex Mobile & Computer Repairs
   Store page: missing modal styles + significantly improved mobile responsive
   Load AFTER style.css */

/* ===========================================================
   MISSING MODAL STYLES
   =========================================================== */

   @keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
  }
  
  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  
  .modal-backdrop.open {
    display: flex;
  }
  
  .product-modal-content {
    background: #fff;
    border-radius: 14px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 24px;
    animation: scaleIn 0.25s ease-out;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--slate-light);
    z-index: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
  }
  
  .modal-close:hover {
    color: var(--ink);
    background: var(--paper-dim);
  }
  
  /* ===========================================================
     TOAST — base override for better mobile layout
     style.css uses left:50% + translateX(-50%) which doesn't
     respect left/right edges. Override on mobile.
     =========================================================== */
  
  /* ===========================================================
     NAV FIX — cart + wishlist buttons hidden by style.css at 800px
     style.css has `@media(max-width:800px) { .nav-cta { display:none; } }`
     but the cart and wishlist ARE .nav-cta — they must stay visible
     =========================================================== */
  
  @media (max-width: 800px) {
    .nav-cta#cartToggle,
    .nav-cta#wishlistToggleLink {
      display: inline-flex !important;
      align-items: center;
    }
  }
  
  @media (max-width: 640px) {
    /* Shrink cart/wishlist buttons to fit alongside hamburger */
    .nav-cta#cartToggle {
      padding: 8px 12px;
      font-size: 0.8rem;
      gap: 4px;
    }
  
    .nav-cta#cartToggle .icon {
      width: 14px !important;
      height: 14px !important;
    }
  
    .nav-cta#cartToggle > span:not(#cartCount) {
      display: none; /* hide "Cart" text, keep icon + count */
    }
  
    .nav-cta#wishlistToggleLink {
      padding: 8px 10px;
      font-size: 0.85rem;
    }
  
    #cartCount {
      width: 18px !important;
      height: 18px !important;
      font-size: 0.65rem !important;
    }
  }
  
  @media (max-width: 380px) {
    .nav .logo-text small {
      display: none; /* hide tagline on tiny phones to save space */
    }
  
    .nav-cta#wishlistToggleLink {
      padding: 8px;
    }
  }
  
  /* ===========================================================
     TABLET — ≤ 800px (before full mobile stack)
     =========================================================== */
  
  @media (max-width: 800px) {
    /* Product grid: 3 columns on tablet */
    .product-grid {
      grid-template-columns: repeat(3, 1fr);
      gap: 14px;
    }
  
    /* Product image shorter on tablet */
    .product-image {
      height: 160px;
    }
  
    .product-title {
      font-size: 0.9rem;
    }
  }
  
  /* ===========================================================
     MOBILE — ≤ 640px
     =========================================================== */
  
  @media (max-width: 640px) {
    /* === STORE HEADER === */
    .store-header {
      flex-direction: column;
      gap: 12px;
      padding: 14px 16px;
      border-radius: 10px;
    }
  
    .store-header > div:first-child {
      width: 100%;
      justify-content: center;
    }
  
    /* Filters: horizontal scroll instead of wrapping */
    .store-filters {
      width: 100%;
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      gap: 8px;
      padding-bottom: 2px;
    }
  
    .store-filters::-webkit-scrollbar {
      display: none;
    }
  
    .filter-btn {
      flex-shrink: 0;
      font-size: 0.82rem;
      padding: 7px 14px;
      white-space: nowrap;
    }
  
    /* Search + sort row stacks */
    .store-header > div:last-child {
      width: 100%;
      flex-direction: column;
      gap: 10px;
      min-width: 0 !important;
    }
  
    .store-header > div:last-child > div:first-child {
      max-width: 100%;
      width: 100%;
    }
  
    .search-input,
    #productSearch {
      font-size: 16px !important;
      width: 100%;
      padding: 12px 14px 12px 38px !important;
    }
  
    .sort-select,
    #sortSelect {
      width: 100%;
      font-size: 16px;
      padding: 12px 14px;
    }
  
    /* === PRODUCT GRID — 2 columns === */
    .product-grid {
      grid-template-columns: repeat(2, 1fr) !important;
      gap: 10px !important;
      margin-bottom: 40px;
    }
  
    .product-card {
      border-radius: 10px;
    }
  
    /* Disable hover lift on touch */
    .product-card:hover {
      transform: none;
      box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
  
    /* Product image: shorter for compact 2-col grid */
    .product-image {
      height: 120px !important;
      padding: 12px !important;
      min-height: 120px !important;
    }
  
    .product-image .icon {
      width: 36px !important;
      height: 36px !important;
    }
  
    /* Product badge: smaller */
    .product-badge {
      font-size: 0.58rem !important;
      padding: 3px 7px !important;
      top: 8px !important;
      right: 8px !important;
    }
  
    /* Wishlist heart button: bigger touch target */
    .wishlist-btn {
      width: 32px !important;
      height: 32px !important;
      font-size: 1rem !important;
    }
  
    .product-body {
      padding: 12px 10px;
    }
  
    .product-title {
      font-size: 0.82rem;
      line-height: 1.25;
      margin-bottom: 4px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
  
    .product-specs {
      font-size: 0.68rem;
      margin-bottom: 8px;
      display: -webkit-box;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
  
    .product-price {
      font-size: 0.95rem;
      margin-bottom: 6px;
    }
  
    .product-rating {
      gap: 2px;
      margin-bottom: 10px;
    }
  
    .product-rating .icon {
      width: 11px !important;
      height: 11px !important;
    }
  
    /* Stack buttons vertically */
    .product-footer {
      flex-direction: column;
      gap: 6px;
    }
  
    .product-btn {
      width: 100%;
      font-size: 0.78rem;
      padding: 9px 10px;
      text-align: center;
    }
  
    .product-btn.view-details {
      padding: 9px 10px;
    }
  
    /* === CART SIDEBAR === */
    .cart-sidebar {
      width: 100% !important;
    }
  
    .cart-header {
      padding: 16px;
    }
  
    .cart-header h3 {
      font-size: 1.1rem;
    }
  
    .cart-items {
      padding: 16px;
    }
  
    .cart-item {
      padding-bottom: 14px;
      margin-bottom: 14px;
    }
  
    .cart-item-image {
      width: 48px;
      height: 48px;
    }
  
    .cart-item-image .icon {
      width: 22px !important;
      height: 22px !important;
    }
  
    .cart-item-title {
      font-size: 0.82rem;
      word-break: break-word;
      line-height: 1.3;
    }
  
    .cart-item-price {
      font-size: 0.82rem;
    }
  
    .qty-btn {
      width: 30px;
      height: 30px;
      font-size: 0.9rem;
    }
  
    .cart-summary {
      padding: 16px;
    }
  
    .summary-line {
      font-size: 0.85rem;
    }
  
    .summary-line.total-line {
      font-size: 1rem;
    }
  
    .checkout-btn {
      padding: 14px;
      font-size: 0.95rem;
    }
  
    /* === MODALS === */
    .modal-backdrop {
      padding: 0;
      align-items: flex-end;
    }
  
    .product-modal-content {
      max-width: 100%;
      width: 100%;
      border-radius: 16px 16px 0 0;
      padding: 20px 18px;
      margin: 0;
      max-height: 92vh;
      animation: slideUp 0.3s ease-out;
    }
  
    /* Product modal content */
    #modalTitle {
      font-size: 1.1rem !important;
      padding-right: 40px;
    }
  
    #modalBody {
      font-size: 0.9rem;
    }
  
    .wizard-actions {
      flex-direction: column-reverse;
      gap: 10px;
    }
  
    .wizard-actions .btn {
      width: 100%;
      text-align: center;
      padding: 14px;
    }
  
    /* Checkout modal inputs: 16px prevents iOS zoom */
    #checkoutName,
    #checkoutPhone,
    #checkoutAddress,
    #checkoutNotes,
    #checkoutParish {
      font-size: 16px !important;
    }
  
    .field-label {
      font-size: 0.78rem;
    }
  
    #checkoutModal .product-modal-content {
      max-height: 90vh;
    }
  
    #checkoutModal h2 {
      font-size: 1.1rem;
    }
  
    /* === STORE PAGE HEADER === */
    .wizard-shell {
      padding: 28px 0 !important;
    }
  
    .section-head h1 {
      font-size: 1.35rem;
    }
  
    .section-head p {
      font-size: 0.85rem;
    }
  
    .breadcrumb {
      font-size: 0.72rem;
    }
  
    /* All products heading */
    .container > h2 {
      font-size: 1.05rem !important;
      margin-bottom: 12px !important;
    }
  
    /* Featured section */
    #featuredSection h3 {
      font-size: 0.68rem !important;
      margin-bottom: 12px;
    }
  
    /* === TOAST — full width, properly positioned === */
    .toast-container {
      left: 12px !important;
      right: 12px !important;
      bottom: 16px !important;
      transform: none !important;
      align-items: stretch !important;
    }
  
    .toast {
      font-size: 0.82rem;
      padding: 14px 18px;
      width: 100%;
      max-width: 100%;
      border-radius: 10px;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
  
    /* === EMPTY STATE === */
    #emptyState {
      padding: 40px 16px !important;
      border-radius: 10px !important;
    }
  
    #emptyState h3 {
      font-size: 1rem;
    }
  
    #emptyState p {
      font-size: 0.85rem;
    }
  
    /* === BACK TO TOP === */
    .back-to-top {
      bottom: 16px;
      right: 16px;
      width: 40px;
      height: 40px;
    }
  
    .back-to-top .icon {
      width: 18px !important;
      height: 18px !important;
    }
  
    /* === FOOTER === */
    .footer-grid {
      grid-template-columns: 1fr !important;
      gap: 28px !important;
      padding: 40px 0 30px !important;
    }
  
    .footer-brand p.footer-desc {
      max-width: 100%;
    }
  
    .footer-bottom {
      flex-direction: column;
      gap: 8px;
      text-align: center;
    }
  }
  
  /* ===========================================================
     SMALL PHONES — ≤ 480px
     =========================================================== */
  
  @media (max-width: 480px) {
    /* Product image even shorter */
    .product-image {
      height: 100px !important;
      min-height: 100px !important;
    }
  
    .product-image .icon {
      width: 32px !important;
      height: 32px !important;
    }
  
    .product-title {
      font-size: 0.78rem;
    }
  
    .product-specs {
      font-size: 0.65rem;
    }
  
    .product-price {
      font-size: 0.88rem;
    }
  
    .product-btn {
      font-size: 0.72rem;
      padding: 8px 8px;
    }
  
    .product-body {
      padding: 10px 8px;
    }
  
    .product-rating .icon {
      width: 10px !important;
      height: 10px !important;
    }
  
    /* Cart qty buttons: even bigger touch targets */
    .qty-btn {
      width: 32px;
      height: 32px;
    }
  
    /* Filter buttons tighter */
    .filter-btn {
      font-size: 0.78rem;
      padding: 6px 12px;
    }
  
    /* Store header tighter */
    .store-header {
      padding: 12px 14px;
    }
  
    /* Featured section label */
    #featuredSection h3 {
      font-size: 0.62rem !important;
    }
  
    /* Section heads */
    .section-head h1 {
      font-size: 1.2rem;
    }
  
    .section-head p {
      font-size: 0.8rem;
    }
  }
  
  /* ===========================================================
     TINY PHONES — ≤ 380px
     =========================================================== */
  
  @media (max-width: 380px) {
    .product-grid {
      grid-template-columns: 1fr !important;
    }
  
    .product-card {
      max-width: 340px;
      margin: 0 auto;
      width: 100%;
    }
  
    .product-image {
      height: 120px !important;
      min-height: 120px !important;
    }
  
    .product-image .icon {
      width: 40px !important;
      height: 40px !important;
    }
  
    .product-title {
      font-size: 0.85rem;
    }
  
    .product-body {
      padding: 14px 12px;
    }
  
    .product-price {
      font-size: 1rem;
    }
  
    .product-btn {
      font-size: 0.78rem;
      padding: 10px 12px;
    }
  
    .product-footer {
      flex-direction: row;
    }
  
    .store-header {
      padding: 10px 12px;
      border-radius: 8px;
    }
  
    .filter-btn {
      font-size: 0.74rem;
      padding: 5px 10px;
    }
  
    .section-head h1 {
      font-size: 1.1rem;
    }
  
    .wizard-shell {
      padding: 20px 0 !important;
    }
  
    /* Cart item image even smaller */
    .cart-item-image {
      width: 40px;
      height: 40px;
    }
  
    .cart-item-image .icon {
      width: 18px !important;
      height: 18px !important;
    }
  
    /* Modal close button bigger */
    .modal-close {
      width: 40px;
      height: 40px;
    }
  }
  
  /* ===========================================================
     LANDSCAPE PHONES
     =========================================================== */
  
  @media (max-width: 760px) and (orientation: landscape) and (max-height: 500px) {
    .product-grid {
      grid-template-columns: repeat(3, 1fr) !important;
      gap: 10px;
    }
  
    .product-card {
      border-radius: 8px;
    }
  
    .product-body {
      padding: 10px;
    }
  
    .product-image {
      height: 100px;
    }
  
    /* Modals: center instead of bottom sheet */
    .modal-backdrop {
      padding: 16px;
      align-items: center;
    }
  
    .product-modal-content {
      border-radius: 14px;
      max-width: 500px;
      animation: scaleIn 0.25s ease-out;
    }
  }
  
  /* ===========================================================
     SLIDE UP ANIMATION for bottom-sheet modals on mobile
     =========================================================== */
  
  @keyframes slideUp {
    from { opacity: 0.5; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* ===========================================================
     SAFE AREA — notched phones
     =========================================================== */
  
  @media (max-width: 640px) {
    .container {
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
    }
  
    .cart-sidebar {
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }
  
    .modal-backdrop {
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }
  
    .back-to-top {
      bottom: max(16px, env(safe-area-inset-bottom));
      right: max(16px, env(safe-area-inset-right));
    }
  }
  
  /* ===========================================================
     REDUCED MOTION
     =========================================================== */
  
  @media (prefers-reduced-motion: reduce) {
    .product-modal-content {
      animation: none;
    }
  
    .product-card {
      transition: none;
    }
  }
  
  /* ===========================================================
     PRODUCT DETAIL MODAL — rich spec table, features, includes
     =========================================================== */
  
  .detail-section {
    margin-bottom: 20px;
  }
  
  .detail-heading {
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-light);
    margin-bottom: 12px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  
  /* Specs table */
  .spec-table {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
  }
  
  .spec-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }
  
  .spec-row:last-child {
    border-bottom: none;
  }
  
  .spec-row:nth-child(even) {
    background: var(--paper-dim);
  }
  
  .spec-label {
    font-size: 0.8rem;
    color: var(--slate-light);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 100px;
  }
  
  .spec-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink);
    text-align: right;
  }
  
  /* Feature tags */
  .feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--paper-dim);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--slate);
    transition: border-color 0.15s;
  }
  
  .feature-tag:hover {
    border-color: var(--amber-dark);
    color: var(--amber-dark);
  }
  
  .feature-tag::before {
    content: "✓";
    color: var(--green);
    font-weight: 700;
    font-size: 0.72rem;
  }
  
  /* Includes list */
  .includes-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  .includes-list li {
    padding: 8px 0 8px 24px;
    position: relative;
    font-size: 0.85rem;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
  }
  
  .includes-list li:last-child {
    border-bottom: none;
  }
  
  .includes-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: var(--green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .includes-list li::after {
    content: "✓";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }
  
  /* Price bar in modal */
  .detail-price-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--paper-dim);
    border-radius: 10px;
    margin-bottom: 14px;
  }
  
  /* Mobile responsive for detail modal */
  @media (max-width: 640px) {
    .detail-heading {
      font-size: 0.66rem;
    }
  
    .spec-row {
      padding: 9px 12px;
    }
  
    .spec-label {
      font-size: 0.75rem;
      min-width: 80px;
    }
  
    .spec-value {
      font-size: 0.78rem;
    }
  
    .feature-tag {
      font-size: 0.72rem;
      padding: 5px 10px;
    }
  
    .includes-list li {
      font-size: 0.8rem;
      padding: 7px 0 7px 22px;
    }
  
    .detail-price-bar {
      padding: 14px;
    }
  
    .detail-price-bar > div > div:last-child {
      font-size: 1.35rem !important;
    }
  }
  
  @media (max-width: 380px) {
    .spec-row {
      flex-direction: column;
      gap: 2px;
      padding: 8px 10px;
    }
  
    .spec-label {
      min-width: 0;
    }
  
    .spec-value {
      text-align: left;
    }
  }
  



