﻿/* ===================================
   Main Application Styles
   =================================== */

/* Global Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Apply fade in animation to sections */
section {
    animation: fadeIn 1s ease-out;
}

/* Loading Spinner */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--color-bg-white);
    border-radius: var(--radius-2xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    animation: fadeIn 0.3s ease-out;
}

.modal-header {
    padding: var(--space-xl);
    border-bottom: 2px solid var(--color-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-extrabold);
    margin: 0;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    font-size: var(--font-size-2xl);
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all var(--transition-base);
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.modal-body {
    padding: var(--space-xl);
}

.modal-footer {
    padding: var(--space-xl);
    border-top: 2px solid var(--color-border-light);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--space-xl);
    left: var(--space-xl);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-width: 400px;
}

.toast {
    padding: var(--space-lg);
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border-right: 4px solid var(--color-primary);
    animation: slideInLeft 0.3s ease-out;
    display: flex;
    gap: var(--space-md);
    align-items: start;
}

.toast.success {
    border-right-color: var(--color-success);
}

.toast.error {
    border-right-color: var(--color-error);
}

.toast.warning {
    border-right-color: var(--color-warning);
}

.toast-icon {
    font-size: var(--font-size-xl);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-xs);
}

.toast-message {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    margin: 0;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    padding: var(--space-sm) 0;
    display: none;
    z-index: var(--z-dropdown);
    animation: fadeIn 0.2s ease-out;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: var(--space-md) var(--space-lg);
    color: var(--color-text);
    transition: background var(--transition-base);
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--color-bg);
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: var(--space-sm) 0;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border-light);
    gap: var(--space-lg);
}

.tab {
    padding: var(--space-md) var(--space-lg);
    background: none;
    border: none;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-muted);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-base);
}

.tab:hover {
    color: var(--color-text);
}

.tab.active {
    color: var(--color-primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--color-primary);
}

.tab-content {
    padding: var(--space-xl) 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Progress Bar */
.progress {
    height: 8px;
    background: var(--color-border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    transition: width 0.3s ease;
}

/* Pagination */
.pagination {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    align-items: center;
}

.pagination-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-base);
}

.pagination-item:hover {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

.pagination-item.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

/* Accordion */
.accordion-item {
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.accordion-header {
    padding: var(--space-lg);
    background: var(--color-bg-white);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition-base);
}

.accordion-header:hover {
    background: var(--color-bg);
}

.accordion-title {
    font-weight: var(--font-weight-bold);
    margin: 0;
}

.accordion-icon {
    transition: transform var(--transition-base);
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-body {
    max-height: 500px;
}

.accordion-content {
    padding: var(--space-lg);
    color: var(--color-text-light);
}

/* Avatar */
.avatar {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-border);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
}

.avatar-xl {
    width: 96px;
    height: 96px;
}

/* Rating Stars */
.rating {
    display: flex;
    gap: var(--space-xs);
}

.star {
    color: var(--color-border);
    font-size: var(--font-size-lg);
    cursor: pointer;
    transition: color var(--transition-base);
}

.star.filled {
    color: var(--color-secondary);
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-4xl) var(--space-xl);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-lg);
}

.empty-state-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-md);
}

.empty-state-description {
    color: var(--color-text-light);
    margin-bottom: var(--space-xl);
}

/* Utility Classes for RTL */
.rtl {
    direction: rtl;
    text-align: right;
}

.ltr {
    direction: ltr;
    text-align: left;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: var(--color-secondary);
    color: white;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

/* Cart Sidebar Styles */
.cart-sidebar {
    position: fixed;
    top: 0;
    left: -400px;
    /* Hidden by default (RTL: left side) */
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: left var(--transition-base);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    left: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.cart-overlay.open {
    display: block;
    opacity: 1;
}

.cart-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-cart {
    background: none;
    border: none;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    color: var(--color-text-light);
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.cart-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-light);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-md);
}

/* Cart Item Styles */
.cart-item {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
    position: relative;
}

.cart-item-image {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    margin: 0 0 var(--space-xs);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
}

.cart-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-xs);
}

.cart-item-type {
    color: var(--color-text-light);
    background: var(--color-bg);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.cart-item-price {
    color: var(--color-primary);
    font-weight: var(--font-weight-bold);
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--color-error);
    cursor: pointer;
    font-size: var(--font-size-lg);
    padding: 0 var(--space-xs);
    opacity: 0.7;
    transition: opacity var(--transition-base);
}



/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-4xl) var(--space-xl);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-lg);
}

.empty-state-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-md);
}

.empty-state-description {
    color: var(--color-text-light);
    margin-bottom: var(--space-xl);
}

/* Utility Classes for RTL */
.rtl {
    direction: rtl;
    text-align: right;
}

.ltr {
    direction: ltr;
    text-align: left;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: var(--color-secondary);
    color: white;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}



.nav-brand .brand-name {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.5px;
}

.nav-brand .logo {
    height: 50px;
    /* Adjusted size for better visibility */
    width: auto;
}

/* ===== Footer Styles ===== */
.footer {
    background: var(--color-text);
    color: rgba(255, 255, 255, 0.8);
    padding: var(--space-4xl) 0 var(--space-xl);
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-3xl);
    margin-bottom: var(--space-3xl);
}

.footer-logo {
    height: 50px;
    width: auto;
    margin-bottom: var(--space-md);
    object-fit: contain;
}

.footer-description {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--space-lg);
    line-height: var(--line-height-relaxed);
}

.social-links {
    display: flex;
    gap: var(--space-md);
}

.social-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    transition: all var(--transition-base);
}

.social-link:hover {
    background: var(--color-secondary);
    color: white;
    transform: translateY(-4px);
}

.footer-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: white;
    margin-bottom: var(--space-lg);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: var(--space-md);
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--transition-base);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--color-secondary);
    padding-right: var(--space-sm);
}

.footer-bottom {
    padding-top: var(--space-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-bottom p {
    margin: 0;
    font-size: var(--font-size-sm);
}

.footer-bottom-links {
    display: flex;
    gap: var(--space-xl);
}

.footer-bottom-links a {
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-sm);
    text-decoration: none;
    transition: color var(--transition-base);
}

.footer-bottom-links a:hover {
    color: white;
}

@media (max-width: 968px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* ===== Navbar Styles (From Landing) ===== */
.navbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: var(--color-primary);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    z-index: var(--z-sticky);
    transition: all var(--transition-base);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    gap: var(--space-xl);
}

.nav-brand .logo {
    height: 60px;
    width: auto;
    /* filter: brightness(0) invert(1); - Disabled for browse page */
}

.nav-brand .brand-name {
    color: white !important;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: var(--space-xl);
    margin: 0;
}

.nav-link {
    font-weight: var(--font-weight-medium);
    color: rgba(255, 255, 255, 0.9);
    padding: var(--space-sm) 0;
    position: relative;
    transition: color var(--transition-base);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-secondary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--color-secondary);
    transition: width var(--transition-base);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.btn-text-light {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-weight: var(--font-weight-bold);
    transition: all var(--transition-base);
}

.btn-text-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all var(--transition-base);
}

@media (max-width: 968px) {

    .nav-links,
    .nav-actions {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }
}