/*
Theme Name: DZ Express COD
Theme URI: https://bibadz.shop
Author: DZ Developer
Description: قالب سريع جداً مخصص للتجارة الإلكترونية COD في الجزائر.
Version: 1.1
Text Domain: dz-express
*/

/* ⚠️ تنبيه هام جداً:
   تم نقل جميع التنسيقات أدناه إلى ملف header.php (بشكل مضغوط) لضمان سرعة تحميل قصوى.
   - هذا الملف يستخدم الآن فقط لتعريف القالب.
   - إذا أردت تعديل لون أو حجم خط، يجب أن تعدله هنا كمرجع، ثم تقوم بنسخ التعديل إلى كود الـ CSS الموجود داخل header.php لكي يظهر في الموقع.
*/

/* ----------------------------------
   1. Design System & Variables
   ---------------------------------- */

:root {
    --primary-color: #0F5132; /* Algerian Green */
    --accent-color: #D32F2F;  /* Red for Urgency */
    --text-dark: #1E293B;
    --text-gray: #64748B;
    --bg-light: #F8FAFC;
    --white: #FFFFFF;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    direction: rtl;
    text-align: right;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    padding-bottom: 100px;
}

/* ----------------------------------
   2. Layout & Container
   ---------------------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----------------------------------
   3. Index Page Grid
   ---------------------------------- */
.hero-section {
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(135deg, #e0f2f1 0%, #ffffff 100%);
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 40px;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: -2px;
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--text-gray);
    margin-top: 10px;
}

.highlight {
    color: var(--accent-color);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding-bottom: 60px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
    border: 1px solid #f1f5f9;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: #e2e8f0;
}

.card-img {
    display: block;
    height: 250px;
    background: #f1f5f9;
    overflow: hidden;
    position: relative;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .card-img img {
    transform: scale(1.05);
}

.card-body {
    padding: 20px;
}

.product-title {
    font-size: 1.1rem;
    margin: 0 0 10px;
    line-height: 1.4;
}

.product-title a {
    text-decoration: none;
    color: var(--text-dark);
    transition: color 0.2s;
}

.product-title a:hover {
    color: var(--primary-color);
}

.price-tag {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.price-tag small {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-gray);
}

/* ----------------------------------
   4. Buttons & Forms
   ---------------------------------- */
.btn-primary {
    display: inline-block;
    background: linear-gradient(to left, var(--accent-color), #b71c1c);
    color: white !important;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    text-align: center;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgb(211 47 47 / 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(211 47 47 / 0.4);
    filter: brightness(110%);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Input Styles */
input[type="text"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    background: #fff;
    color: var(--text-dark);
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgb(15 81 50 / 0.1);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Order Form Specifics */
.order-section,
.order-form-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid #f1f5f9;
    margin-top: 30px;
}

.section-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.validation-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 5px;
    display: none;
}

.input-invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ----------------------------------
   5. Product Page Layout
   ---------------------------------- */
.single-product-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding-top: 40px;
}

@media (max-width: 900px) {
    .single-product-container {
        grid-template-columns: 1fr;
    }
}

/* Product Gallery */
.product-gallery {
    margin-bottom: 30px;
    direction: ltr;
}

.main-image-stage {
    width: 100%;
    margin-bottom: 15px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    position: relative;
    transition: all 0.3s ease;
}

.main-image-stage img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 500px;
    object-fit: contain;
}

.thumbnails-list {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

.thumb-item {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.7;
    transition: all 0.2s ease;
    background: #fff;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-item:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.thumb-item.active {
    border-color: var(--primary-color);
    opacity: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Mobile Gallery */
@media (max-width: 768px) {
    .product-gallery {
        max-width: 100%;
        margin: 0 auto 20px;
    }

    .main-image-stage {
        border-radius: 0;
        border: none;
        border-bottom: 1px solid #eee;
        min-height: auto;
        aspect-ratio: 1 / 1;
    }

    .thumbnails-list {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 10px 5px;
        white-space: nowrap;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        margin-top: 10px;
    }

    .thumbnails-list::-webkit-scrollbar {
        height: 4px;
    }

    .thumbnails-list::-webkit-scrollbar-thumb {
        background: #ddd;
        border-radius: 10px;
    }

    .thumb-item {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
}

/* ----------------------------------
   6. Modern Product Page Redesign
   ---------------------------------- */
.product-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    min-height: 100vh;
}

.product-details {
    padding: 25px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-top: 20px;
}

.product-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 15px 0;
    line-height: 1.3;
    text-align: center;
}

.product-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    border-radius: var(--radius-md);
    border: 1px solid #fcd34d;
}

.product-price .current-price {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-color);
    letter-spacing: -1px;
}

.product-price .compare-price {
    font-size: 1.2rem;
    color: #9ca3af;
    text-decoration: line-through;
}

.short-desc {
    color: var(--text-gray);
    font-size: 1rem;
    line-height: 1.7;
    text-align: center;
    margin-bottom: 25px;
    padding: 0 10px;
}

/* Enhanced Order Form Box */
.order-form-box {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(15, 81, 50, 0.1);
    margin-top: 25px;
    position: relative;
    overflow: hidden;
}

.order-form-box::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #10b981, var(--accent-color));
}

.order-form-box h3 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0 0 25px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.order-form-box h3::before {
    content: '🛒';
    font-size: 1.3rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(15, 81, 50, 0.1);
    outline: none;
}

.form-group input::placeholder {
    color: #94a3b8;
}

/* Enhanced Price Summary */
.price-summary {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%) !important;
    border: 2px solid #a7f3d0 !important;
    border-radius: var(--radius-lg) !important;
    padding: 20px !important;
    margin: 25px 0 !important;
}

.price-summary div {
    font-size: 1rem;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--accent-color) 0%, #b91c1c 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(211, 47, 47, 0.4);
    filter: brightness(110%);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Product Content Section */
.product-content {
    margin-top: 30px;
    padding: 25px;
    background: #f8fafc;
    border-radius: var(--radius-lg);
    line-height: 1.8;
    color: var(--text-dark);
}

.product-content h2,
.product-content h3 {
    color: var(--primary-color);
    margin: 20px 0 10px;
}

.product-content ul,
.product-content ol {
    padding-right: 20px;
}

.product-content li {
    margin-bottom: 8px;
}

/* Reviews Section */
.reviews-section {
    margin-top: 30px;
    padding: 25px;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
}

.reviews-section h3 {
    color: var(--primary-color);
    margin: 0 0 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reviews-section h3::before {
    content: '⭐';
}

/* Mobile Enhancements */
@media (max-width: 768px) {
    .product-page-container {
        padding: 0;
    }

    .product-details {
        margin-top: 0;
        border-radius: 0;
        border-top: 1px solid #eee;
    }

    .product-title {
        font-size: 1.4rem;
    }

    .product-price .current-price {
        font-size: 1.6rem;
    }

    .order-form-box {
        padding: 20px;
        margin: 15px;
        border-radius: var(--radius-md);
    }

    .btn-submit {
        font-size: 1.1rem;
        padding: 14px 20px;
    }
}

/* ----------------------------------
   7. Related Products Section
   ---------------------------------- */
.related-products-section {
    margin-top: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: var(--radius-lg);
}

.related-products-section .section-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 25px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.related-products-section .section-title::before {
    content: '✨';
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.related-grid .product-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: block;
    text-decoration: none;
    border: 1px solid #eee;
}

.related-grid .product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.related-grid .product-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.related-grid .product-info {
    padding: 15px;
    text-align: center;
}

.related-grid .product-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 8px 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-grid .product-info .price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .related-products-section {
        margin: 20px 15px;
        padding: 20px 15px;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .related-grid .product-image img {
        height: 120px;
    }

    .related-grid .product-info {
        padding: 10px;
    }

    .related-grid .product-info h3 {
        font-size: 0.85rem;
    }
}

/* ----------------------------------
   8. Sticky Order Button (Mobile)
   ---------------------------------- */
.sticky-order-btn {
    display: none;
    position: fixed;
    bottom: 12px;
    right: 15px;
    left: 15px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 12px 20px;
    z-index: 9999;
    cursor: pointer;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 40px rgba(16, 185, 129, 0.6);
        transform: scale(1.02);
    }
}

.sticky-order-btn:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.5);
}

.sticky-order-btn:active {
    transform: scale(0.98) !important;
    animation: none;
}

.sticky-icon {
    font-size: 1rem;
    animation: bounce-icon 1s infinite;
}

@keyframes bounce-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.sticky-text {
    font-size: 0.9rem;
    font-weight: 600;
}

/* ----------------------------------
   9. Homepage Products Grid
   ---------------------------------- */
.products-section {
    padding: 50px 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.products-grid .product-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
}

.products-grid .product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.products-grid .card-img {
    height: 250px;
    overflow: hidden;
    position: relative;
    display: block;
}

.products-grid .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.products-grid .product-card:hover .card-img img {
    transform: scale(1.05);
}

.products-grid .card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.products-grid .product-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
}

.products-grid .product-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.2s;
}

.products-grid .product-title a:hover {
    color: var(--primary-color);
}

.products-grid .price-tag {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.products-grid .btn-primary {
    margin-top: auto;
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .products-grid .card-img {
        height: 160px;
    }

    .products-grid .card-body {
        padding: 15px;
    }

    .products-grid .product-title {
        font-size: 0.95rem;
    }

    .products-grid .btn-primary {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Show only on mobile */
@media (max-width: 768px) {
    .sticky-order-btn {
        display: flex;
    }

    body {
        padding-bottom: 90px !important;
    }
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-modal.show {
    opacity: 1;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox-modal.show .lightbox-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10001;
}

.close-btn:hover,
.close-btn:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Mobile Adjustments for Lightbox */
@media only screen and (max-width: 600px) {
    .lightbox-content {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .close-btn {
        top: 10px;
        right: 20px;
        font-size: 35px;
        background: rgba(0, 0, 0, 0.5);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        line-height: 1;
    }
}

/* Lightbox Navigation */
.lightbox-nav {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 10002;
}

.lightbox-nav.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.lightbox-nav.prev {
    left: 0;
    border-radius: 0 3px 3px 0;
}

.lightbox-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

@media only screen and (max-width: 600px) {
    .lightbox-nav {
        padding: 10px;
        font-size: 24px;
        background-color: rgba(0, 0, 0, 0.1);
    }

    .lightbox-nav:active {
        background-color: rgba(0, 0, 0, 0.8);
    }
}

/* Global Content Responsiveness */
.product-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.product-content iframe,
.product-content video {
    max-width: 100%;
}