/* ==========================================================================
   WooCommerce Arabic Theme — Main Styles
   RTL-first design for Arabic stores
   ========================================================================== */

/* Google Font preload is handled via preconnect in header */

/* ==========================================================================
   1. Reset & Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Tajawal', -apple-system, 'Segoe UI', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #333;
    background: #fff;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: #1a6f3c;
    text-decoration: none;
    transition: color 150ms ease;
}
a:hover { color: #145a30; }

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Tajawal', sans-serif;
    color: #1a1a1a;
    line-height: 1.4;
    margin-bottom: 1rem;
}
h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 2rem; font-weight: 700; }
h3 { font-size: 1.5rem; font-weight: 600; }
h4 { font-size: 1.25rem; font-weight: 600; }
h5 { font-size: 1.125rem; font-weight: 500; }
h6 { font-size: 1rem; font-weight: 500; }

p { margin-bottom: 1rem; }
::selection { background: #1a6f3c; color: #fff; }

/* ==========================================================================
   2. Container & Layout
   ========================================================================== */
.woo-container {
    max-width: 1200px;
    margin-right: auto;
    margin-left: auto;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}
.woo-container--narrow { max-width: 800px; }

.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.site-content {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 4rem;
}

/* ==========================================================================
   3. Header
   ========================================================================== */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e0d8;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Top Bar */
.header-top {
    background: #2d2d2d;
    color: #ccc;
    font-size: 0.875rem;
    padding: 0.5rem 0;
}
.header-top__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-top a { color: #ccc; }
.header-top a:hover { color: #fff; }

/* Main Header */
.header-main__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    gap: 1rem;
}

/* Logo */
.site-logo { flex-shrink: 0; }
.site-logo__text {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
}
.site-logo__text:hover { color: #1a6f3c; }

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.header-action {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #333;
    transition: all 150ms ease;
}
.header-action:hover { background: #f8f5f0; color: #1a6f3c; }
.header-action__badge {
    position: absolute;
    top: 4px;
    left: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #c8952b;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
}

/* Search */
.header-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}
.header-search input[type="search"] {
    width: 100%;
    height: 44px;
    padding: 0 1.5rem 0 44px;
    border: 1px solid #e5e0d8;
    border-radius: 8px;
    background: #f8f5f0;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.875rem;
}
.header-search input[type="search"]:focus {
    outline: none;
    border-color: #1a6f3c;
    box-shadow: 0 0 0 3px rgba(26,111,60,0.1);
}
.header-search button {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: #1a6f3c;
    color: #fff;
    cursor: pointer;
}

/* Primary Nav */
.primary-nav { border-top: 1px solid #f0ebe3; }
.primary-nav__list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.primary-nav__list li { position: relative; }
.primary-nav__list a {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    font-weight: 500;
    border-radius: 6px;
    transition: all 150ms ease;
    white-space: nowrap;
}
.primary-nav__list a:hover,
.primary-nav__list .current-menu-item a {
    color: #1a6f3c;
    background: rgba(26,111,60,0.08);
}

/* Dropdown */
.primary-nav__list .sub-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e5e0d8;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 250ms ease;
    z-index: 100;
}
.primary-nav__list li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mobile Nav */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 10px;
}
.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: all 250ms ease;
}
.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 250ms ease;
}
.mobile-nav-overlay.is-active { opacity: 1; visibility: visible; }
.mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: #fff;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 250ms ease;
    overflow-y: auto;
    padding: 2rem;
}
.mobile-nav.is-active { transform: translateX(0); }
.mobile-nav__close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f5f0;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-nav__list a {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid #f0ebe3;
    font-weight: 500;
    color: #333;
}

/* ==========================================================================
   4. Footer
   ========================================================================== */
.site-footer {
    background: #2d2d2d;
    color: #ccc;
    padding-top: 3rem;
}
.footer-widgets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding-bottom: 2rem;
}
.footer-widget h4 {
    color: #fff;
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}
.footer-widget h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 2px;
    background: #c8952b;
}
.footer-widget ul li { margin-bottom: 0.5rem; }
.footer-widget ul li a { color: #ccc; }
.footer-widget ul li a:hover { color: #fff; }
.footer-widget p { font-size: 0.875rem; line-height: 1.8; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 1.5rem 0;
    font-size: 0.875rem;
}
.footer-bottom__payment {
    display: flex;
    gap: 0.5rem;
}
.payment-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    background: #fff;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    color: #333;
}

/* ==========================================================================
   5. Buttons
   ========================================================================== */
.woo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border: 2px solid transparent;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    text-align: center;
    transition: all 150ms ease;
}
.woo-btn--primary {
    background: #1a6f3c;
    color: #fff;
    border-color: #1a6f3c;
}
.woo-btn--primary:hover { background: #145a30; border-color: #145a30; }
.woo-btn--secondary {
    background: transparent;
    color: #1a6f3c;
    border-color: #1a6f3c;
}
.woo-btn--secondary:hover { background: #1a6f3c; color: #fff; }
.woo-btn--accent { background: #c8952b; color: #fff; border-color: #c8952b; }
.woo-btn--accent:hover { background: #a67c20; }
.woo-btn--sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
.woo-btn--lg { padding: 1rem 2.5rem; font-size: 1.125rem; }

/* ==========================================================================
   6. Product Card & Grid
   ========================================================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}
.product-card {
    background: #fff;
    border: 1px solid #e5e0d8;
    border-radius: 12px;
    overflow: hidden;
    transition: all 250ms ease;
}
.product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-4px);
}
.product-card__image {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #f8f5f0;
}
.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms ease;
}
.product-card:hover .product-card__image img { transform: scale(1.05); }
.product-card__badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
}
.product-card__badge--sale { background: #dc3545; color: #fff; }
.product-card__body { padding: 1rem; }
.product-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.product-card__title a { color: #1a1a1a; }
.product-card__title a:hover { color: #1a6f3c; }
.product-card__price {
    font-weight: 700;
    color: #1a1a1a;
}
.product-card__price del { color: #999; font-weight: 400; font-size: 0.875rem; }
.product-card__price ins { text-decoration: none; color: #dc3545; }
.product-card__actions {
    margin-top: 0.75rem;
    opacity: 0;
    transform: translateY(8px);
    transition: all 250ms ease;
}
.product-card:hover .product-card__actions { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   7. Single Product
   ========================================================================== */
.single-product__title { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.single-product__price { font-size: 1.5rem; font-weight: 700; color: #1a6f3c; margin-bottom: 1.5rem; }
.single-product__price del { font-size: 1rem; color: #999; font-weight: 400; }
.single-product__price ins { text-decoration: none; }

.woo-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e5e0d8;
    border-radius: 8px;
    overflow: hidden;
}
.woo-qty button, .woo-qty input { height: 48px; border: none; background: none; }
.woo-qty button {
    width: 40px;
    font-size: 1.25rem;
    cursor: pointer;
    color: #333;
}
.woo-qty button:hover { background: #f8f5f0; color: #1a6f3c; }
.woo-qty input {
    width: 60px;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid #e5e0d8;
    border-left: 1px solid #e5e0d8;
}

/* Related Products */
.related-products { margin-top: 3rem; }
.related-products__title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}
.related-products__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 3px;
    background: #c8952b;
}

/* ==========================================================================
   8. Cart & Checkout Tables
   ========================================================================== */
.cart-table {
    width: 100%;
    border-collapse: collapse;
}
.cart-table th {
    background: #f8f5f0;
    padding: 1rem;
    text-align: right;
    font-weight: 600;
    border-bottom: 2px solid #e5e0d8;
}
.cart-table td {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #e5e0d8;
    vertical-align: middle;
}
.cart-table__remove {
    color: #dc3545;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: none !important;
}

/* ==========================================================================
   9. WooCommerce Notices
   ========================================================================== */
.woocommerce-message {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    background: #e8f5e9;
    border: 1px solid #1a6f3c;
    color: #145a30;
}
.woocommerce-error {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    background: #fce4ec;
    border: 1px solid #dc3545;
    color: #b71c1c;
}
.woocommerce-info {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    background: #e3f2fd;
    border: 1px solid #1565c0;
    color: #0d47a1;
}

/* ==========================================================================
   10. Sidebar & Widgets
   ========================================================================== */
.widget {
    background: #fff;
    border: 1px solid #e5e0d8;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.widget__title {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0ebe3;
}

/* ==========================================================================
   11. Pagination
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
.pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #e5e0d8;
    border-radius: 8px;
    font-weight: 500;
    color: #333;
    transition: all 150ms ease;
}
.pagination .page-numbers.current {
    background: #1a6f3c;
    color: #fff;
    border-color: #1a6f3c;
}
.pagination .page-numbers:hover:not(.current) {
    background: #f8f5f0;
}

/* ==========================================================================
   12. Breadcrumbs
   ========================================================================== */
.woocommerce-breadcrumb {
    font-size: 0.875rem;
    color: #999;
    margin-bottom: 1.5rem;
    padding: 0.75rem 0;
}
.woocommerce-breadcrumb a { color: #666; }
.woocommerce-breadcrumb a:hover { color: #1a6f3c; }

/* ==========================================================================
   13. Posts Grid (Blog)
   ========================================================================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.post-card {
    background: #fff;
    border: 1px solid #e5e0d8;
    border-radius: 8px;
    padding: 1.5rem;
}
.post-card__image img {
    border-radius: 8px;
    margin-bottom: 1rem;
}
.post-card__title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}
.post-card__title a { color: #1a1a1a; }
.post-card__title a:hover { color: #1a6f3c; }

/* ==========================================================================
   14. Utilities
   ========================================================================== */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }
.mt-3 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 1.5rem; }
.mb-3 { margin-bottom: 2rem; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
.social-links { display: flex; gap: 0.75rem; margin-top: 1rem; }
.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    font-size: 1rem;
    transition: background 150ms ease;
}
.social-link:hover { background: #c8952b; }
