/* --- App.css: UI polish + animations + mobile tabbar + skeletons --- */

/* Fluid type scale */
:root{
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --grad-1: radial-gradient(1200px 600px at 20% -10%, #2f86f6 0%, rgba(47,134,246,0) 60%),
            radial-gradient(800px 500px at 110% 10%, #ff6b6b 0%, rgba(255,107,107,0) 60%);
  --blur-bg: rgba(21,22,24,.55);
}

/* Page backdrop accent */
.app-backdrop::before{
  content:""; position:fixed; inset:-10%; z-index:-1; background:var(--grad-1);
  filter: blur(40px) saturate(120%);
}

/* Cards */
.app-card{
  border:1px solid #232427; background:rgba(21,22,24,.85);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* Buttons w/ subtle ripple */
.btn.app{
  position:relative; overflow:hidden; border-radius: 12px;
  transition: transform .12s ease, opacity .12s ease;
}
.btn.app:active{ transform: translateY(1px) scale(.99); }
.btn.app .ripple{
  position:absolute; border-radius:50%; transform:scale(0); animation:ripple .6s linear;
  background:rgba(255,255,255,.25); pointer-events:none;
}
@keyframes ripple{ to{ transform:scale(12); opacity:0; } }

/* Reveal-on-scroll */
.reveal{ opacity:0; transform: translateY(18px); transition: opacity .5s ease, transform .5s ease; }
.reveal.show{ opacity:1; transform: none; }

/* Skeletons */
.skel{ position:relative; overflow:hidden; background:#0f0f11; border-radius:12px; }
.skel::after{
  content:""; position:absolute; inset:0;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  transform:translateX(-100%); animation:shimmer 1.3s infinite;
}
@keyframes shimmer{ to{ transform:translateX(100%); } }

/* Image wrappers (no crop) */
.fit-contain{ object-fit:contain !important; object-position:center center; background:#0f0f11; }

/* Modal sheet (mobile filters / gallery etc.) */
.sheet{
  position:fixed; left:0; right:0; bottom:-100%; background:#121316; color:#e9eaec;
  border-top-left-radius:22px; border-top-right-radius:22px; padding:16px; z-index:10000;
  box-shadow: 0 -20px 40px rgba(0,0,0,.55);
  transition: bottom .32s cubic-bezier(.2,.8,.2,1);
}
.sheet.open{ bottom:0; }
.sheet .handle{ width:44px; height:4px; background:#2a2b2f; border-radius:999px; margin:6px auto 12px; }

/* Floating Action Button */
.fab{
  position:fixed; right:16px; bottom:16px; /* Adjusted bottom for consistency */ z-index:1000;
  width:56px; height:56px; border-radius:50%; display:grid; place-items:center;
  background:#2f86f6; color:#fff; border:none; box-shadow: var(--shadow); cursor:pointer;
  transform: translateY(20px); opacity:0; pointer-events:none; transition:.2s ease;
}
.fab.show{ transform:none; opacity:1; pointer-events:auto; }

/* --- CORRECTED: Mobile Tab Bar (sticky & mobile-only) --- */
@media (max-width: 767px) {
  .tabbar{
    position: sticky; /* THIS IS THE MAIN FIX */
    bottom: 0;
    left:0; 
    right:0; 
    z-index:999;
    
    /* Visual styles remain the same */
    backdrop-filter:saturate(140%) blur(10px);
    background: var(--blur-bg); 
    border-top:1px solid #232427;
    display:grid; 
    grid-template-columns: repeat(4,1fr);
    
    /* Add safe area for phones with notches/home bar */
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a{
    padding:10px 6px; text-align:center; color:#9aa0a6; text-decoration:none; font-weight:700;
    display:grid; gap:4px; align-items:center; justify-items:center;
  }
  .tabbar a.active{ color:#fff; }
  .tabbar svg{ width:22px; height:22px; }

  /* Adjust FAB position to be above the tab bar */
  .fab {
    bottom: 80px;
  }
}
@media (min-width: 768px) {
    .tabbar {
        display: none;
    }
}


/* Page transitions (optional if you ajaxify later) */
.page-enter{ opacity:0; transform: translateY(12px); }
.page-enter.page-enter-active{ opacity:1; transform:none; transition: .28s ease; }


/* --- START: Catalog & Product Grid Styles (Version 2.0) --- */
.catalog-page .page-title { margin-bottom: 1.5rem; font-size: 2.5rem; text-align: center; }
.promo-banner { background: var(--grad-1); border-radius: var(--radius); padding: 2.5rem 1.5rem; margin-bottom: 2rem; text-align: center; box-shadow: var(--shadow); border: 1px solid rgba(255, 255, 255, 0.1); }
.promo-banner h2 { margin-top: 0; margin-bottom: 0.5rem; font-size: 1.75rem; color: #fff; }
.promo-banner p { margin-bottom: 1.5rem; opacity: 0.9; font-size: 1rem; }
.btn.btn-promo { background-color: #fff; color: #151618; font-weight: bold; }
.catalog-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; gap: 1rem; }
.filter-controls .btn { display: flex; align-items: center; gap: 0.5rem; }
.desktop-cat-nav { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.cat-chip { display: inline-block; padding: 0.5rem 1rem; border-radius: 999px; background-color: #2a2b2f; color: #e9eaec; text-decoration: none; font-weight: 500; transition: all 0.2s ease; border: 1px solid #3a3b3f; }
.cat-chip:hover { background-color: #3a3b3f; transform: translateY(-2px); }
.cat-chip.is-active { background-color: #2f86f6; color: #fff; border-color: #2f86f6; font-weight: bold; }
.mobile-cat-nav { display: none; }
.filter-panel { position: fixed; top: 0; right: -100%; width: 320px; max-width: 90%; height: 100%; background: #151618; z-index: 1002; transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,0.5); }
.filter-panel.is-open { right: 0; }
.filter-panel__header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid #2a2b2f; }
.filter-panel__header h3 { margin: 0; }
.close-btn { background: none; border: none; font-size: 2rem; color: #9aa0a6; cursor: pointer; }
.filter-panel__body { padding: 1.5rem; overflow-y: auto; flex-grow: 1; }
.filter-group { margin-bottom: 1.5rem; }
.filter-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: #9aa0a6; }
.filter-group select, .filter-group input[type="number"] { width: 100%; background-color: #0f0f11; border: 1px solid #3a3b3f; color: #e9eaec; padding: 0.75rem; border-radius: 8px; font-size: 1rem; }
.price-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.filter-panel__footer { padding: 1rem 1.5rem; border-top: 1px solid #2a2b2f; display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; }
.btn.text-btn { background: none; color: #9aa0a6; text-decoration: underline; }
.filter-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 1001; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.filter-overlay.is-open { opacity: 1; pointer-events: auto; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.product-card { background: var(--blur-bg); border: 1px solid #232427; border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.product-card__image-link { display: block; position: relative; background-color: #0f0f11; }
.product-card__image { width: 100%; height: 250px; object-fit: cover; display: block; }
.product-card__badge { position: absolute; top: 1rem; left: 1rem; background-color: #2f86f6; color: #fff; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: bold; }
.product-card__body { padding: 1rem; flex-grow: 1; }
.product-card__title { margin: 0 0 0.5rem; font-size: 1.1rem; line-height: 1.4; height: 2.8em; overflow: hidden; }
.product-card__title a { color: inherit; text-decoration: none; }
.product-card__price { font-size: 1.5rem; font-weight: bold; color: #fff; }
.product-card__actions { padding: 0 1rem 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.product-card__actions .btn { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-weight: bold; }
.btn.btn-primary { background-color: #2f86f6; color: #fff; }
.btn.btn-secondary { background-color: #2a2b2f; color: #e9eaec; }
.empty-state { text-align: center; padding: 4rem 1rem; background: rgba(21,22,24,.5); border: 1px dashed #3a3b3f; border-radius: var(--radius); margin-top: 2rem; }
.empty-state h3 { font-size: 1.5rem; margin-top: 0; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin-top: 3rem; flex-wrap: wrap; }
.pagination__link { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background-color: #2a2b2f; color: #e9eaec; text-decoration: none; font-weight: 500; transition: all 0.2s ease; }
.pagination__link:hover { background-color: #3a3b3f; }
.pagination__link.is-active { background-color: #2f86f6; color: #fff; font-weight: bold; }
@media (max-width: 767px) {
    .catalog-page .page-title { font-size: 2rem; }
    .desktop-cat-nav { display: none; }
    .mobile-cat-nav { display: block; position: relative; flex-grow: 1; }
    .mobile-cat-nav__toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0.75rem 1rem; font-size: 1rem; text-align: left; background-color: #2a2a2e; color: #fff; border: 1px solid #444; border-radius: 8px; cursor: pointer; }
    .mobile-cat-nav__toggle .chevron { transition: transform 0.2s ease-in-out; stroke: #fff; stroke-width: 2px; }
    .mobile-cat-nav.is-open .mobile-cat-nav__toggle .chevron { transform: rotate(180deg); }
    .mobile-cat-nav__list { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background-color: #2a2a2e; border: 1px solid #444; border-radius: 8px; padding: 0.5rem; z-index: 100; max-height: 250px; overflow-y: auto; }
    .mobile-cat-nav.is-open .mobile-cat-nav__list { display: block; }
    .mobile-cat-nav__item { display: block; padding: 0.75rem 1rem; color: #fff; text-decoration: none; border-radius: 6px; }
    .mobile-cat-nav__item.is-active { background-color: #444; font-weight: bold; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
    .product-card__actions { grid-template-columns: 1fr; }
}
/* --- START: Responsive Header Styles --- */
.site-header { padding: 1rem 0; position: sticky; top: 0; z-index: 999; backdrop-filter: saturate(140%) blur(10px); background: var(--blur-bg); border-bottom: 1px solid #232427; transition: all 0.2s ease-in-out; }
.header-grid { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: #fff; font-weight: bold; font-size: 1.25rem; }
.brand__name { display: block; }
.search-form { display: flex; width: 100%; max-width: 400px; margin: 0 auto; }
.search-form input[type="search"] { flex-grow: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; background-color: #0f0f11; border-color: #3a3b3f; }
.search-form .search-form__btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.header-actions--mobile { display: none; }
.icon-btn { background: none; border: none; color: #fff; padding: 0.5rem; cursor: pointer; }
.mobile-search-panel { display: none; padding: 1rem 0; background: #151618; border-bottom: 1px solid #2a2b2f; }
.mobile-search-panel.is-open { display: block; }
.main-content-wrapper { margin-top: 24px; }
@media (max-width: 767px) {
  .header-grid { grid-template-columns: 1fr auto; }
  .brand__name { display: none; }
  .header-search--desktop { display: none; }
  .header-actions--mobile { display: flex; align-items: center; gap: 0.5rem; }
}
/* --- START: Breadcrumbs & Product Detail Page Styles --- */
.breadcrumb-nav { margin-bottom: 1rem; font-size: 0.9rem; }
.breadcrumb-nav__list { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; color: #9aa0a6; align-items: center; }
.breadcrumb-nav__item a { color: #9aa0a6; text-decoration: none; transition: color 0.2s ease; }
.breadcrumb-nav__item a:hover { color: #fff; }
.breadcrumb-nav__separator { margin: 0 0.5rem; color: #5f6368; }
.product-detail-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 768px) { .product-detail-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; } }
.product-gallery { display: grid; grid-template-columns: 80px 1fr; gap: 1rem; }
.product-gallery__main-image { order: 2; position: relative; background: #0f0f11; border-radius: var(--radius); overflow: hidden; }
.product-gallery__main-image img { width: 100%; height: 100%; aspect-ratio: 1/1; object-fit: contain; cursor: pointer; }
.zoom-btn { position: absolute; top: 1rem; right: 1rem; background: var(--blur-bg); border: 1px solid #232427; color: #fff; border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; opacity: 0.7; transition: opacity 0.2s ease; }
.zoom-btn:hover { opacity: 1; }
.product-gallery__thumbnails { order: 1; display: flex; flex-direction: column; gap: 0.75rem; }
.thumbnail { border: 2px solid transparent; border-radius: 8px; padding: 2px; background: none; cursor: pointer; overflow: hidden; transition: border-color 0.2s ease; }
.thumbnail.is-active { border-color: #2f86f6; }
.thumbnail img { width: 100%; height: auto; aspect-ratio: 1/1; object-fit: cover; display: block; border-radius: 6px; }
@media (max-width: 767px) {
    .product-gallery { grid-template-columns: 1fr; }
    .product-gallery__main-image { order: 1; }
    .product-gallery__thumbnails { order: 2; flex-direction: row; flex-wrap: wrap; }
    .thumbnail { width: 64px; height: 64px; }
}
.product-info__category { display: inline-block; color: #9aa0a6; text-decoration: none; margin-bottom: 0.75rem; font-size: 0.9rem; }
.product-info__title { margin: 0; font-size: 2.25rem; line-height: 1.2; }
.product-info__meta { color: #5f6368; margin: 0.75rem 0; display: flex; gap: 1.5rem; }
.product-info__price-box { display: flex; align-items: baseline; gap: 1rem; margin: 1.5rem 0; padding: 1rem; background: rgba(47,134,246,0.1); border-radius: 12px; border: 1px solid #2f86f6; }
.product-info__price-box .price { font-size: 2.5rem; font-weight: bold; color: #fff; }
.product-info__price-box .old-price { font-size: 1.5rem; color: #9aa0a6; text-decoration: line-through; }
.product-info__stock-status { display: flex; align-items: center; gap: 0.5rem; font-weight: bold; margin-bottom: 1.5rem; }
.product-info__stock-status.in-stock { color: #57d18a; }
.product-info__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.btn.btn-lg { padding: 1rem; font-size: 1.1rem; }
.product-info__accordion { border-top: 1px solid #232427; }
.accordion-item { border-bottom: 1px solid #232427; }
.accordion-header { width: 100%; text-align: left; background: none; border: none; color: #e9eaec; padding: 1rem 0; font-size: 1.1rem; font-weight: 500; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.accordion-header::after { content: '+'; font-size: 1.5rem; transition: transform 0.2s ease; }
.accordion-item.is-open .accordion-header::after { transform: rotate(45deg); }
.accordion-content { display: none; padding-bottom: 1rem; line-height: 1.7; color: #9aa0a6; }
.accordion-item.is-open .accordion-content { display: block; }
.related-products-section { margin-top: 4rem; padding: 3rem 0; border-top: 1px solid #232427; }
.section-title { font-size: 1.75rem; text-align: center; margin-bottom: 2rem; }
.related-carousel__track { display: flex; gap: 1.5rem; overflow-x: auto; padding-bottom: 1rem; scroll-snap-type: x mandatory; }
.related-carousel__track::-webkit-scrollbar { height: 8px; }
.related-carousel__track::-webkit-scrollbar-thumb { background: #2a2d33; border-radius: 8px; }
.product-card-mini { flex: 0 0 250px; scroll-snap-align: start; background: var(--blur-bg); border: 1px solid #232427; border-radius: var(--radius); }
.product-card-mini__image-link img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.product-card-mini__body { padding: 1rem; }
.product-card-mini__title { font-size: 1rem; margin: 0 0 0.5rem; height: 3.2em; overflow: hidden; }
.product-card-mini__title a { color: inherit; text-decoration: none; }
.product-card-mini__price { font-size: 1.1rem; font-weight: bold; margin-bottom: 1rem; }
.product-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 10000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.product-lightbox.is-open { opacity: 1; pointer-events: auto; }
.lightbox-btn { position: absolute; background: rgba(0,0,0,0.3); color: #fff; border: 1px solid #555; cursor: pointer; width: 50px; height: 50px; border-radius: 50%; font-size: 2rem; display: grid; place-items: center; }
.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-image-container { max-width: 90vw; max-height: 80vh; }
.lightbox-image-container img { width: 100%; height: 100%; object-fit: contain; }
/* Helper class to prevent body scroll */
.body-no-scroll { overflow: hidden; }
@media (max-width: 768px){
  .promo-banner .ratio-pad{ padding-top:56.25% !important; } /* 16:9 on mobile */
}
