/**
 * Product Detail Page - Enhanced Styles
 * تحسينات صفحة تفاصيل المنتج
 */

/* ==================== Breadcrumb Responsive ==================== */
.breadcrumb-responsive {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #F3F4F6;
}

.breadcrumb-responsive::-webkit-scrollbar {
    height: 4px;
}

.breadcrumb-responsive::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 2px;
}

.breadcrumb-responsive::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

/* Mobile Breadcrumb Adjustments */
@media (max-width: 640px) {
    .breadcrumb-responsive {
        padding: 0.875rem 1rem;
        font-size: 0.8125rem;
        gap: 0.375rem;
        margin-bottom: 1.5rem;
    }
    
    .breadcrumb-separator {
        font-size: 0.5rem !important;
        margin: 0 0.125rem;
    }
    
    .breadcrumb-text {
        display: inline-block;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Hide home text on very small screens, keep icon */
    .breadcrumb-responsive a:first-child .breadcrumb-text {
        display: none;
    }
    
    .breadcrumb-responsive a:first-child i {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .breadcrumb-responsive {
        padding: 0.75rem 0.875rem;
        font-size: 0.75rem;
    }
    
    .breadcrumb-text {
        max-width: 80px;
    }
}

/* ==================== Product Grid Layout ==================== */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* ==================== Sticky Images ==================== */
.product-images-sticky {
    position: sticky;
    top: 100px;
}

@media (max-width: 1024px) {
    .product-images-sticky {
        position: relative;
        top: 0;
    }
}

/* ==================== Image Hover Effects ==================== */
.product-images-sticky img {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-images-sticky > div:hover img {
    transform: scale(1.05);
}

/* ==================== Thumbnails Grid ==================== */
.product-thumbnails-grid-custom {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.875rem;
}

@media (max-width: 640px) {
    .product-thumbnails-grid-custom {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.625rem;
    }
}

/* ==================== Thumbnail Items ==================== */
.thumb-item {
    border: 2px solid #F3F4F6;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.thumb-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(87, 179, 195, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.thumb-item:hover {
    border-color: var(--primary);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.25);
}

.thumb-item:hover::before {
    opacity: 1;
}

.thumb-item.active {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3);
    transform: scale(1.05);
}

.thumb-item.active::before {
    opacity: 1;
}

/* ==================== Features Grid ==================== */
.product-features-grid-custom {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 640px) {
    .product-features-grid-custom {
        grid-template-columns: 1fr;
    }
}

/* ==================== Animations ==================== */
@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.4);
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* ==================== Loading States ==================== */
.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(124, 58, 237, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== Responsive Adjustments ==================== */
@media (max-width: 768px) {
    .product-detail-grid {
        gap: 1.5rem;
    }
    
    .product-images-sticky {
        margin-bottom: 1rem;
    }
    
    /* Adjust badges for mobile */
    .section-badge-ultra,
    [style*="border-radius: 100px"] {
        font-size: 0.8125rem !important;
        padding: 0.5rem 0.875rem !important;
    }
}

@media (max-width: 640px) {
    .product-features-grid-custom {
        gap: 0.75rem;
    }
    
    /* Reduce padding on mobile */
    .container-ultra {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Adjust font sizes */
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    /* Adjust price section */
    [style*="font-size: clamp"] {
        font-size: 2rem !important;
    }
    
    /* Stack badges vertically on very small screens */
    [style*="display: flex"][style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .breadcrumb-responsive {
        border-radius: 8px !important;
    }
    
    /* Reduce all spacing */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Adjust button sizes */
    button,
    .btn-cart-ultra {
        padding: 1rem !important;
        font-size: 0.9375rem !important;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .product-images-sticky {
        position: relative !important;
        top: 0 !important;
    }
    
    button,
    .btn-cart-ultra,
    .btn-view-ultra {
        display: none !important;
    }
}

/* ==================== Accessibility ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== Focus Styles ==================== */
button:focus,
a:focus,
.thumb-item:focus {
    outline: 3px solid rgba(124, 58, 237, 0.4);
    outline-offset: 2px;
}

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

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

/* ==================== Scrollbar Styling ==================== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 6px;
    border: 2px solid #F3F4F6;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
