/* ══════════════════════════════════════════════════════════════════
   ADAM SHOES - Product Detail Page
   ══════════════════════════════════════════════════════════════════ */

/* ── Product Layout ───────────────────────────────────────────── */
.product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-10);
    padding: var(--space-4) 0 var(--space-10);
}

/* ── Gallery ──────────────────────────────────────────────────── */
.product-gallery {
    position: sticky;
    top: calc(var(--header-height) + var(--announcement-height) + var(--space-4));
    height: fit-content;
}

.gallery-main {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #ffffff;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: var(--space-4);
    cursor: zoom-in;
    transition: transform var(--transition-slow);
}

.gallery-main-img:hover {
    transform: scale(1.05);
}

.gallery-thumbs {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    padding-bottom: var(--space-2);
}

.gallery-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: border-color var(--transition-fast);
    background: var(--bg-elevated);
    padding: 0;
}

.gallery-thumb:hover {
    border-color: var(--text-tertiary);
}

.gallery-thumb.active {
    border-color: var(--accent);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Product Details ──────────────────────────────────────────── */
.product-detail-brand {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: var(--space-2);
}

.product-detail-brand:hover {
    color: var(--accent-hover);
}

.product-detail-name {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
    margin-bottom: var(--space-3);
}

.product-sku {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    display: block;
    margin-bottom: var(--space-4);
}

/* Price */
.product-detail-price {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.detail-price-current {
    font-size: var(--text-4xl);
    font-weight: 900;
    color: var(--primary);
    font-family: var(--font-en);
}

.detail-price-original {
    font-size: var(--text-xl);
    color: var(--text-tertiary);
    text-decoration: line-through;
    font-family: var(--font-en);
}

.detail-price-discount {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--sale-text);
    background: var(--sale-bg);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
}

.product-short-desc {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-6);
}

/* ── Size Selection ───────────────────────────────────────────── */
.product-size-section {
    margin-bottom: var(--space-6);
}

.size-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.size-header h3 {
    font-size: var(--text-base);
    font-weight: 700;
}

.size-grid {
    /* Auto-fitting grid so size buttons never overflow the row width
       on iOS Safari — flex with min-width was leaving "42.5" / "אזל"
       hanging off the right edge on narrow phones. */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: var(--space-2);
    width: 100%;
}

.size-btn {
    min-width: 0;  /* allow grid cell shrink — was 52px causing iOS overflow */
    height: 44px;
    padding: var(--space-2) var(--space-3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-white);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    font-family: var(--font-en);
}

.size-btn:hover:not(:disabled) {
    border-color: var(--primary);
}

.size-btn.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.size-btn:disabled {
    /* WCAG: 0.55 keeps the disabled label above 4.5:1 contrast on white,
       and the line-through reinforces the state for color-blind users. */
    opacity: 0.55;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Out-of-stock sizes — clickable so customer can request a notification.
   Visually distinct (greyed + strikethrough) but pointer-events stay on. */
.size-btn.oos {
    opacity: 0.55;
    text-decoration: line-through;
    color: #94a3b8;
    border-style: dashed;
}
.size-btn.oos:hover {
    border-color: #dc2626;
    border-style: solid;
    opacity: 0.85;
    color: #991b1b;
    text-decoration: none;
}
.size-btn.oos.selected {
    background: #fef2f2;
    border-color: #dc2626;
    color: #991b1b;
    text-decoration: none;
    opacity: 1;
}

.size-low-stock {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    color: var(--sale-text);
    background: var(--sale-bg);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.size-error {
    font-size: var(--text-sm);
    color: var(--danger);
    margin-top: var(--space-2);
}

/* ── Quantity & Add to Cart ───────────────────────────────────── */
.product-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.qty-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.qty-btn:hover {
    background: var(--border);
}

.qty-input {
    width: 48px;
    height: 44px;
    border: none;
    text-align: center;
    font-size: var(--text-base);
    font-weight: 600;
    font-family: var(--font-en);
    background: var(--bg-white);
    -moz-appearance: textfield;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

.add-to-cart-btn {
    flex: 1;
}

.wishlist-action-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
}
.wishlist-action-btn svg {
    width: 22px !important;
    height: 22px !important;
}
.wishlist-action-btn.in-wishlist {
    background: #fef2f2;
    border-color: #dc2626;
    color: #dc2626;
}
.wishlist-action-btn.in-wishlist svg { fill: #dc2626; }

/* ── Trust Info ───────────────────────────────────────────────── */
.product-trust {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.trust-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.trust-row svg {
    color: var(--accent);
    flex-shrink: 0;
}

/* ── Tabs ─────────────────────────────────────────────────────── */
.product-tabs {
    margin: var(--space-10) 0;
    border-top: 1px solid var(--border);
}

.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
    background: none;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
}

.tab-content {
    padding: var(--space-8) 0;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.product-description {
    line-height: 1.8;
    color: var(--text-secondary);
}

.product-description h2,
.product-description h3 {
    color: var(--text-primary);
    margin: var(--space-6) 0 var(--space-3);
}

.product-description ul,
.product-description ol {
    padding-inline-start: var(--space-6);
    margin: var(--space-4) 0;
    list-style: disc;
}

/* ── Shipping Info ────────────────────────────────────────────── */
.shipping-info h4 {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-3);
    color: var(--primary);
}

.shipping-info h4:not(:first-child) {
    margin-top: var(--space-6);
}

.shipping-info ul {
    list-style: disc;
    padding-inline-start: var(--space-6);
}

.shipping-info li {
    padding: var(--space-1) 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Reviews ──────────────────────────────────────────────────── */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.review-card {
    padding: var(--space-5);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.review-stars {
    display: flex;
    gap: 2px;
}

.star-filled {
    color: #f59e0b;
}

.star-empty {
    color: var(--border);
}

.review-title {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.review-body {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-2);
}

.review-date {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .product-layout {
        gap: var(--space-6);
    }

    .product-detail-name {
        font-size: var(--text-2xl);
    }

    .detail-price-current {
        font-size: var(--text-3xl);
    }
}

@media (max-width: 768px) {
    .product-layout {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .product-gallery {
        position: static;
    }

    .gallery-main {
        aspect-ratio: 4/3;
    }

    .gallery-thumb {
        width: 60px;
        height: 60px;
    }

    .product-detail-name {
        font-size: var(--text-xl);
    }

    .detail-price-current {
        font-size: var(--text-2xl);
    }

    .product-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .add-to-cart-btn,
    #oosCta {
        order: -1;
        width: 100%;
        flex: none;
    }

    .quantity-selector {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: stretch;
    }
    .quantity-selector .qty-btn {
        width: 48px;
        height: 48px;
        font-size: var(--text-xl);
        flex-shrink: 0;
    }
    .quantity-selector .qty-input {
        flex: 1;
        min-width: 0;
        height: 48px;
        border-inline: 1px solid var(--border);
    }
    .wishlist-action-btn {
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
    }

    .product-trust {
        padding: var(--space-3);
        gap: 8px;
    }
    .trust-row {
        font-size: 12.5px;
        gap: 8px;
    }

    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-sm);
    }
}

@media (max-width: 480px) {
    .product-detail-name {
        font-size: var(--text-lg);
    }

    .size-btn {
        min-width: 56px;
        height: 48px;
        font-size: var(--text-sm);
        padding: 0 10px;
    }
    .size-low-stock {
        font-size: 10px;
        padding: 2px 7px;
        top: -10px;
    }
}
