/* --------------------------------------------------
   GLOBAL / RESET
-------------------------------------------------- */

body {
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* --------------------------------------------------
   PRODUCT IMAGE: SKELETON SHIMMER
-------------------------------------------------- */

.product-image-wrapper {
    position: relative;
    overflow: hidden;
}

.skeleton-loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.2s ease-in-out infinite;
}

.skeleton-loading .product-image {
    opacity: 0;
}

@keyframes skeleton-loading {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --------------------------------------------------
   PRODUCT IMAGE: HOVER ZOOM
-------------------------------------------------- */

.product-image {
    transition: opacity .25s ease-in-out, transform .25s ease-in-out;
}

.product-image:hover {
    transform: scale(1.05);
}

/* --------------------------------------------------
   ADD TO CART BUTTON (PILL STYLE)
-------------------------------------------------- */

.btn-cart {
    background-color: #f8d7da;
    color: #721c24;
    border: none;
    border-radius: 50rem;
    padding: 0.375rem 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-cart:hover {
    background-color: #f1b0b7;
    color: #491217;
    transform: scale(1.05);
    box-shadow: 0 0 0.25rem rgba(0,0,0,0.1);
}

/* --------------------------------------------------
   PRODUCT TEXT ALIGNMENT (DESKTOP)
-------------------------------------------------- */

@media (min-width: 576px) {
    .product-text-block {
        min-height: 90px;
    }
}

/* --------------------------------------------------
   CART QUANTITY PILL
-------------------------------------------------- */

.cart-qty-pill {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #dc3545;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 50rem;
    z-index: 5;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

/* --------------------------------------------------
   EDITABLE PILL
-------------------------------------------------- */

.editable-pill {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #dc3545;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 50rem;
    z-index: 6;
    width: 34px;
    text-align: center;
    border: none;
    -moz-appearance: textfield;
}

.editable-pill:focus {
    outline: none;
    background-color: #b02a37;
}

.editable-pill::-webkit-inner-spin-button,
.editable-pill::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --------------------------------------------------
   ANIMATIONS
-------------------------------------------------- */

@keyframes pillAppear {
    to { opacity: 1; transform: scale(1); }
}

.pill-fade-in {
    opacity: 0;
    transform: scale(0.85);
    animation: pillAppear 0.25s ease-out forwards;
}

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.3s ease-in-out;
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.8); }
}

.fade-out {
    animation: fadeOut 0.25s ease-in-out forwards;
}

/* --------------------------------------------------
   CATEGORY NAV (MOBILE HORIZONTAL SCROLL)
-------------------------------------------------- */

@media (max-width: 767.98px) {
    .category-nav-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .category-nav-wrapper::-webkit-scrollbar { display: none; }
    .category-nav {
        flex-wrap: nowrap !important;
        white-space: nowrap;
    }
    .category-nav .nav-link {
        flex: 0 0 auto;
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }
}

/* --------------------------------------------------
   MOBILE STICKY CART BUTTON
-------------------------------------------------- */

.sticky-cart-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(6px);
    box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
    z-index: 999;
}

@media (max-width: 575.98px) {
    .sticky-cart-btn {
        padding: 16px;
    }

    body {
        padding-bottom: 80px;
    }
}

/* --------------------------------------------------
   CARD LAYOUT (DESKTOP)
-------------------------------------------------- */

@media (min-width: 576px) {
    .card {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .card-body {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        justify-content: space-between;
    }

    .product-stock-block {
        min-height: 20px;
        margin-top: auto;
    }
}

/* --------------------------------------------------
   CARD HOVER
-------------------------------------------------- */

.card:hover {
    box-shadow: 0 0 0.5rem rgba(0,0,0,0.1);
    transform: translateY(-2px);
    transition: all 0.2s ease-in-out;
}

/* --------------------------------------------------
   TOASTS
-------------------------------------------------- */

#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
}

.toast-message {
    background: #343a40;
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    box-shadow: 0 0 0.5rem rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(-5px);
    animation: toastIn 0.2s forwards;
}

.toast-message.toast-error {
    background: #b02a37;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------
   MINI CART + DRAWER
-------------------------------------------------- */

.mini-cart-wrapper { position: relative; }

.mini-cart-dropdown {
    position: absolute;
    right: 0;
    top: 120%;
    width: 260px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all .2s ease;
    z-index: 1000;
}

.mini-cart-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.0);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, background .25s ease;
    z-index: 1200;
}

#cart-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
    background: rgba(0,0,0,0.4);
}

#cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 360px;
    max-width: 90%;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0,0,0,0.15);
    z-index: 1300;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: right .35s cubic-bezier(.25,.8,.25,1);
}

#cart-drawer.open {
    right: 0;
}

/* --------------------------------------------------
   PDP THUMBNAILS
-------------------------------------------------- */

.pdp-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent !important;
    transition: border-color 0.2s ease;
}

.pdp-thumb:hover { border-color: #999 !important; }
.pdp-thumb.active { border-color: #000 !important; }

.pdp-main-img {
    transition: opacity .3s ease-in-out;
    opacity: 1;
}

.pdp-main-img.fade {
    opacity: 0;
}

/* --------------------------------------------------
   NAVBAR
-------------------------------------------------- */

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: #0d6efd;
}

/* --------------------------------------------------
   CHECKOUT + ACCOUNT + LOGIN (NO ANIMATIONS)
-------------------------------------------------- */

.checkout-page *:not(.btn),
.account-page *:not(.btn),
.login-page *:not(.btn) {
    animation: none !important;
    transition: none !important;
}

.checkout-card,
.account-card,
.login-card {
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 10px;
    background: #fff;
}

/* --------------------------------------------------
   ACCOUNT SIDEBAR
-------------------------------------------------- */

.account-sidebar .list-group-item {
    border: none;
    border-radius: 8px !important;
    margin-bottom: 2px;
    font-weight: 500;
    color: #333;
}

.account-sidebar .list-group-item:hover {
    background-color: #f8f9fa;
}

.account-sidebar .list-group-item.active {
    background-color: #212529;
    color: #fff;
    border-color: transparent;
}

/* Mobile: horizontal scrollable tabs */
@media (max-width: 991.98px) {
    .account-sidebar {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .account-sidebar::-webkit-scrollbar {
        display: none;
    }

    .account-sidebar .list-group-item {
        text-align: center;
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        margin-bottom: 0;
    }
}

/* --------------------------------------------------
   PRODUCT GRID (DESKTOP)
-------------------------------------------------- */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* --------------------------------------------------
   MOBILE PRODUCT GRID (FINAL FIXED VERSION)
-------------------------------------------------- */

@media (max-width: 768px) {

  /* 2-column grid */
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 0 0.75rem;
  }

  /* Card structure */
  .product-grid .card {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
  }

  /* FIX: Align rows by normalizing text block height */
  .product-text-block {
    min-height: 6rem;
  }

  /* FIX: Stock text stays at bottom */
  .product-stock-block {
    margin-top: auto;
    min-height: 1.2rem;
  }

  /* FIX: Quantity input + Add-to-cart icon same height */
  .quantity-input,
  .add-to-cart-btn {
    height: 40px;
    padding: 0.4rem;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  /* Hide text on mobile, icon only */
  .add-to-cart-btn .add-to-cart-text {
    display: none;
  }

  .add-to-cart-btn i {
    font-size: 1.3rem;
    margin-right: 0;
  }

  /* Slightly smaller fonts for mobile */
  .card-title {
    font-size: 1rem;
  }

  .card-text {
    font-size: 0.85rem;
    line-height: 1.3;
  }
}
/* ==========================================
   MOBILE HEADER ICONS (ALWAYS VISIBLE)
   ========================================== */

/* Icon button styling */
.btn-link.text-dark {
    text-decoration: none;
}

.btn-link.text-dark:hover {
    color: #0d6efd !important;
}

/* Ensure proper positioning on mobile */
@media (max-width: 991.98px) {
    .navbar > .navbar-brand {
        order: 1;
    }

    .navbar > .navbar-toggler {
        order: 2;
        margin-left: 0.5rem;
    }

    .navbar > .d-flex {
        order: 3;
    }

    .navbar > .navbar-collapse {
        order: 4;
        width: 100%;
    }
}

/* Adjust mini-cart dropdown positioning for new layout */
.mini-cart-wrapper .mini-cart-dropdown {
    right: 0;
    left: auto;
}

/* Cart count badge - ensure it's visible */
.badge.global-cart-count {
    min-width: 1.2em;
    padding: 0.25em 0.4em;
}

/* ==========================================
   SEARCH OVERLAY
   ========================================== */

#search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    z-index: 1400;
    padding: 0 1rem;
    height: 64px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transform: translateY(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#search-overlay.open {
    transform: translateY(0);
}

#search-overlay input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.05rem;
    background: transparent;
}

#search-overlay-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: #666;
    font-size: 1rem;
}

#search-overlay-close:hover {
    color: #000;
}

/* ==========================================
   LOGO / NAVBAR BRAND
   ========================================== */

.navbar-brand img {
    height: 40px;
    width: auto;
}

/* Center logo on mobile, hamburger stays left */
@media (max-width: 991.98px) {
    .navbar-brand {
        position: absolute;
        left: 50%;
        top: 0.5rem;
        transform: translateX(-50%);
    }
}

/* --------------------------------------------------
   CHECKOUT: PAYMENT METHOD OPTIONS
-------------------------------------------------- */

.payment-method-option {
    cursor: pointer;
    border-color: #dee2e6 !important;
}

.payment-method-option:hover {
    border-color: #adb5bd !important;
    background-color: #f8f9fa;
}

.payment-method-option.selected {
    border-color: #212529 !important;
    background-color: #f8f9fa;
}
