@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --background: 210 40% 98%;
    /* #f8fafc - Very light gray/white */
    --foreground: 222.2 84% 4.9%;

    --header-bg: 220 30% 12%;
    /* Dark Blue/Slate like screenshot */
    --header-text: 210 40% 98%;

    --primary: 221 83% 53%;
    /* #2563eb - Bright Blue */
    --primary-foreground: 210 40% 98%;

    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;

    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    /* Gray text */

    --tag-bg: 210 100% 96%;
    /* Light Blue for tags */
    --tag-text: 221 83% 53%;

    --border: 214.3 31.8% 91.4%;
    --radius: 0.75rem;
    /* Rounded corners */
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: 'Inter', 'Cairo', sans-serif;
    /* Cairo for Arabic support */
    line-height: 1.5;
}

/* --- Layout Utilities --- */
.container {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}

@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .md\:flex {
        display: flex;
    }

    .md\:hidden {
        display: none;
    }
}

/* --- Spacing --- */
.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.py-12 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

/* --- Text --- */
.text-center {
    text-align: center;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.font-medium {
    font-weight: 500;
}

.font-bold {
    font-weight: 700;
}

.text-white {
    color: #fff;
}

.text-muted {
    color: hsl(var(--muted-foreground));
}

.text-primary {
    color: hsl(var(--primary));
}

.text-right {
    text-align: right;
}

/* --- Components --- */

/* Header */
header {
    background-color: hsl(var(--header-bg));
    color: hsl(var(--header-text));
    height: 70px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.nav-link {
    color: #eff6ff;
    /* Very light blue/white */
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: hsl(var(--primary));
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.25rem;
    padding: 0 1rem;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-ghost {
    background-color: transparent;
    color: inherit;
}

/* Search Bar Area */
.search-container {
    max-width: 600px;
    /* margin: 0 auto; Removed to allow flex alignment with filter button */
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 2rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    padding: 0.25rem;
    border: 1px solid #e2e8f0;
}

.search-icon {
    padding-left: 1rem;
    color: hsl(var(--muted-foreground));
}

.search-input {
    flex: 1;
    border: none;
    padding: 0.75rem;
    font-size: 0.95rem;
    outline: none;
    font-family: inherit;
}

.search-btn {
    background-color: hsl(var(--primary));
    color: white;
    border: none;
    border-radius: 1.5rem;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
}

.filter-btn {
    width: 48px;
    /* Slightly larger to match search height usually */
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    /* margin-left: 1rem; removed to rely on flex gap */
    color: hsl(var(--foreground));
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    /* Slightly deeper shadow */
    cursor: pointer;
    border: 1px solid #e2e8f0;
    /* Subtle border to match search container context */
    transition: all 0.2s ease;
}

.filter-btn:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

/* Tags */
.tag-pill {
    background-color: hsl(var(--tag-bg));
    color: hsl(var(--tag-text));
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s;
}

.tag-pill:hover {
    background-color: #dbeafe;
}

/* Banner */
.banner {
    background: black;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    width: 100%;
    aspect-ratio: 21/9;
    /* Ultrawide */
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

.banner-content {
    position: absolute;
    z-index: 10;
    text-align: left;
    left: 5%;
    color: white;
}

/* Cards */
.card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    /* Taller image as per screenshot */
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-tags {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    /* Arabic Alignment? Check later */
    display: flex;
    gap: 0.5rem;
}

.card-tag {
    background-color: #f59e0b;
    /* Orange pill */
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-weight: 600;
}

.card-tag.blue {
    background-color: hsl(var(--primary));
}

.card-price-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background-color: #ef4444;
    /* Red badge */
    color: white;
    font-weight: bold;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.card-body {
    padding: 1rem;
}

/* RTL Helpers for Arabic Text */
.rtl {
    direction: rtl;
}

/* Footer Custom Background */
.bg-footer-dark {
    background-color: hsl(var(--header-bg)) !important;
}

/* Card Updates for Cart Functionality */
.card-body {
    padding-bottom: 0.5rem;
}

.card-footer {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.price-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

.old-price {
    text-decoration: line-through;
    color: #94a3b8;
    /* gray-400 */
    font-size: 0.9rem;
}

.new-price {
    color: #2563eb;
    /* blue-600 */
    font-size: 1.1rem;
}

.btn-add-cart {
    width: 100%;
    background-color: #2563eb;
    /* blue-600 */
    color: white;
    padding: 0.6rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-add-cart:hover {
    background-color: #1d4ed8;
    /* blue-700 */
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out forwards;
    border-left: 4px solid #2563eb;
    /* Blue accent */
    border: 1px solid #e5e7eb;
}

.toast.success {
    border-left-color: #2563eb;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1f2937;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toast-message {
    font-size: 0.85rem;
    color: #4b5563;
    line-height: 1.4;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* --- Cart Page Utilities (Replacements for missing Tailwind classes) --- */
.bg-gray-50 {
    background-color: #f9fafb;
}

.bg-white {
    background-color: #ffffff;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.p-8 {
    padding: 2rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-md {
    border-radius: 0.375rem;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.w-32 {
    width: 8rem;
}

.h-20 {
    height: 5rem;
}

.object-cover {
    object-fit: cover;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.flex-grow {
    flex-grow: 1;
}

.items-start {
    align-items: flex-start;
}

.gap-8 {
    gap: 2rem;
}

.text-gray-900 {
    color: #111827;
}

.text-gray-700 {
    color: #374151;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-400 {
    color: #9ca3af;
}

.text-gray-300 {
    color: #d1d5db;
}

.text-blue-600 {
    color: #2563eb;
}

.text-green-600 {
    color: #16a34a;
}

.text-red-400 {
    color: #f87171;
}

.text-red-600 {
    color: #dc2626;
}

.space-y-4>*+* {
    margin-top: 1rem;
}

.space-y-3>*+* {
    margin-top: 0.75rem;
}

.border {
    border-width: 1px;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.border-t {
    border-top-width: 1px;
}

.sticky {
    position: sticky;
}

.top-4 {
    top: 1rem;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.hover\:bg-gray-50:hover {
    background-color: #f9fafb;
}

.hover\:bg-blue-700:hover {
    background-color: #1d4ed8;
}

.hover\:text-red-600:hover {
    color: #dc2626;
}

.line-through {
    text-decoration: line-through;
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lg\:col-span-2 {
        grid-column: span 2 / span 2;
    }

    .lg\:col-span-1 {
        grid-column: span 1 / span 1;
    }
}