/* ═══════════════════════════════════════════════════════════════════════════════
   TRIVEXA SHOP - E-COMMERCE STYLES
   Reference: docs/ECOMMERCE_FULL_PLAN.md
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   CSS VARIABLES
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    /* Trivexa brand system — matches TrivexaERP/wwwroot/css/trivexa-page-identity.css
       so the storefront reads as the same product, not a disconnected template. */
    --primary: #FF9F43;
    --primary-dark: #E88A2E;
    --primary-light: #FFF4EC;
    --primary-glow: rgba(255, 159, 67, 0.25);
    --secondary: #092C4C;
    --secondary-light: #0D3A5F;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-700: #334155;
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-arabic: 'Tajawal', 'Plus Jakarta Sans', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(9 44 76 / 0.04);
    --shadow: 0 1px 3px 0 rgb(9 44 76 / 0.08), 0 1px 2px -1px rgb(9 44 76 / 0.06);
    --shadow-md: 0 4px 10px -2px rgb(9 44 76 / 0.10), 0 2px 4px -2px rgb(9 44 76 / 0.06);
    --shadow-lg: 0 16px 28px -8px rgb(9 44 76 / 0.16), 0 4px 8px -4px rgb(9 44 76 / 0.08);
    --radius: 0.5rem;
    --radius-lg: 1rem;
    --transition: all 0.2s ease;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BASE STYLES
   ───────────────────────────────────────────────────────────────────────────── */
body {
    font-family: var(--font-primary);
    color: var(--dark);
    background-color: var(--light);
    line-height: 1.6;
}

body.rtl {
    font-family: var(--font-arabic);
    direction: rtl;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ─────────────────────────────────────────────────────────────────────────────
   TOP BAR
   ───────────────────────────────────────────────────────────────────────────── */
.top-bar {
    font-size: 0.85rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   HEADER & NAVIGATION
   ───────────────────────────────────────────────────────────────────────────── */
.main-header {
    z-index: 1000;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--gray-700);
    padding: 0.5rem 1rem;
    position: relative;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--primary);
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: var(--transition);
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    width: 80%;
}

/* Header icon buttons (search / account / cart) */
.main-header .btn-link {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.main-header .btn-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark) !important;
}

.main-header .btn-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.cart-count {
    background-color: var(--primary) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   HERO SECTION
   ───────────────────────────────────────────────────────────────────────────── */
.hero-section {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    color: white;
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid var(--primary);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    background: radial-gradient(ellipse at top right, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: clamp(1.75rem, 1rem + 3.2vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.hero-subtitle {
    font-size: clamp(1rem, 0.9rem + 0.6vw, 1.25rem);
    opacity: 0.9;
    max-width: 55ch;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PRODUCT CARDS
   ───────────────────────────────────────────────────────────────────────────── */
.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.product-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.product-image {
    position: relative;
    padding-top: 100%; /* 1:1 aspect ratio */
    background-color: var(--gray-100);
    overflow: hidden;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 1;
}

.product-badge.rtl {
    left: auto;
    right: 1rem;
}

.product-badge .badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.4em 0.75em;
    border-radius: 2rem;
    box-shadow: var(--shadow-sm);
}

.badge-featured {
    background-color: var(--primary);
    color: white;
}

.badge-out-of-stock {
    background-color: var(--danger);
    color: white;
}

.product-actions {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    gap: 0.5rem;
}

.product-card:hover .product-actions,
.product-card:focus-within .product-actions {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Touch devices have no hover — keep the actions always reachable */
@media (hover: none) {
    .product-actions {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.product-info {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.product-category {
    font-size: 0.7rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--dark);
    margin-bottom: 0.375rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title a {
    color: inherit;
}

.product-title a:hover {
    color: var(--primary-dark);
}

.product-price {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--secondary);
    margin-top: auto;
    letter-spacing: -0.01em;
}

.product-price .currency {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-dark);
}

/* ─────────────────────────────────────────────────────────────────────────────
   CATEGORY CARDS
   ───────────────────────────────────────────────────────────────────────────── */
.category-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 200px;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.category-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.category-card:hover img {
    transform: scale(1.08);
}

.category-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(9, 44, 76, 0.82) 0%, rgba(9, 44, 76, 0.15) 55%, transparent 100%);
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
}

.category-title {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-add-to-cart {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CART
   ───────────────────────────────────────────────────────────────────────────── */
.cart-table {
    background: white;
    border-radius: var(--radius-lg);
    overflow-x: auto; /* keep 5-column table usable on phones */
    overflow-y: hidden;
}

.cart-table table {
    min-width: 560px; /* below this the columns collapse illegibly — scroll instead */
}

.cart-table th {
    background-color: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
}

.cart-summary {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--primary);
}

@media (min-width: 992px) {
    .cart-summary {
        position: sticky;
        top: 96px;
    }
}

.quantity-input {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.quantity-input button {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--gray-700);
}

.quantity-input button:hover {
    background-color: var(--gray-100);
}

.quantity-input input {
    width: 50px;
    height: 36px;
    border: none;
    text-align: center;
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────────────
   FILTERS SIDEBAR
   ───────────────────────────────────────────────────────────────────────────── */
.filter-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.filter-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-list li {
    margin-bottom: 0.125rem;
}

.filter-list a {
    color: var(--gray-700);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.filter-list a:hover {
    color: var(--primary-dark);
    background-color: var(--gray-100);
}

.filter-list a.active {
    color: var(--primary-dark);
    background-color: var(--primary-light);
    font-weight: 600;
}

.filter-count {
    background-color: var(--gray-100);
    color: var(--gray-500);
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    transition: var(--transition);
}

.filter-list a.active .filter-count,
.filter-list a:hover .filter-count {
    background-color: white;
    color: var(--primary-dark);
}

/* ─────────────────────────────────────────────────────────────────────────────
   PAGINATION
   ───────────────────────────────────────────────────────────────────────────── */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: var(--radius) !important;
    border: none;
    color: var(--gray-700);
    padding: 0.5rem 1rem;
    min-width: 42px;
    text-align: center;
}

.page-link:hover {
    background-color: var(--gray-100);
    color: var(--primary);
}

.page-item.active .page-link {
    background-color: var(--primary);
    color: white;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PRODUCT DETAIL
   ───────────────────────────────────────────────────────────────────────────── */
.product-gallery {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.product-main-image {
    border-radius: var(--radius);
    overflow: hidden;
}

.product-main-image img {
    width: 100%;
    height: auto;
}

.product-thumbnails {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.product-thumbnails img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    cursor: pointer;
    opacity: 0.7;
    transition: var(--transition);
}

.product-thumbnails img:hover,
.product-thumbnails img.active {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--primary);
}

.product-detail-info {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.product-detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
}

.product-detail-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
}

.stock-status.in-stock {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.stock-status.out-of-stock {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* ─────────────────────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────────────────────── */
.footer {
    background-color: var(--dark);
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   FORMS
   ───────────────────────────────────────────────────────────────────────────── */
.form-control,
.form-select {
    border-radius: var(--radius);
    border-color: var(--gray-200);
    padding: 0.75rem 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BREADCRUMB
   ───────────────────────────────────────────────────────────────────────────── */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    color: var(--gray-400);
}

.rtl .breadcrumb-item + .breadcrumb-item::before {
    content: '\f053';
}

.breadcrumb-item a {
    color: var(--gray-500);
}

.breadcrumb-item.active {
    color: var(--dark);
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */
.section-title {
    font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.75rem);
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
    position: relative;
    display: inline-block;
    padding-bottom: 0.625rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 2.5rem;
    height: 3px;
    border-radius: 2px;
    background: var(--primary);
}

.rtl .section-title::after {
    left: auto;
    right: 0;
}

.text-center .section-title::after {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

.section-subtitle {
    color: var(--gray-500);
    margin-bottom: 2rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   FEATURE CARDS (home page trust strip)
   ───────────────────────────────────────────────────────────────────────────── */
.feature-card {
    background: white;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.25rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 1.5rem;
}

.feature-card h5 {
    font-size: 1rem;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .product-detail-title {
        font-size: 1.5rem;
    }

    .product-detail-price {
        font-size: 1.5rem;
    }

    .product-info {
        padding: 0.875rem;
    }

    .product-price {
        font-size: 1.15rem;
    }

    .filter-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .btn-icon {
        width: 44px;
        height: 44px; /* comfortable touch target */
    }

    .feature-card {
        padding: 1.25rem 0.875rem;
    }

    .feature-icon {
        width: 52px;
        height: 52px;
        font-size: 1.2rem;
    }
}

/* Sticky filter sidebar on desktop so filters stay in reach while scrolling */
@media (min-width: 992px) {
    .filter-sidebar-sticky {
        position: sticky;
        top: 96px;
    }
}

/* Mobile filter toggle button (hidden on desktop) */
.filter-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.625rem 1rem;
    font-weight: 600;
    color: var(--dark);
    box-shadow: var(--shadow-sm);
}

.filter-toggle-btn:hover,
.filter-toggle-btn:focus {
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MOTION PREFERENCES
   ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

