/* Shop Styles - EllyIce E-commerce */

/* ===================================
   FIXED NAVIGATION
   ================================== */
.nav--fixed {
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 50;
    color: var(--color-white);
}

.nav--fixed .nav__container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.nav--fixed .nav__logo {
    flex-shrink: 0;
    margin-right: 1.5rem;
}

.nav--fixed .nav__logo img {
    height: 45px;
    width: auto;
}

.nav--fixed .nav__menu {
    display: flex;
    gap: 2rem;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav--fixed .nav__link {
    color: var(--color-white);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s;
    font-size: 1rem;
}

.nav--fixed .nav__link:hover {
    opacity: 0.8;
}

.nav--fixed .nav__link--active {
    position: relative;
    font-weight: 700;
}

.nav--fixed .nav__link--active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-white);
}

/* Cart Button in Nav */
.btn--cart {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-white);
    color: var(--color-primary);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn--cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#cartCount {
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 800;
}

/* ===================================
   PAGE SPACING FOR FIXED NAV
   ================================== */
.products-page,
.checkout-section {
    padding-top: 90px;
    min-height: 100vh;
    background: #f9fafb;
}

.products-page__title,
.checkout__title {
    font-weight: 800;
    font-size: clamp(1.75rem, 4vw, 3rem);
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 2rem;
}

/* ===================================
   CATEGORY DROPDOWN FILTER
   ================================== */
.category-dropdown {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 0 auto 3rem;
    max-width: 400px;
    padding: 0 1rem;
}

.category-dropdown__toggle {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: var(--color-white);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.category-dropdown__toggle:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary-light);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(190, 18, 65, 0.2);
}

.category-dropdown__arrow {
    transition: transform 0.3s;
    flex-shrink: 0;
}

.category-dropdown__toggle.open .category-dropdown__arrow {
    transform: rotate(180deg);
}

.category-dropdown__menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 100;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

.category-dropdown__menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.category-dropdown__item {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: var(--color-white);
    border: none;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    font-weight: 600;
    font-size: 0.9375rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.category-dropdown__item:last-child {
    border-bottom: none;
}

.category-dropdown__item:hover {
    background: #f3f4f6;
    color: var(--color-primary);
    padding-left: 1.5rem;
}

.category-dropdown__item--active {
    background: var(--color-primary);
    color: var(--color-white);
    font-weight: 700;
}

.category-dropdown__item--active:hover {
    background: var(--color-primary-light);
    color: var(--color-white);
}

/* ===================================
   PRODUCTS GRID - RESPONSIVE
   ================================== */
.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding: 0 1rem;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

/* Tablet: 2 columns */
@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
        padding: 0 2rem;
    }
}

/* Large Desktop: 4 columns */
@media (min-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* ===================================
   PRODUCT CARD
   ================================== */
.product-card {
    background: var(--color-white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e5e7eb;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(190, 18, 65, 0.15);
    border-color: var(--color-primary-light);
}

.product-card__image-wrapper {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
    background: #f3f4f6;
}

@media (min-width: 640px) {
    .product-card__image-wrapper {
        height: 250px;
    }
}

@media (min-width: 1024px) {
    .product-card__image-wrapper {
        height: 280px;
    }
}

.product-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-card__image {
    transform: scale(1.08);
}

.product-card__badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--color-primary);
    color: var(--color-white);
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.product-card__content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-card__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    margin: 0;
    min-height: 2.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 600;
    margin: 0;
}

.product-card__description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.product-card__footer {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-top: auto;
    padding-top: 0.875rem;
    border-top: 1px solid #e5e7eb;
}

.product-card__price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
    margin: 0;
}

.product-card__actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.btn-add-to-cart,
.btn-view-details {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-align: center;
    white-space: nowrap;
    display: inline-block;
    text-decoration: none;
}

.btn-add-to-cart {
    background: var(--color-primary);
    color: var(--color-white);
    border: 2px solid var(--color-primary);
}

.btn-add-to-cart:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(190, 18, 65, 0.3);
}

.btn-view-details {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-view-details:hover {
    background: var(--color-primary);
    color: var(--color-white);
    transform: translateY(-2px);
}

/* ===================================
   CART SIDEBAR
   ================================== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    background: var(--color-white);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.2);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-sidebar.open {
    right: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar__header {
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--color-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.cart-sidebar__header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
}

.cart-sidebar__close {
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.cart-sidebar__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cart-sidebar__items {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 12px;
    transition: all 0.3s;
}

.cart-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cart-item__image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.cart-item__details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cart-item__title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.cart-item__price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-primary);
}

.cart-item__quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #d1d5db;
    background: var(--color-white);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #374151;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: #f3f4f6;
    border-color: var(--color-primary);
}

.cart-item__remove {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: underline;
    padding: 0;
    font-weight: 600;
}

.cart-sidebar__footer {
    padding: 1.25rem;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.cart-sidebar__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--color-white);
    border-radius: 12px;
}

/* iOS Safari fix - inline checkout button */
.cart-ios-footer {
    padding: 1.5rem;
    margin-top: 1.5rem;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 12px;
}

.cart-ios-footer .cart-sidebar__total {
    margin-bottom: 1rem;
}

.cart-sidebar__total span:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
}

#cartTotal {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-primary);
}

.cart-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #6b7280;
}

.cart-empty__icon {
    font-size: 48px;
    margin-bottom: 1rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 4rem 1rem;
    color: #6b7280;
    grid-column: 1 / -1;
}

.loading__spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================================
   MOBILE RESPONSIVE
   ================================== */
@media (max-width: 768px) {
    .nav--fixed .nav__container {
        padding: 0.75rem 1rem;
        min-height: 60px;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .nav--fixed .nav__logo img {
        height: 40px;
    }

    .nav--fixed .nav__menu {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav--fixed .nav__link {
        font-size: 0.875rem;
    }

    .products-page,
    .checkout-section,
    .products-page__title {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }

    .category-dropdown {
        margin-bottom: 2rem;
    }

    .cart-sidebar {
        max-width: 100%;
    }
}

/* Center logo on checkout page (mobile) */
@media (max-width: 768px) {
    .page-checkout .nav--fixed .nav__logo {
        margin-right: 0;
        width: 100%;
        text-align: center;
    }
    .page-checkout .nav--fixed .nav__logo img {
        display: inline-block;
        margin: 0 auto;
    }
}

/* Mid phones: 481px - 768px */
@media (min-width: 481px) and (max-width: 768px) {
    .checkout__title { font-size: 1.4rem; }
    .checkout__subtitle { font-size: 1.05rem; }
    .form-label { font-size: 0.95rem; }
    .form-input, .form-textarea { font-size: 1rem; }
    .order-summary__title { font-size: 1.05rem; }
    .order-summary__total { font-size: 1.05rem; }
    .order-summary__amount { font-size: 1.25rem; }
}

/* Extra-small phones */
@media (max-width: 480px) {
    .checkout__title { font-size: 1.25rem; margin-bottom: 0.75rem; }
    .checkout__subtitle { font-size: 1rem; margin: 0 0 0.75rem; }
    .form-label { font-size: 0.9rem; }
    .form-input, .form-textarea { font-size: 0.95rem; }

    .order-summary__title { font-size: 1rem; }
    .order-item__title { font-size: 0.95rem; }
    .order-item__price { font-size: 0.95rem; }
    .order-summary__total { font-size: 0.95rem; }
    .order-summary__amount { font-size: 1.125rem; }
    .order-summary__note { font-size: 0.85rem; }

    .modal__title { font-size: 1.125rem; }
    .modal__text { font-size: 0.9rem; }
}

/* Ultra-small devices */
@media (max-width: 360px) {
    .checkout__title { font-size: 1.1rem; }
    .checkout__subtitle { font-size: 0.95rem; }
    .form-label { font-size: 0.85rem; }
    .form-input, .form-textarea { font-size: 0.9rem; }

    .order-summary__title { font-size: 0.95rem; }
    .order-summary__total { font-size: 0.9rem; }
    .order-summary__amount { font-size: 1rem; }

    .modal__title { font-size: 1rem; }
    .modal__text { font-size: 0.85rem; }
}

/* ===================================
   CHECKOUT LAYOUT
   ================================== */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    align-items: stretch;
}

.checkout-form-wrapper {
    background: var(--color-white);
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.checkout-form .form-group { margin-bottom: 1rem; }
.form-label { font-weight: 700; color: #374151; display: block; margin-bottom: 0.375rem; }
.form-input { width: 100%; border: 1px solid #d1d5db; border-radius: 10px; padding: 0.75rem 0.9rem; }
.form-textarea { resize: vertical; }

.order-summary {
    background: var(--color-white);
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.order-summary__title { margin-top: 0; margin-bottom: 1rem; font-weight: 800; color: #111827; }
.order-summary__items { display: flex; flex-direction: column; gap: 0.75rem; }
.order-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; background: #f9fafb; border-radius: 10px; }
.order-item__title { font-size: 1rem; }
.order-item__quantity { font-size: 0.95rem; color: #4b5563; }
.order-item__price { font-size: 1rem; font-weight: 700; color: #111827; }
.order-summary__divider { height: 1px; background: #e5e7eb; margin: 1rem 0; }
.order-summary__total { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 1.125rem; }
.order-summary__amount { color: var(--color-primary); font-size: 1.5rem; }

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

@media (max-width: 768px) {
    .order-item__title { font-size: 0.95rem; }
    .order-item__quantity { font-size: 0.9rem; }
    .order-item__price { font-size: 0.95rem; }
}

@media (max-width: 360px) {
    .order-item__title { font-size: 0.9rem; }
    .order-item__quantity { font-size: 0.85rem; }
    .order-item__price { font-size: 0.9rem; }
}

/* ===================================
   SUCCESS MODAL
   ================================== */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,0.45); z-index: 1100; }
.modal__content { background: #fff; border-radius: 16px; padding: 2rem; width: min(520px, 92%); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal__icon { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 999px; background: #10b981; color: white; display: grid; place-items: center; font-size: 2rem; font-weight: 800; }
.modal__title { margin: 0.25rem 0 0.75rem; color: #111827; }
.modal__text { color: #374151; }

/* Full-width primary button for success modal */
.checkout-section .modal__content .btn--primary,
.checkout-section .modal__content .btn.btn--primary,
.checkout-section .modal__content a.btn--primary {
    width: 100%;
    display: inline-block;
    text-align: center;
    border-radius: 12px;
}

/* Success modal secondary button with visible contrast */
.btn--secondary-alt {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    text-align: center;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn--secondary-alt:hover {
    background: var(--color-primary);
    color: var(--color-white);
    transform: translateY(-1px);
}

/* Checkout-only nav spacing between menu and cart button */
.page-checkout .nav--fixed .nav__cta { margin-left: 1.25rem; }

/* ===================================
   RESPONSIVE TWEAKS (MOBILE)
   ================================== */
@media (max-width: 768px) {
    .checkout__title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .order-summary__amount { font-size: 1.25rem; }
    .order-summary__total { font-size: 1rem; }

    .checkout-form-wrapper, .order-summary {
        padding: 1rem;
        border-radius: 12px;
    }

    .modal__content { padding: 1.25rem; }
    .modal__icon { width: 52px; height: 52px; font-size: 1.5rem; }
    .modal__title { font-size: 1.25rem; }
    .modal__text { font-size: 0.95rem; }
}

@media (max-width: 480px) {
    .product-card__title {
        font-size: 1rem;
    }

    .product-card__price {
        font-size: 1.25rem;
    }

    .btn-add-to-cart,
    .btn-view-details {
        font-size: 0.8125rem;
        padding: 0.625rem 0.875rem;
    }

    .cart-item__image {
        width: 60px;
        height: 60px;
    }
}