/*
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: #1f6f55;
  --brand-dark: #0f3d2e;
  --brand-light: #7bdcb5;
  --accent: #d6a74a;
  --danger: #dc2626;
  --on-brand: #ffffff;
  
  /* UI Colors */
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-alt: #f3f2ee;
  --text-main: #102a24;
  --text-muted: #5b6f6a;
  --border: #e6e3dc;
  --focus: rgba(31, 111, 85, 0.25);
  
  /* 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;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 1.25rem;
    border-radius: 999px;
    font-weight: 800;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 10px 24px rgba(15, 61, 46, 0.18); }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--brand-dark); border-color: rgba(16, 42, 36, 0.18); }
.btn-outline:hover { border-color: rgba(16, 42, 36, 0.35); background: rgba(31, 111, 85, 0.06); transform: translateY(-2px); }

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

/* General Wrapper */
.woocommerce-page-wrapper {
    background: var(--bg);
    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(31, 111, 85, 0.22);
}

.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 var(--border) !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 var(--border);
    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: var(--surface-alt);
    color: var(--text-muted);
    font-weight: 600;
    padding: 1rem !important;
}
.woocommerce table.shop_table td {
    padding: 1.5rem 1rem !important;
    border-top: 1px solid var(--surface-alt) !important;
}
.woocommerce-cart .cart-collaterals .cart_totals {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* 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 var(--border);
    margin-bottom: 2rem;
}
#order_review {
    background: var(--bg);
    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 var(--border);
}

/* 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: rgba(31, 111, 85, 0.10) !important;
    color: var(--brand-dark) !important;
}
.woocommerce-info {
    background-color: rgba(214, 167, 74, 0.14) !important;
    color: #5a3b00 !important;
}
.woocommerce-error {
    background-color: rgba(220, 38, 38, 0.10) !important;
    color: #7f1d1d !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: 56px;
    width: auto;
    object-fit: contain;
    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:
        radial-gradient(900px 420px at 12% 12%, rgba(214, 167, 74, 0.16), transparent 60%),
        radial-gradient(900px 520px at 88% 18%, rgba(31, 111, 85, 0.18), transparent 55%),
        linear-gradient(180deg, rgba(16, 42, 36, 0.02), rgba(255, 255, 255, 0));
    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;
    }
}
