/* assets/css/style.css */

/* Reset & Basics */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    /* Remove blue highlight on tap */
    outline: none;
    /* Remove focus outline */
}

:root {
    /* Premium Palette - dynamic from DB but defaults refreshed */
    --primary: #FF6B6B;
    --primary-rgb: 255, 107, 107;
    --secondary: #2D3436;
    --bg: #ffffff;
    --glass: rgba(255, 255, 255, 0.95);
    /* Increased opacity for better readability */
    --glass-border: rgba(255, 255, 255, 0.6);
    --text: #2D3436;
    --text-light: #636E72;
    --white: #ffffff;
    --radius: 16px;
    --shadow: none;
    /* Removed shadow */
    --shadow-hover: none;
    /* Removed shadow */
}

body {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    color: var(--text);
    background-color: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    /* Clean background to respect user color preference */
    overflow-x: hidden;
    /* Clean background to respect user color preference */
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    font-family: inherit;
    transition: 0.3s;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 50px;
    /* Pill shape */
    font-weight: 700;
    text-align: center;
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: var(--primary);
    /* Use Admin Variable */
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.btn-secondary {
    background: var(--white);
    color: var(--secondary);
    border: 1px solid #eee;
}

.btn-secondary:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Header - Modern Glass */
.site-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: 0.3s;
}

.header-inner {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo Styles - Restored */
.logo {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    max-height: 50px;
    width: auto;
    object-fit: contain;
}

.nav-desktop {
    display: none;
    /* Hidden globally */
}

/* Ensure mobile toggle is visible globally */
.mobile-toggle {
    display: block !important;
    background: none;
    border: none;
    color: var(--secondary);
}

/* Duplicate mobile-bottom-nav removed */

/* Hero Section */
.hero {
    position: relative;
    height: 70vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    background-color: var(--secondary);
    /* Use Admin Variable */
    background-size: cover;
    background-position: center;
    margin: 20px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: none;
}

/* Offcanvas Menu */
.offcanvas {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: var(--white);
    transition: right 0.3s ease;
    will-change: right;
    z-index: 1002;
    /* Higher than overlay */
    border-left: 1px solid var(--border);
    padding: 20px;
    display: block;
    /* Ensure it exists */
}

.offcanvas.active {
    right: 0;
}

.offcanvas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    /* High z-index */
    display: none;
    /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.offcanvas-overlay.active {
    display: block;
    opacity: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    animation: fadeUp 1s ease-out;
}

.hero-logo-circle {
    width: 100px;
    height: 100px;
    background: var(--white);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: fadeUp 1.2s ease-out;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 15px;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Cards */
.category-card {
    text-align: center;
    display: block;
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
    background: transparent;
    /* No frame */
    border: none;
    box-shadow: none;
    padding: 0;
}

.category-card:hover {
    transform: translateY(-5px);
}

.cat-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 35px;
    /* Softer edges */
    object-fit: cover;
    margin-bottom: 10px;
    transition: 0.3s;
    box-shadow: none;
}

.cat-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.category-card:hover .cat-img {
    transform: none;
}

/* Section Title */
.section-title {
    margin: 20px 0 15px;
    font-weight: 800;
    position: relative;
    display: inline-block;
    width: 100%;
}



/* Product Card */
.product-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: 0.3s;
    transition: 0.3s;
}

.product-card-img {
    height: 100px;
    /* Reduced from 120px */
    background: #f9f9f9;
    position: relative;
    overflow: hidden;
}

.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-body {
    padding: 8px;
    /* Compact padding */
}

.product-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.product-card-desc {
    color: #777;
    font-size: 0.75rem;
    /* Smaller font */
    margin-bottom: 6px;
    height: 30px;
    /* Fixed height for 2 lines */
    overflow: hidden;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card-price {
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
}

.product-card-old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.7rem;
}

.product-card-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-card:hover {
    transform: none;
    box-shadow: none;
}

/* Sticky Nav for Menu */
/* Sticky Nav for Menu */
.sticky-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: none;
    /* Removed shadow */
    border-bottom: 1px solid #f0f0f0;
    /* Light border instead of shadow */
    padding: 15px 0;
    position: sticky;
    top: 80px;
    /* Desktop Header Height */
    z-index: 900;
}

/* ... (rest of styles) ... */

@media (max-width: 768px) {
    .sticky-nav {
        top: 70px;
        /* Mobile Header Height */
    }
}

.cat-link {
    background: white;
    border: 1px solid #eee;
    padding: 10px 20px;
    border-radius: 30px;
    transition: 0.3s;
    white-space: nowrap;
    display: inline-block;
}

.cat-link:hover {
    background: var(--bg);
    color: var(--text);
    border-color: #ddd;
    transform: none;
    box-shadow: none;
}

.cat-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: none;
    box-shadow: none;
}

.sort-select {
    padding: 0 12px;
    border-radius: 20px;
    min-width: 110px;
    /* Reduced width */
    height: 38px;
    /* Fixed height to prevent jumping */
    line-height: 38px;
    /* Vertical Center */
    border: 1px solid #eee;
    background: #f1f2f6;
    /* Slightly darker background */
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    /* Ensure Cairo font */
    color: var(--text);
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 8px center;
    /* RTL support - arrow on left */
    padding-left: 30px;
    /* Space for arrow */
    background-size: 10px;
    /* Tiny arrow */
}

.sort-select option {
    background: white;
    color: var(--text);
}

/* Floating Elements (Mobile Nav & Scroll Top) */
.mobile-bottom-nav {
    display: flex;
    /* Visible globally */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px 20px 0 0;
    box-shadow: none;
    padding: 10px 0 20px;
    /* Extra padding for safe area */
    justify-content: space-around;
    z-index: 9999;
}

.nav-item {
    text-align: center;
    flex: 1;
    color: var(--text-light);
    font-size: 0.8rem;
}

.nav-item.active {
    color: var(--primary);
}

/* Scroll To Top - Modern */
.scroll-top {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: var(--primary);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: none;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: 0.3s;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover {
    transform: translateY(-5px);
    box-shadow: none;
}

/* Footer Gap Fix */
.site-footer {
    padding-bottom: 100px !important;
    /* Extra space for bottom nav */
}

/* Modal Premium */
#product-modal-content {
    animation: fadeUp 0.4s ease-out;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-desktop {
        display: none;
    }

    .mobile-toggle {
        display: block !important;
        background: none;
        border: none;
        color: var(--secondary);
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero {
        margin: 10px;
        border-radius: 15px;
        height: 60vh;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero-logo-circle {
        width: 80px;
        height: 80px;
    }

    .header-inner {
        padding: 0 15px;
        height: 70px;
    }

    /* .mobile-bottom-nav handled globally now */
    /* body padding handled globally now */
}

/* Favorite Button - Larger & Shared */
.fav-btn {
    position: absolute;
    top: 8px;
    left: 10px;
    /* Consistently top-left in card */
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 32px;
    /* Larger */
    height: 32px;
    /* Larger */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 5;
    line-height: 0;
}

.fav-btn.active {
    color: #ff4757;
    background: #fff;
}

.fav-btn:hover {
    transform: scale(1.1);
}

.modal-fav-btn {
    top: 8px;
    right: 8px;
    /* Top Right specifically for modal as requested */
    left: auto;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    padding-bottom: 50px;
}

/* Cart Redesign */
.cart-fixed-actions {
    position: fixed;
    bottom: 80px;
    /* Aligned with Bottom Nav top */
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 15px 20px;
    z-index: 990;
    /* Below scroll-top/modal, above content */
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: none;
    min-height: 80px;
    /* Standardize height */
}

.cart-item-clean {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    margin-bottom: 0;
    /* Continuous list */
    position: relative;
    border-bottom: 1px solid #f0f0f0;
    /* Separator */
    background: transparent;
    box-shadow: none;
}

.cart-item-clean:last-child {
    border-bottom: none;
}

.mobile-toggle {
    display: none;
}

/* Default hidden */

/* CRITICAL FIX: Force SVG Icon Sizes */
.nav-item svg,
.mobile-toggle svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    min-height: 24px;
    display: block;
    margin: 0 auto;
}

/* Product Grid - Responsive (Min 2 cols on mobile) */
/* Product Grid - Default */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    padding-bottom: 20px;
}

/* Scroll Reveal Animation */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Force 2 Columns on Mobile */
@media (max-width: 600px) {

    .product-grid,
    .categories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(46, 204, 113, 0.95);
    backdrop-filter: blur(5px);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
    z-index: 10000;
    font-weight: 600;
    font-size: 0.95rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: translateX(-50%) translateY(-20px);
}

.toast-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Skeleton Loading */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 25%, #fafafa 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

/* Skeleton placeholders for image containers */
.product-card-img,
.cat-img,
.offer-card .img-placeholder {
    background: #f0f0f0;
    position: relative;
    overflow: hidden;
}

/* Apply shimmer to empty image containers */
.product-card-img::before,
.cat-img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: skewX(-20deg) translateX(-150%);
    animation: shimmer 1.5s infinite;
    z-index: 1;
    pointer-events: none;
}

/* Ensure images cover the skeleton when loaded */
.product-card-img img,
.cat-img img {
    z-index: 2;
    position: relative;
    background: #fff;
    /* Hide skeleton behind */
}