/*
 * EcomFlow - Main CSS (Design System + Base)
 * Extracted from style.css + header.php consolidated.
 * This is the core stylesheet loaded on every page.
 *
 * Target: < 12KB minified
 */

/* ===== Design System & Variables ===== */
:root {
    --primary-color: #0F5132;
    --dz-primary-color: #0F5132;
    --accent-color: #D32F2F;
    --text-dark: #1E293B;
    --text-gray: #64748B;
    --bg-light: #F8FAFC;
    --white: #FFFFFF;
    --header-bg-color: #ffffff;
    --header-text-color: #475569;
    --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);
    --font-heading: 'Cairo', sans-serif;
    --font-body: 'Cairo', 'Segoe UI', sans-serif;
    --bg-primary-light: #0F513220;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: var(--font-body);
    font-weight: 500;
    direction: rtl;
    text-align: right;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Typography ===== */
@font-face {
    font-family: 'Cairo';
    font-display: swap;
    src: local('Cairo');
}
@font-face {
    font-family: 'Tajawal';
    font-display: swap;
    src: local('Tajawal');
}

/* ===== Utility Classes (Tailwind-compatible subset) ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.hidden { display: none; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.h-full { height: 100%; }
.w-full { width: 100%; }
.z-10 { z-index: 10; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.p-4 { padding: 1rem; }
.p-2 { padding: 0.5rem; }
.text-lg { font-size: 1.125rem; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.bg-white { background-color: #ffffff; }
.bg-black\/50 { background-color: rgba(0, 0, 0, 0.5); }
.translate-x-0 { transform: translateX(0); }
.translate-x-full { transform: translateX(100%); }
.transition-transform { transition-property: transform; }
.duration-500 { transition-duration: 500ms; }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.sticky { position: sticky; }
.border-b { border-bottom-width: 1px; }
.rounded-full { border-radius: 9999px; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.p-6 { padding: 1.5rem; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.mb-4 { margin-bottom: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.text-2xl { font-size: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.text-white { color: #ffffff !important; }
.text-indigo-600 { color: var(--primary-color) !important; }
.bg-indigo-600 { background-color: var(--primary-color) !important; }
.hover\:bg-indigo-700:hover { background-color: var(--primary-color) !important; filter: brightness(90%); }
.text-primary-main { color: var(--primary-color) !important; }
.bg-primary-main { background-color: var(--primary-color) !important; }
.font-cairo { font-family: 'Cairo', sans-serif; }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); }
.text-\[10px\] { font-size: 10px; }
.w-14 { width: 3.5rem; }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.transition-opacity { transition-property: opacity; }

/* ===== Buttons ===== */
.btn-primary {
    display: inline-block;
    background: var(--primary-color);
    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 rgba(0, 0, 0, 0.1);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    filter: brightness(110%);
}
.btn-block {
    display: block;
    width: 100%;
}
.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; }

/* ===== Forms ===== */
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);
}
.form-group { margin-bottom: 20px; }
.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); }
}

/* ===== Product Card ===== */
.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 #e2e8f0;
}
.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}
.card-img {
    display: block;
    aspect-ratio: 1 / 1;
    height: auto;
    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;
    font-weight: 600;
}
.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: 800;
    color: var(--accent-color);
    margin-bottom: 15px;
}
.old-price {
    text-decoration: line-through;
    color: #94a3b8;
    font-weight: normal;
    font-size: 0.85rem;
}
.price-tag small {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-gray);
}

/* ===== Products Grid (Homepage) ===== */
.products-section { padding: 50px 0; }
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 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);
    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; }
.products-grid .card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.products-grid .product-title { font-weight: 700; }
.products-grid .price-tag { font-weight: 800; margin-bottom: 15px; }
.products-grid .btn-primary { margin-top: auto; }

/* ===== Lightbox ===== */
.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;
    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;
    cursor: pointer;
    z-index: 10001;
}
.lightbox-nav {
    cursor: pointer;
    position: absolute;
    top: 50%;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.6s ease;
    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); }

/* ===== Sticky Order Button ===== */
.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% { transform: scale(1); }
    50% { transform: scale(1.02); }
}
.sticky-order-btn:hover { transform: scale(1.05) !important; }
.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; }

/* ===== Product Content ===== */
.product-content img, .product-content video, .product-content iframe {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
    border-radius: var(--radius-md);
}
.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; }

/* ===== Text Overflow & RTL Fix ===== */
.product-page-container,
.product-details, .product-content, .order-form-box,
.short-desc, .product-title, .form-group {
    max-width: 100%;
    overflow-x: hidden;
}
.product-details p, .product-details span, .product-details div,
.product-content p, .product-content span, .product-content div,
.short-desc, .product-title, .form-group label,
.form-group input, .form-group select, .form-group textarea {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}
.product-details a, .product-content a {
    word-break: break-all;
    overflow-wrap: anywhere;
}

/* ===== Theme Presets ===== */
body[data-preset="vibrant_hub"], body.preset-vibrant_hub {
    --primary-color: #8b5cf6;
    --dz-primary-color: #8b5cf6;
    --accent-color: #f43f5e;
    --bg-light: #fdf2f8;
    --radius-md: 20px;
    --radius-lg: 30px;
}
body[data-preset="dark_elegance"], body.preset-dark_elegance {
    --primary-color: #d4af37;
    --dz-primary-color: #d4af37;
    --bg-light: #121212;
    --text-dark: #f3f4f6;
    --white: #1e1e1e;
}

/* ===== Responsive ===== */
@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; }

    .sticky-order-btn { display: flex; }
    body.single-products { padding-bottom: 90px !important; }

    .container { padding-left: 15px; padding-right: 15px; }

    .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;
    }
    .lightbox-nav { padding: 10px; font-size: 24px; }
}

@media (max-width: 480px) {
    .products-grid { gap: 10px; }
    .products-grid .card-img { height: 140px; }
}

/* =====================================================
   DARK PRESET — Product Card Overrides (main.css)
   ===================================================== */

/* Dark Elegance */
body[data-preset="dark_elegance"] .product-card,
body[data-preset="dark_elegance"] .products-grid .product-card,
body[data-preset="dark_elegance"] .related-grid .product-card,
body.preset-dark_elegance .product-card,
body.preset-dark_elegance .products-grid .product-card,
body.preset-dark_elegance .related-grid .product-card {
    background: #1e293b !important;
    border-color: rgba(212, 175, 55, 0.15) !important;
    color: #f1f5f9 !important;
}
body[data-preset="dark_elegance"] .product-card:hover,
body[data-preset="dark_elegance"] .products-grid .product-card:hover,
body.preset-dark_elegance .product-card:hover,
body.preset-dark_elegance .products-grid .product-card:hover {
    border-color: rgba(212, 175, 55, 0.4) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(212, 175, 55, 0.1) !important;
}
body[data-preset="dark_elegance"] .product-card .product-title,
body[data-preset="dark_elegance"] .product-card .product-title a,
body.preset-dark_elegance .product-card .product-title,
body.preset-dark_elegance .product-card .product-title a {
    color: #f1f5f9 !important;
}
body[data-preset="dark_elegance"] .card-img,
body.preset-dark_elegance .card-img {
    background: #0f172a !important;
}
body[data-preset="dark_elegance"] .related-products-section,
body.preset-dark_elegance .related-products-section {
    background: transparent !important;
}

/* Modern Neon */
body[data-preset="modern"] .product-card,
body[data-preset="modern"] .products-grid .product-card,
body[data-preset="modern"] .related-grid .product-card,
body.preset-modern .product-card,
body.preset-modern .products-grid .product-card,
body.preset-modern .related-grid .product-card {
    background: rgba(26, 26, 46, 0.85) !important;
    border-color: rgba(168, 85, 247, 0.15) !important;
    color: #e2e8f0 !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}
body[data-preset="modern"] .product-card:hover,
body[data-preset="modern"] .products-grid .product-card:hover,
body.preset-modern .product-card:hover,
body.preset-modern .products-grid .product-card:hover {
    border-color: rgba(168, 85, 247, 0.4) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(168, 85, 247, 0.15) !important;
}
body[data-preset="modern"] .product-card .product-title,
body[data-preset="modern"] .product-card .product-title a,
body.preset-modern .product-card .product-title,
body.preset-modern .product-card .product-title a {
    color: #f1f5f9 !important;
}
body[data-preset="modern"] .card-img,
body.preset-modern .card-img {
    background: rgba(15, 15, 26, 0.5) !important;
}
body[data-preset="modern"] .related-products-section,
body.preset-modern .related-products-section {
    background: transparent !important;
}
