/* =========================================================================
   2. MODULE: CATALOG GRID & PRODUCT DETAIL MODAL (css/catalog.css)
   Zara / Photoroom Studio Cards, Size Pills, & Full-Clarity Preview
   ========================================================================= */

.catalog-main-container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 24px 24px 90px;
}

.section-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title-group {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.section-title-group h1 {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--text-primary);
}

.products-count-badge {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 11px;
    border-radius: 99px;
}

/* =========================================================================
   PRODUCT CARDS GRID
   ========================================================================= */
.catalog-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}

.product-card {
    background: var(--bg-card);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.product-img-box {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 3.8;
    background: #f3f2ee;
    overflow: hidden;
}

.product-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    cursor: pointer;
    transition: transform 0.35s ease;
}

.product-card:hover .product-img-box img {
    transform: scale(1.03);
}

.owner-discount-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #dc2626;
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 99px;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25);
}

/* Card Zoom Loupe Button (كشف الجودة الفائقة للأقمشة) */
.card-zoom-loupe-btn {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(184, 134, 68, 0.38);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-radius: 99px;
    padding: 5px 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-ar);
    font-size: 0.72rem;
    font-weight: 800;
    color: #451a03;
    cursor: pointer;
    z-index: 15;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-zoom-loupe-btn svg {
    color: #b88644;
    transition: transform 0.25s ease;
}

.card-zoom-loupe-btn:hover {
    background: #ffffff;
    border-color: #b88644;
    color: #141413;
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 18px rgba(184, 134, 68, 0.3);
}

.card-zoom-loupe-btn:hover svg {
    transform: scale(1.15) rotate(5deg);
}

/* 3D Flip Card Animation for Front/Back Inspection */
.product-img-box {
    perspective: 1000px;
}

.product-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    cursor: pointer;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    transform-style: preserve-3d;
}

.product-img-box.is-backside-view img {
    animation: flipCardAnim 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes flipCardAnim {
    0% { transform: rotateY(0deg) scale(0.98); }
    50% { transform: rotateY(90deg) scale(0.93); opacity: 0.4; }
    100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

/* Card Side Flip Switcher Button (تدوير للوجه الخلفي / الأمامي) */
.card-flip-side-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(20, 20, 19, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 12px;
    border-radius: 99px;
    font-family: var(--font-ar);
    font-size: 0.74rem;
    font-weight: 800;
    cursor: pointer;
    z-index: 15;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: all 0.25s ease;
}

.card-flip-side-btn:hover {
    background: #000000;
    border-color: #b88644;
    color: #fbbf24;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.card-flip-side-btn.is-back-active {
    background: linear-gradient(135deg, #78350f, #92400e);
    border-color: #fde68a;
    color: #fef3c7;
}

/* Photoroom Dual-Photo Switcher (Studio Shot vs AI Model Shot) */
.photoroom-switch-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(20, 20, 19, 0.82);
    backdrop-filter: blur(8px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 5px 12px;
    border-radius: 99px;
    font-family: var(--font-ar);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.admin-del-card-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #fca5a5;
    background: rgba(254, 242, 242, 0.95);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 16;
}

.admin-edit-card-btn {
    position: absolute;
    top: 12px;
    left: 50px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #fde68a;
    background: rgba(255, 251, 235, 0.96);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 16;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Card Body */
.product-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.product-cat-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.product-card-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.35;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.price-current {
    font-size: 1.08rem;
    font-weight: 900;
    color: var(--text-primary);
}

.price-old {
    font-size: 0.84rem;
    color: #9ca3af;
    text-decoration: line-through;
}

/* Quick Color Swatches in Catalog Card & Modal */
.card-color-swatches {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.color-swatch-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
    position: relative;
    padding: 0;
}

.color-swatch-dot:hover {
    transform: scale(1.18);
    box-shadow: 0 0 0 2px var(--accent-gold);
}

.color-swatch-dot.active {
    transform: scale(1.22);
    box-shadow: 0 0 0 2.5px #141413, 0 3px 8px rgba(0, 0, 0, 0.25);
}

.detail-colors-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.detail-color-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 99px;
    border: 1.5px solid rgba(0, 0, 0, 0.14);
    background: #ffffff;
    font-family: var(--font-ar);
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.detail-color-pill .pill-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.18);
}

.detail-color-pill:hover {
    border-color: var(--accent-gold);
    transform: translateY(-1px);
}

.detail-color-pill.active {
    border-color: #141413;
    background: #141413;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Scarcity & Low-Stock Urgency Badges (تحفيز الندرة والمتبقي) */
.stock-urgency-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.73rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 2px;
    animation: pulseNotice 2s infinite ease-in-out;
}

.stock-urgency-badge.warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.stock-urgency-badge.danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-weight: 900;
}

.detail-stock-notice {
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: pulseNotice 2s infinite ease-in-out;
}

.detail-stock-notice.warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.detail-stock-notice.danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #f87171;
}

@keyframes pulseNotice {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.92; }
}

/* Quick Size Pills inside Card */
.card-size-pills {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin: 2px 0;
}

.card-sz-pill {
    min-width: 34px;
    padding: 4px 9px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #faf9f6;
    color: var(--text-primary);
    font-family: var(--font-ar);
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
}

.card-sz-pill.active {
    background: var(--text-primary);
    color: #ffffff;
    border-color: var(--text-primary);
}

/* Direct Order & Add to Bag Buttons */
.card-action-btns {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

.btn-card-instant {
    padding: 9px 10px;
    border-radius: 10px;
    border: none;
    background: var(--text-primary);
    color: #ffffff;
    font-family: var(--font-ar);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-card-instant:hover {
    background: var(--accent-gold);
}

.btn-card-bag {
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: #ffffff;
    color: var(--text-primary);
    font-family: var(--font-ar);
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-card-bag:hover {
    background: #f5f4f0;
}

.empty-catalog-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.btn-reset-cat {
    margin-top: 12px;
    padding: 9px 20px;
    border-radius: 99px;
    border: none;
    background: var(--text-primary);
    color: #ffffff;
    font-family: var(--font-ar);
    font-weight: 800;
    cursor: pointer;
}

/* =========================================================================
   PRODUCT DETAIL PREVIEW MODAL
   ========================================================================= */
.product-detail-dialog {
    max-width: 780px;
    padding: 0;
    overflow: hidden;
}

.detail-split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.detail-visual-col {
    background: #f3f2ee;
    position: relative;
    display: flex;
    flex-direction: column;
}

.detail-main-img {
    width: 100%;
    height: 440px;
    object-fit: cover;
    object-position: center top;
}

.detail-thumbs-row {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #ffffff;
    justify-content: center;
}

.detail-thumb {
    width: 54px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}

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

.detail-info-col {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-cat-badge {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--accent-gold);
}

.detail-title {
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1.35;
}

.detail-fabric {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-price-box {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 4px 0;
}

.detail-price {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--accent-emerald);
}

.detail-old-price {
    font-size: 0.95rem;
    color: #9ca3af;
    text-decoration: line-through;
}

.detail-sizes-box {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-sz-btn {
    min-width: 44px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.16);
    background: #ffffff;
    font-family: var(--font-ar);
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
}

.detail-sz-btn.active {
    background: var(--text-primary);
    color: #ffffff;
    border-color: var(--text-primary);
}

.detail-cta-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}
