/* ==================== GLOBAL STYLES ==================== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
    background-color: #f9fafb;
    color: #1f2937;
    line-height: 1.6;
}

:root {
    --primary-color: #5bbfc6;
    --primary-color-rgb: 91, 191, 198;
    --secondary-color: #aee9f2;
    --accent-color: #eafafd;
    --card-background: #ffffff;
    --text-primary: #ea580c;
    --text-secondary: #f97316;
    --border-color: #fed7aa;
    --shadow-color: rgba(249, 115, 22, 0.08);
    --shadow-hover: rgba(249, 115, 22, 0.15);
    --rating-active: #f97316;
    --rating-inactive: #fee2e2;
}

/* ==================== UTILITY CLASSES ==================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.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-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.w-full {
    width: 100%;
}

.w-1\/2 {
    width: 50%;
}

.h-auto {
    height: auto;
}

.h-16 {
    height: 4rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-6 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.rounded {
    border-radius: 0.25rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.border {
    border: 1px solid var(--border-color);
}

.bg-white {
    background-color: #ffffff;
}

.bg-gray-50 {
    background-color: #f9fafb;
}

.bg-gray-100 {
    background-color: #f3f4f6;
}

.bg-gray-200 {
    background-color: #e5e7eb;
}

.bg-blue-50 {
    background-color: #eff6ff;
}

.bg-green-600 {
    background-color: #16a34a;
}

.bg-green-700 {
    background-color: #15803d;
}

.bg-amber-600 {
    background-color: #b45309;
}

.bg-amber-700 {
    background-color: #92400e;
}

.bg-gray-500 {
    background-color: #6b7280;
}

.bg-gray-600 {
    background-color: #4b5563;
}

.text-white {
    color: #ffffff;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: #374151;
}

.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;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.shadow {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.shadow-lg {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.rounded-full {
    border-radius: 9999px;
}

.hidden {
    display: none;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.overflow-hidden {
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================== BUTTONS ==================== */
button,
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
}

button:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #4a9fa6;
    box-shadow: 0 8px 20px rgba(91, 191, 198, 0.3);
}

.btn-success {
    background-color: #16a34a;
    color: white;
}

.btn-success:hover {
    background-color: #15803d;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

/* ==================== FORMS ==================== */
input,
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    text-align: right;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(91, 191, 198, 0.1);
}

/* ==================== MODALS ==================== */
.modal {
    display: none !important;
}

.modal.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.z-50 {
    z-index: 50;
}

.bg-black {
    background-color: #000000;
}

.bg-opacity-50 {
    opacity: 0.5;
}

.max-w-md {
    max-width: 28rem;
}

.max-w-lg {
    max-width: 32rem;
}

.max-w-xl {
    max-width: 36rem;
}

.max-w-2xl {
    max-width: 42rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out both;
}

.animate-slideIn {
    animation: slideIn 0.4s ease-out both;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 640px) {
    .container {
        padding: 0 0.75rem;
    }

    .grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hidden-sm {
        display: none;
    }
}

@media (min-width: 640px) and (max-width: 1024px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ==================== SPECIFIC COMPONENTS ==================== */

/* Category Cards */
.categories-section {
    padding: 2rem 0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 0 auto;
    max-width: 1200px;
    padding: 0 1.5rem;
}

.category-card {
    background: linear-gradient(145deg, #0f2027 0%, #16222a 50%, #1b2a32 100%);
    border: 1px solid rgba(91, 191, 198, 0.25);
    border-radius: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 4px 20px rgba(91, 191, 198, 0.15);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    position: relative;
    height: 280px;
    animation: fadeInUp 0.6s ease-out both;
}

.category-card:hover,
.category-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 20px 60px rgba(91, 191, 198, 0.25), 0 8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-12px) scale(1.02);
}

.category-image-wrapper {
    width: 100%;
    height: 200px;
    border-radius: 1.5rem 1.5rem 0 0;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.category-card:hover .category-image-wrapper img {
    transform: scale(1.08);
    filter: brightness(1.05) saturate(1.1);
}

.category-info {
    position: relative;
    min-height: 60px;
    width: 100%;
    padding: 0.8rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0f2027 0%, #16222a 60%, #1b2a32 100%);
    border-top: 1px solid rgba(91, 191, 198, 0.25);
}

.category-name {
    font-weight: 700;
    font-size: 1rem;
    color: lightgoldenrodyellow;
    text-align: center;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(91, 191, 198, 0.1);
}

.category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 2rem;
    text-align: center;
    box-shadow: 0 6px 20px rgba(91, 191, 198, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 2;
}

.category-icon {
    font-size: 3rem;
    color: var(--primary-color);
    filter: drop-shadow(0 4px 12px rgba(91, 191, 198, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Product Cards */
.products-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.product-card {
    background: #0e1f25 !important;
    border-radius: 1rem;
    box-shadow: 0 4px 20px var(--shadow-color);
    transition: all .3s cubic-bezier(.23, 1, .32, 1);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    border: 1px solid var(--border-color);
    position: relative;
    animation: fadeInUp .6s ease-out both;
}

.product-card:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

.product-image-wrapper {
    flex-shrink: 0;
    width: 200px;
    min-height: 180px;
    position: relative;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fallback-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

.fallback-thumb.hidden {
    display: none;
}

.badge-featured {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.product-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #0e1f25;
    color: #ddd !important;
}

.product-header {
    margin-bottom: 0.75rem;
    flex: 1;
}

.product-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: white !important;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.product-name-en {
    font-size: 0.875rem;
    color: white !important;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.product-description {
    font-size: 0.9rem;
    color: wheat;
    line-height: 1.6;
    margin-top: 0.5rem;
    margin-bottom: 0;
    display: block;
    opacity: 0.9;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.price-chip {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 9999px;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(91, 191, 198, 0.3);
}

.price-chip .currency {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.9;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .product-card {
        flex-direction: column;
        min-height: auto;
    }
    
    .product-image-wrapper {
        width: 100%;
        height: 200px;
        min-height: 200px;
    }
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

body.login-page {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.login-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 100%;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #ea580c 0%, #d97706 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.login-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

/* Header/Navigation */
header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
}

/* Footer */
footer {
    background: #1f2937;
    color: white;
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
}

/* Loading spinner */
.spinner {
    border: 4px solid rgba(91, 191, 198, 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background-color: rgba(91, 191, 198, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Rating stars */
.stars {
    display: flex;
    gap: 0.25rem;
}

.star {
    color: var(--rating-inactive);
    cursor: pointer;
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.star.active {
    color: var(--rating-active);
}

.star:hover {
    color: var(--rating-active);
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states for accessibility */
button:focus,
a:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
