/* ═══════════════════════════════════════════════════════════════════════════════
   TRIVEXA SHOP - E-COMMERCE STYLES
   Reference: docs/ECOMMERCE_FULL_PLAN.md
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   CSS VARIABLES
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --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(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --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%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   HERO SECTION
   ───────────────────────────────────────────────────────────────────────────── */
.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="80" cy="20" r="50" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: cover;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PRODUCT CARDS
   ───────────────────────────────────────────────────────────────────────────── */
.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.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;
}

.badge-featured {
    background-color: var(--warning);
    color: var(--dark);
}

.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 {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.product-info {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    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);
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: auto;
}

.product-price .currency {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CATEGORY CARDS
   ───────────────────────────────────────────────────────────────────────────── */
.category-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 200px;
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card:hover img {
    transform: scale(1.1);
}

.category-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, 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: hidden;
}

.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);
}

.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 {
    padding: 0.5rem 0;
}

.filter-list a {
    color: var(--gray-700);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-list a:hover,
.filter-list a.active {
    color: var(--primary);
}

.filter-count {
    background-color: var(--gray-100);
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PAGINATION
   ───────────────────────────────────────────────────────────────────────────── */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: var(--radius) !important;
    border: none;
    color: var(--gray-700);
    padding: 0.5rem 1rem;
}

.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: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--gray-500);
    margin-bottom: 2rem;
}

.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) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .product-detail-title {
        font-size: 1.5rem;
    }
    
    .product-detail-price {
        font-size: 1.5rem;
    }
}

