/*
Theme Name: Alia New Store
Author: Trae AI
Description: A modern, high-performance grocery store theme with improved UX and layout.
Version: 3.1.5
Text Domain: alia-new-store
*/

:root {
  /* Brand Colors */
  --brand: #16a34a;       /* Primary Green */
  --brand-dark: #14532d;  /* Dark Green */
  --brand-light: #84cc16; /* Light Green */
  --accent: #f59e0b;      /* Orange/Gold */
  --danger: #ef4444;      /* Red */
  
  /* UI Colors */
  --bg: #f8fafc;          /* Light Gray Background */
  --surface: #ffffff;     /* White Surface */
  --surface-alt: #f1f5f9; /* Alt Surface */
  --text-main: #0f172a;   /* Dark Text */
  --text-muted: #64748b;  /* Muted Text */
  --border: #e2e8f0;      /* Light Border */
  
  /* Spacing & Layout */
  --container-width: 1280px;
  --header-height: 80px;
  --radius: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 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 10px 10px -5px rgb(0 0 0 / 0.04);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
}
/* RTL Support */
body.rtl {
    direction: rtl;
    text-align: right;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; padding: 0; margin: 0; }

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 
========================================
   WOOCOMMERCE CUSTOM STYLES
========================================
*/

/* General Wrapper */
.woocommerce-page-wrapper {
    background: #f8fafc;
    min-height: 80vh;
}

/* 1. Buttons & Inputs */
.woocommerce button.button, 
.woocommerce a.button, 
.woocommerce input.button,
.woocommerce #respond input#submit {
    background: var(--brand) !important;
    color: white !important;
    border-radius: 999px !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 700 !important;
    border: none !important;
    transition: all 0.3s ease !important;
}
.woocommerce button.button:hover, 
.woocommerce a.button:hover, 
.woocommerce input.button:hover {
    background: var(--brand-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.woocommerce input[type="text"],
.woocommerce input[type="email"],
.woocommerce input[type="tel"],
.woocommerce input[type="password"],
.woocommerce textarea,
.woocommerce select {
    padding: 0.75rem 1rem !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background: white !important;
    box-shadow: none !important;
}
.woocommerce input:focus,
.woocommerce textarea:focus {
    border-color: var(--brand) !important;
    outline: none !important;
}

/* 2. Product Grid (Shop Page) */
.woocommerce ul.products li.product {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.woocommerce ul.products li.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--brand-light);
}
.woocommerce ul.products li.product img {
    border-radius: 12px;
    margin-bottom: 1rem !important;
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    color: var(--text-main);
    padding: 0.5rem 0 !important;
}
.woocommerce ul.products li.product .price {
    color: var(--brand-dark) !important;
    font-weight: 800 !important;
    font-size: 1.1rem !important;
}
.woocommerce ul.products li.product .button {
    margin-top: 1rem !important;
    width: 100%;
    text-align: center;
}

/* 3. Cart Page */
.woocommerce-cart-form {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
}
.woocommerce table.shop_table {
    border: none !important;
    border-radius: 0 !important;
}
.woocommerce table.shop_table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 1rem !important;
}
.woocommerce table.shop_table td {
    padding: 1.5rem 1rem !important;
    border-top: 1px solid #f1f5f9 !important;
}
.woocommerce-cart .cart-collaterals .cart_totals {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid #e2e8f0;
}

/* 4. Checkout Page */
.woocommerce-checkout .col-1, 
.woocommerce-checkout .col-2 {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
}
#order_review {
    background: #f8fafc;
    padding: 2rem;
    border-radius: 16px;
    border: 1px dashed var(--brand);
}

/* 5. My Account */
.woocommerce-account .woocommerce-MyAccount-navigation {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.woocommerce-account .woocommerce-MyAccount-navigation li {
    margin-bottom: 0.5rem;
}
.woocommerce-account .woocommerce-MyAccount-navigation li a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-main);
    font-weight: 600;
    transition: all 0.2s;
}
.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a,
.woocommerce-account .woocommerce-MyAccount-navigation li a:hover {
    background: var(--brand);
    color: white;
}
.woocommerce-account .woocommerce-MyAccount-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

/* 6. Messages (Alerts) */
.woocommerce-message, 
.woocommerce-info, 
.woocommerce-error {
    border-top: none !important;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    padding: 1rem 1.5rem !important;
    font-weight: 500;
}
.woocommerce-message {
    background-color: #dcfce7 !important;
    color: #166534 !important;
}
.woocommerce-info {
    background-color: #eff6ff !important;
    color: #1e40af !important;
}
.woocommerce-error {
    background-color: #fef2f2 !important;
    color: #991b1b !important;
}

/* RTL Tweaks for WooCommerce */
body.rtl .woocommerce ul.products li.product,
body.rtl .woocommerce-page ul.products li.product {
    float: right;
}

/* Header */
.site-header {
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.75rem 0;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

/* Brand */
.brand-logo img {
    height: 50px;
    width: auto;
    transition: transform 0.3s;
}
.brand-logo:hover img { transform: scale(1.05); }

/* Nav Menu */
.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}
.nav-link {
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s;
}
.nav-link i { color: var(--brand); font-size: 1.1rem; }
.nav-link:hover {
    background: var(--surface-alt);
    color: var(--brand-dark);
}

/* Actions Area */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.lang-switcher a {
    font-weight: 800;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    transition: 0.2s;
}
.lang-switcher a:hover {
    border-color: var(--brand);
    color: var(--brand);
}
.icon-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--surface-alt);
    color: var(--text-main);
    font-size: 1.2rem;
    position: relative;
    transition: 0.2s;
}
.icon-btn:hover {
    background: var(--brand);
    color: white;
    transform: translateY(-2px);
}

/* RTL Specific Header Fixes */
body.rtl .header-inner {
    flex-direction: row; /* Ensure standard flow */
}
body.rtl .nav-menu {
    margin-right: auto; /* Push to left */
    margin-left: 0;
}
/* Ensure logo is on Right (start), Actions on Left (end) */
/* Flex order is natural in RTL: Logo -> Nav -> Actions */

/* Mobile Header */
@media (max-width: 992px) {
    .nav-menu {
        display: none; /* Hide desktop menu */
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        gap: 0.5rem;
    }
    .mobile-toggle { display: flex !important; }
    .nav-link { width: 100%; padding: 1rem; justify-content: flex-start; }
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--bg) 0%, #eef2ff 100%);
    padding: 6rem 0; 
    position: relative;
    overflow: hidden;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    align-items: center;
}
.hero-title { font-size: 3.5rem; color: var(--brand-dark); margin-bottom: 1.5rem; line-height: 1.2; }

/* Hero Visual Container - The Reference Point */
.hero-visual { 
    position: relative; 
    display: flex;
    justify-content: center; /* Center the image in its column */
    align-items: center;
    min-height: 400px; /* Ensure height for absolute items */
}

/* The Main Image */
.hero-bg-img {
    border-radius: 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    transform: perspective(1000px) rotateY(-5deg);
    transition: transform 0.5s;
    max-width: 80%; /* Leave space for floating items */
    z-index: 1;
}
.hero-bg-img:hover { transform: perspective(1000px) rotateY(0) scale(1.02); }

/* Floating Cards - Strictly Stacked on the Right */
.float-card {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.8rem 1.2rem; /* Compact padding */
    border-radius: 1rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: float 4s ease-in-out infinite;
    z-index: 10;
    min-width: 180px;
    border: 1px solid rgba(255,255,255,0.8);
    transition: 0.3s;
    /* Reset positions */
    top: auto; bottom: auto; left: auto; right: auto;
}

/* 
   Stacking Strategy:
   - All aligned to the RIGHT of the .hero-visual container.
   - Evenly spaced vertically.
*/

/* Card 1: Top */
.float-1 { 
    top: 5%; 
    right: -20px; /* Slight overlap or sticking out */
    animation-delay: 0s; 
}

/* Card 2: Center */
.float-2 { 
    top: 50%; 
    right: -20px;
    transform: translateY(-50%); /* Center vertically */
    animation-delay: 1.5s; 
}
/* Override animation for Card 2 to keep centering + float */
@keyframes float-center {
    0%, 100% { transform: translateY(-50%); }
    50% { transform: translateY(calc(-50% - 10px)); }
}
.float-2 { animation-name: float-center; }

/* Card 3: Bottom */
.float-3 { 
    bottom: 5%; 
    right: -20px;
    animation-delay: 0.8s; 
}

/* Mobile: Hide or Simplify */
@media (max-width: 992px) {
    .float-card { 
        position: relative; 
        right: auto; top: auto; bottom: auto; left: auto;
        transform: none !important;
        animation: none;
        margin: 1rem auto;
        width: fit-content;
    }
}

/* Features */
.features-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); /* Force 3 columns */
    gap: 2rem; 
    text-align: center; /* Center content inside */
}
.feature-item { 
    display: flex; 
    flex-direction: column; /* Icon top, text bottom */
    gap: 1rem; 
    align-items: center; 
    padding: 2rem; 
    border-radius: 1rem; 
    transition: 0.3s; 
    background: white;
    border: 1px solid transparent;
}
.feature-item:hover { 
    background: white; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); 
    border-color: var(--border);
}
.feature-icon {
    width: 70px; height: 70px;
    background: var(--surface-alt);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--brand); font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

/* Categories */
.cat-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); /* Force 4 columns */
    gap: 1.5rem; 
    margin-top: 3rem; 
}
.cat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem 1rem;
    text-align: center;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Responsive Grid Fallbacks */
@media (max-width: 992px) {
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .features-grid { grid-template-columns: 1fr; }
    .cat-grid { grid-template-columns: 1fr; }
}

/* Footer - Enhanced */
.site-footer { 
    background: #1e293b; /* Dark Slate */
    color: white; 
    padding: 5rem 0 2rem; 
    position: relative;
    overflow: hidden;
}
/* Add a subtle top border gradient */
.site-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--brand), var(--accent));
}

.footer-grid { 
    display: grid; 
    grid-template-columns: 1.5fr 1fr 1fr; /* 3 Columns */
    gap: 4rem; 
    margin-bottom: 3rem; 
}

.footer-title { 
    color: white; 
    margin-bottom: 1.5rem; 
    font-size: 1.2rem;
    position: relative;
    padding-bottom: 0.5rem;
}
.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0; 
    right: 0; /* RTL alignment default */
    width: 40px;
    height: 2px;
    background: var(--brand);
}
body.ltr .footer-title::after { left: 0; right: auto; }

.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 0.75rem; }
.footer-links a { 
    color: #cbd5e1; /* Lighter gray for better contrast */
    text-decoration: none;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.footer-links a:hover { 
    color: var(--accent); 
    transform: translateX(-5px); /* RTL move left */
}
body.ltr .footer-links a:hover { transform: translateX(5px); }

.copyright { 
    border-top: 1px solid #334155; 
    padding-top: 2rem; 
    text-align: center; 
    color: #94a3b8; 
    font-size: 0.9rem;
}

/* Mobile Footer */
@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; text-align: center; }
    .footer-title::after { right: 50%; transform: translateX(50%); } /* Center underline */
    .footer-links a { justify-content: center; }
}

