/* ========================================== */
/* 🎨 PRODUCT PREMIUM - MAIN STYLESHEET */
/* Product Premium - Complete System */
/* Version: 1.0.0 */
/* ========================================== */

/**
 * Import Order:
 * 1. Variables (Design System)
 * 2. Components (Modular CSS)
 * 3. Utilities (Helpers)
 */

@import url('variables.css');
@import url('gallery.css');
@import url('info.css');
@import url('actions.css');
@import url('variations.css');
@import url('tabs.css');
@import url('related.css');

/* ====== Global Resets ====== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ====== Base Styles ====== */
body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--gray-900);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ====== Container ====== */
.product-container {
    max-width: var(--product-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* ====== Main Layout ====== */
.product-page {
    padding: var(--space-8) 0;
}

.product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
    margin-bottom: var(--space-12);
}

/* Gallery - sticky داخل grid cell وتتوقف تلقائياً */
.product-gallery-col {
    position: sticky;
    top: 90px;
    align-self: start;  /* ضروري في grid عشان الـ sticky يشتغل */
    height: fit-content;
}

/* Info column - تـscroll طبيعي وتحدد طول الـ grid */
.product-info-col {
    min-width: 0;
}

/* ====== Breadcrumbs ====== */
.product-breadcrumbs {
    background: var(--white);
    padding: var(--space-4) 0;
    margin-bottom: var(--space-6);
    border-radius: var(--rounded-lg);
}

/* ====== Sticky Sidebar - DISABLED ====== */
.product-sidebar-sticky {
    /* position: sticky removed intentionally */
}

/* ====== Loading Overlay ====== */
.product-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(4px);
}

.product-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: var(--rounded-full);
    animation: spin 0.8s linear infinite;
}

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

/* ====== Alert Messages ====== */
.product-alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--rounded-lg);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: start;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
}

.product-alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.product-alert.success {
    background: var(--success-50);
    color: var(--success-dark);
    border: 2px solid var(--success);
}

.product-alert.error {
    background: var(--danger-50);
    color: var(--danger-dark);
    border: 2px solid var(--danger);
}

.product-alert.warning {
    background: var(--warning-50);
    color: var(--warning-dark);
    border: 2px solid var(--warning);
}

.product-alert.info {
    background: var(--info-50);
    color: var(--info-dark);
    border: 2px solid var(--info);
}

/* ====== Tooltips ====== */
.product-tooltip {
    position: relative;
    display: inline-block;
}

.product-tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--gray-900);
    color: var(--white);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--rounded);
    font-size: var(--text-xs);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    z-index: var(--z-tooltip);
}

.product-tooltip:hover .product-tooltip-content {
    opacity: 1;
}

/* ====== Fullscreen Gallery Overlay ====== */
.gallery-fullscreen-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s;
}

.fullscreen-header {
    padding: var(--space-4);
    display: flex;
    justify-content: flex-end;
}

.fullscreen-close {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--rounded-full);
    color: var(--white);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    transform: rotate(90deg);
}

.fullscreen-close svg {
    width: 24px;
    height: 24px;
}

.fullscreen-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: var(--space-6);
}

.fullscreen-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: opacity var(--transition-base);
}

.fullscreen-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--rounded-full);
    color: var(--white);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.fullscreen-nav:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.fullscreen-nav svg {
    width: 28px;
    height: 28px;
}

.fullscreen-prev {
    right: var(--space-6);
}

.fullscreen-next {
    left: var(--space-6);
}

.fullscreen-counter {
    padding: var(--space-4);
    text-align: center;
    color: var(--white);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
}

/* ====== Responsive Layout ====== */
@media (max-width: 1023px) {
    .product-layout {
        grid-template-columns: 1fr !important;
    }

    .product-gallery-col {
        position: static !important;
        align-self: auto !important;
        height: auto !important;
    }
}

@media (max-width: 639px) {
    .product-page {
        padding: var(--space-4) 0;
    }
    
    .product-layout {
        gap: var(--space-6);
    }
    
    .product-container {
        padding: 0 var(--space-4);
    }
    
    .fullscreen-nav {
        width: 50px;
        height: 50px;
    }
    
    .fullscreen-prev {
        right: var(--space-4);
    }
    
    .fullscreen-next {
        left: var(--space-4);
    }
}

/* ====== Print Styles ====== */
@media print {
    .product-breadcrumbs,
    .product-actions,
    .related-products-section,
    .product-tabs,
    .share-section {
        display: none;
    }
    
    .product-layout {
        display: block;
    }
    
    .product-info-card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
    
    @page {
        margin: 2cm;
    }
}

/* ====== Accessibility ====== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible styles */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* ====== Performance Optimization ====== */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* ====== Smooth Scrolling ====== */
html {
    scroll-behavior: smooth;
}

/* ====== Selection Style ====== */
::selection {
    background: var(--primary);
    color: var(--white);
}

::-moz-selection {
    background: var(--primary);
    color: var(--white);
}
