/* ========================================
   Product Details Mobile Optimization
   تحسينات صفحة تفاصيل المنتج للموبايل
   ======================================== */

/* ========================================
   1. Page Header Responsive
   ======================================== */

@media (max-width: 768px) {
    .page-header-section {
        padding: 40px 0 30px !important;
        margin-top: 0;
    }
    
    .page-header-section h1 {
        font-size: 1.5rem !important;
        line-height: 1.4;
        margin-bottom: 10px;
    }
    
    .page-header-section p {
        font-size: 0.9rem !important;
        margin-bottom: 15px;
    }
    
    .breadcrumb {
        font-size: 0.85rem !important;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .breadcrumb a,
    .breadcrumb span {
        padding: 5px 8px;
    }
}

/* ========================================
   2. Product Details Layout Mobile
   ======================================== */

@media (max-width: 768px) {
    /* Main product section */
    .product-details-section {
        padding: 30px 0 !important;
    }
    
    /* Product grid - single column on mobile */
    .product-details-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    /* Product Images */
    .product-images {
        width: 100% !important;
        margin-bottom: 20px;
    }
    
    .main-image-container {
        width: 100% !important;
        height: 300px !important;
        border-radius: 12px;
        overflow: hidden;
        margin-bottom: 15px;
    }
    
    .main-image-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Thumbnail images */
    .product-thumbnails {
        display: flex !important;
        gap: 10px !important;
        overflow-x: auto !important;
        padding: 10px 0;
        scrollbar-width: thin;
        scrollbar-color: var(--primary-color) #f1f1f1;
    }
    
    .product-thumbnails::-webkit-scrollbar {
        height: 6px;
    }
    
    .product-thumbnails::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    .product-thumbnails::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 10px;
    }
    
    .thumbnail-item {
        flex: 0 0 80px !important;
        height: 80px !important;
        border-radius: 8px;
        overflow: hidden;
        cursor: pointer;
        border: 2px solid transparent;
        transition: border-color 0.3s ease;
    }
    
    .thumbnail-item.active {
        border-color: var(--primary-color);
    }
    
    .thumbnail-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Product Info */
    .product-info {
        width: 100% !important;
        padding: 20px 15px !important;
    }
    
    /* Product Title */
    .product-title {
        font-size: 1.5rem !important;
        line-height: 1.4;
        margin-bottom: 15px;
        color: var(--text-color);
    }
    
    /* Category Badge */
    .product-category {
        display: inline-block;
        padding: 6px 15px;
        background: var(--bg-light);
        color: var(--primary-color);
        border-radius: 20px;
        font-size: 0.85rem;
        font-weight: 600;
        margin-bottom: 15px;
    }
    
    /* Price Section */
    .product-price-section {
        background: linear-gradient(135deg, var(--bg-light) 0%, #f0f0f0 100%);
        padding: 20px !important;
        border-radius: 12px;
        margin: 20px 0;
        text-align: center;
    }
    
    .product-price {
        font-size: 2rem !important;
        font-weight: 700;
        color: var(--primary-color);
        margin: 0;
    }
    
    .price-label {
        font-size: 0.85rem;
        color: var(--text-light);
        margin-top: 5px;
    }
    
    /* Product Meta (Views, SKU, etc) */
    .product-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        padding: 15px 0;
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
        margin: 20px 0;
    }
    
    .meta-item {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.85rem;
        color: var(--text-light);
    }
    
    .meta-item i {
        color: var(--primary-color);
        font-size: 1rem;
    }
    
    /* Colors Section */
    .product-colors-section {
        margin: 20px 0;
    }
    
    .section-label {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-color);
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .section-label i {
        color: var(--primary-color);
    }
    
    .product-colors {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .color-option {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        cursor: pointer;
        border: 3px solid transparent;
        transition: all 0.3s ease;
        position: relative;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .color-option.active {
        border-color: var(--primary-color);
        transform: scale(1.15);
    }
    
    .color-option:hover {
        transform: scale(1.1);
    }
    
    /* Description Section */
    .product-description-section {
        margin: 25px 0;
    }
    
    .product-description {
        font-size: 0.95rem;
        line-height: 1.8;
        color: var(--text-color);
        padding: 15px;
        background: var(--bg-light);
        border-radius: 10px;
        border-right: 4px solid var(--primary-color);
    }
    
    body[dir="ltr"] .product-description {
        border-right: none;
        border-left: 4px solid var(--primary-color);
    }
    
    /* Specifications */
    .product-specs-section {
        margin: 25px 0;
    }
    
    .specs-grid {
        display: grid;
        gap: 12px;
    }
    
    .spec-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        background: var(--bg-light);
        border-radius: 8px;
        font-size: 0.9rem;
    }
    
    .spec-label {
        font-weight: 600;
        color: var(--text-color);
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .spec-label i {
        color: var(--primary-color);
        font-size: 0.9rem;
    }
    
    .spec-value {
        color: var(--text-light);
    }
    
    /* Action Buttons */
    .product-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin: 25px 0;
        position: sticky;
        bottom: 0;
        background: white;
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        border-radius: 15px 15px 0 0;
        z-index: 100;
    }
    
    .action-btn {
        width: 100%;
        padding: 15px 25px !important;
        font-size: 1rem !important;
        font-weight: 600;
        border: none;
        border-radius: 10px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        transition: all 0.3s ease;
        text-decoration: none;
    }
    
    .btn-whatsapp {
        background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
        color: white;
        box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
    }
    
    .btn-whatsapp:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    }
    
    .btn-call {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
        color: white;
        box-shadow: 0 4px 15px rgba(13, 77, 61, 0.3);
    }
    
    .btn-call:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(13, 77, 61, 0.4);
    }
    
    .btn-email {
        background: white;
        color: var(--primary-color);
        border: 2px solid var(--primary-color);
    }
    
    .btn-email:hover {
        background: var(--primary-color);
        color: white;
    }
    
    /* Share Section */
    .product-share-section {
        margin: 25px 0;
        padding: 20px;
        background: var(--bg-light);
        border-radius: 12px;
        text-align: center;
    }
    
    .share-title {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 15px;
        color: var(--text-color);
    }
    
    .share-buttons {
        display: flex;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .share-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1rem;
        transition: all 0.3s ease;
        text-decoration: none;
    }
    
    .share-btn:hover {
        transform: translateY(-3px);
    }
    
    .share-facebook {
        background: #3b5998;
    }
    
    .share-twitter {
        background: #1DA1F2;
    }
    
    .share-whatsapp {
        background: #25D366;
    }
    
    .share-telegram {
        background: #0088cc;
    }
    
    .share-copy {
        background: var(--primary-color);
    }
    
    .share-instagram {
        background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    }
}

/* ========================================
   3. Related Products Section Mobile
   ======================================== */

@media (max-width: 768px) {
    .related-products-section {
        padding: 40px 0 !important;
        background: var(--bg-light);
    }
    
    .section-header {
        text-align: center;
        margin-bottom: 25px;
    }
    
    .section-header h2 {
        font-size: 1.5rem !important;
        color: var(--primary-color);
        margin-bottom: 10px;
    }
    
    .section-header p {
        font-size: 0.9rem;
        color: var(--text-light);
    }
    
    .related-products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .related-product-card {
        background: white;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        transition: all 0.3s ease;
    }
    
    .related-product-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    }
    
    .related-product-image {
        width: 100%;
        height: 140px;
        overflow: hidden;
        position: relative;
    }
    
    .related-product-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .related-product-info {
        padding: 12px;
    }
    
    .related-product-title {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-color);
        margin-bottom: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.4;
    }
    
    .related-product-price {
        font-size: 1rem;
        font-weight: 700;
        color: var(--primary-color);
    }
    
    .related-product-btn {
        width: 100%;
        padding: 8px;
        margin-top: 10px;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 6px;
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        text-align: center;
        text-decoration: none;
        display: block;
    }
    
    .related-product-btn:hover {
        background: var(--primary-dark);
    }
}

/* ========================================
   4. Small Mobile (< 480px)
   ======================================== */

@media (max-width: 479px) {
    .page-header-section h1 {
        font-size: 1.3rem !important;
    }
    
    .product-title {
        font-size: 1.3rem !important;
    }
    
    .product-price {
        font-size: 1.75rem !important;
    }
    
    .main-image-container {
        height: 250px !important;
    }
    
    .thumbnail-item {
        flex: 0 0 70px !important;
        height: 70px !important;
    }
    
    .action-btn {
        padding: 13px 20px !important;
        font-size: 0.95rem !important;
    }
    
    .related-products-grid {
        grid-template-columns: 1fr !important;
    }
    
    .related-product-image {
        height: 180px;
    }
    
    .color-option {
        width: 40px;
        height: 40px;
    }
    
    /* Share buttons للشاشات الصغيرة */
    .share-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .share-buttons {
        gap: 8px;
    }
    
    .share-title {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }
}

/* ========================================
   5. Additional Enhancements
   ======================================== */

@media (max-width: 768px) {
    /* Badge for new/featured products */
    .product-badge {
        position: absolute;
        top: 15px;
        right: 15px;
        background: var(--accent-color);
        color: var(--text-color);
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 700;
        z-index: 10;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
    
    body[dir="ltr"] .product-badge {
        right: auto;
        left: 15px;
    }
    
    /* Loading skeleton */
    .skeleton {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
    }
    
    @keyframes loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
    
    /* Image zoom indicator */
    .zoom-indicator {
        position: absolute;
        bottom: 10px;
        right: 10px;
        background: rgba(0,0,0,0.6);
        color: white;
        padding: 8px 12px;
        border-radius: 20px;
        font-size: 0.75rem;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    body[dir="ltr"] .zoom-indicator {
        right: auto;
        left: 10px;
    }
    
    /* Quantity selector */
    .quantity-selector {
        display: flex;
        align-items: center;
        gap: 15px;
        justify-content: center;
        margin: 20px 0;
    }
    
    .quantity-btn {
        width: 40px;
        height: 40px;
        border: 2px solid var(--primary-color);
        background: white;
        color: var(--primary-color);
        border-radius: 50%;
        font-size: 1.2rem;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .quantity-btn:hover {
        background: var(--primary-color);
        color: white;
    }
    
    .quantity-value {
        font-size: 1.3rem;
        font-weight: 700;
        color: var(--primary-color);
        min-width: 40px;
        text-align: center;
    }
    
    /* Availability status */
    .availability-status {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 15px;
        border-radius: 20px;
        font-size: 0.85rem;
        font-weight: 600;
        margin: 15px 0;
    }
    
    .status-available {
        background: #d4edda;
        color: #155724;
    }
    
    .status-limited {
        background: #fff3cd;
        color: #856404;
    }
    
    .status-out {
        background: #f8d7da;
        color: #721c24;
    }
    
    .status-icon {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        animation: pulse 2s infinite;
    }
    
    .status-available .status-icon {
        background: #28a745;
    }
    
    .status-limited .status-icon {
        background: #ffc107;
    }
    
    .status-out .status-icon {
        background: #dc3545;
    }
    
    @keyframes pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.5; }
    }
    
    /* Tabs for description/specs */
    .product-tabs {
        display: flex;
        gap: 10px;
        margin: 25px 0 15px;
        border-bottom: 2px solid var(--border-color);
    }
    
    .tab-btn {
        padding: 12px 20px;
        background: none;
        border: none;
        color: var(--text-light);
        font-size: 0.95rem;
        font-weight: 600;
        cursor: pointer;
        position: relative;
        transition: all 0.3s ease;
    }
    
    .tab-btn.active {
        color: var(--primary-color);
    }
    
    .tab-btn.active::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--primary-color);
    }
    
    .tab-content {
        display: none;
        animation: fadeIn 0.3s ease;
    }
    
    .tab-content.active {
        display: block;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* ========================================
   6. Performance Optimizations
   ======================================== */

@media (max-width: 768px) {
    /* Lazy load images */
    img[loading="lazy"] {
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    img[loading="lazy"].loaded {
        opacity: 1;
    }
    
    /* Reduce motion for accessibility */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}
