﻿/* ==========================================================================
   הגדרות בסיס ומשתנים (Global Variables) - עיצוב מודרני
   ========================================================================== */
:root {
    /* --- פלטת צבעים מקצועית לחנות --- */
    
    --primary-color: #2c3e50;
    --primary-light: #3d566e;
    --primary-dark: #1a252f;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #098ae5;
    --gold-color: #d4a853;
    
    /* --- צבעי רקע --- */
    --bg-light: #F9F8F6;
    --bg-white: #ffffff;
    --bg-gray-50: #fafafa;
    --bg-gray-100: #f4f4f5;
    --bg-gray-200: #e4e4e7;
    
    /* --- צבעי וואטסאפ --- */
    --whatsapp-green: #54C644;
    --whatsapp-dark: #41A332;
    --whatsapp-light: #dcfce7;
    
    /* --- צבעי טקסט --- */
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;
    --text-light: #ffffff;
    
    /* --- הגדרות ניהול --- */
    --admin-bg: #F9F8F6;
    --sidebar-width: 280px;
    --sidebar-bg: #ffffff;
    --sidebar-active: #2c3e50;
    --sidebar-hover: #f4f4f5;
    
    /* --- גבולות ורווחים --- */
    --container-max-width: 1200px;
    --spacing-mobile: 16px;
    --spacing-desktop: 32px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --border-radius-lg: 24px;
    
    /* --- צללים --- */
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-xl: none;
    
    /* --- טיפוגרפיה רספונסיבית --- */
    --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* גדלי טקסט מינימליים לקריאות */
    --font-size-xs: 0.75rem;   /* 12px - שימוש מוגבל */
    --font-size-sm: 0.875rem;  /* 14px */
    --font-size-base: 1rem;    /* 16px - מינימום לגוף טקסט */
    --font-size-lg: 1.125rem;  /* 18px */
    --font-size-xl: 1.25rem;   /* 20px */
    
    /* Touch target מינימלי לפי הנחיות Apple/Google */
    --touch-target-min: 44px;
    
    /* --- טרנזישנים --- */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* --- Breakpoints לייחוס --- */
    /* 320px - מובייל קטן */
    /* 375px - מובייל רגיל */
    /* 576px - מובייל גדול */
    /* 768px - טאבלט */
    /* 992px - דסקטופ */
    /* 1200px - דסקטופ גדול */
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Category Filter - Hide promotional sections */
.category-hidden {
    display: none !important;
}

/* Products Section - White Background */
.products-section {
    background: #ffffff;
    margin-top: 30px;
}

.products-main {
    background: #ffffff;
}

/* ==========================================================================
   Site Header - סרגל עליון קבוע
   ========================================================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: none;
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.site-header.header-hidden {
    transform: translateY(-100%);
}

.header-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
    justify-content: space-between;
    padding: 7px 12px 0;
    gap: 12px;
}

/* Header Logo - Centered */
.header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
}

.header-logo img {
    height: 38px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.header-logo:hover img {
    transform: scale(1.02);
}

/* Header Buttons */
.header-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 1.3rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.header-btn:hover {
    background: var(--bg-gray-100);
    transform: scale(1.05);
}

.header-btn:active {
    transform: scale(0.95);
}

/* Header Right Buttons Container */
.header-right-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Menu Button - Simple Icon */
.header-menu-btn {
    background: transparent;
    color: var(--primary-color);
    font-size: 1.6rem;
    width: auto;
    padding: 8px;
}

.header-menu-btn i {
    transform: scaleX(1.15);
}

.header-menu-btn:hover {
    background: transparent;
    color: var(--primary-dark);
    transform: scale(1.1);
}

/* WhatsApp Button */
.header-whatsapp-btn {
    color: var(--whatsapp-green);
    font-size: 1.4rem;
}

.header-whatsapp-btn:hover {
    background: var(--whatsapp-light);
    color: var(--whatsapp-dark);
}

/* Cart Button */
.header-cart-btn {
    position: relative;
}

.header-cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--danger-color);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    transform: translate(25%, -25%);
    transition: transform 0.2s ease;
}

.header-cart-badge:empty,
.header-cart-badge[data-count="0"] {
    display: none;
}

.header-cart-btn:hover .header-cart-badge {
    transform: translate(25%, -25%) scale(1.1);
}

/* Header Actions Group */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: 8px;
}

.header-actions .header-btn {
    font-size: 1.4rem;
}

/* Body padding to account for fixed header */
body {
    padding-top: 60px;
}

/* Desktop adjustments */
@media (min-width: 768px) {
    .site-header {
        height: 70px;
    }
    
    body {
        padding-top: 70px;
    }
    
    .header-container {
        padding: 0 24px;
    }
    
    .header-logo img {
        height: 50px;
    }
    
    .header-btn {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }
    
    .header-whatsapp-btn {
        font-size: 1.5rem;
    }
    
    .header-actions {
        gap: 8px;
    }
}

/* ==========================================================================
   Hero Section - סקשן לוגו וברכה
   ========================================================================== */

.hero-section {
    background: #ffffff;
    padding: 0;
    text-align: center;
}

.hero-content {
    padding: 12px 16px 0;
}


/* ==========================================================================
   Global Accessibility & Touch Improvements
   ========================================================================== */

/* הסרת הדגשה כחולה בלחיצה על מובייל */
button,
a,
input,
select,
textarea,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

/* שיפור סקרול חלק במובייל */
.overflow-x-auto,
[style*="overflow-x: auto"],
.categories-scroll,
.specials-grid,
.card-slider-track {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Prevent text selection on buttons */
button,
[role="button"] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

html {
    background-color: #ffffff;
    scroll-behavior: auto;
    /* תיקון Xiaomi/MIUI - מניעת הנפחת טקסט אוטומטית */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    width: 100%;
}

html, body {
    scroll-margin-top: 0;
    overflow-anchor: none; /* מונע scroll anchoring אוטומטי */
}

body { 
    font-family: var(--font-family);
    overflow-x: hidden;
    background-color: #ffffff;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* מניעת זום על double-tap */
    touch-action: manipulation;
    /* תיקון Xiaomi/MIUI - רוחב מלא ומניעת הנפחת טקסט */
    width: 100%;
    min-width: 0;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* הגבלת רוחב האתר ל-1200px במסכים גדולים */
@media (min-width: 1201px) {
    /* רקע חיצוני */
    html {
        background: #e9ecef;
    }
    
    /* עטיפת התוכן */
    body:not(.admin-body) {
        max-width: 1200px;
        margin: 0 auto;
        background: #ffffff;
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.1);
        overflow-x: visible;
    }
    
    /* Header - רוחב מותאם לאתר */
    .site-header {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: 1200px !important;
        max-width: 1200px !important;
    }
    
    /* תיקון כשה-header מוסתר */
    .site-header.header-hidden {
        transform: translateX(-50%) translateY(-100%) !important;
    }
    
    .header-container {
        max-width: 100%;
        padding: 0 24px;
    }
    
    /* Header Search Panel - התאמה לרוחב */
    .header-search-panel {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(-100%);
        width: 1200px;
        max-width: 1200px;
        padding-top: 78px; /* גובה ההדר + padding במסכים גדולים */
    }
    
    .header-search-panel.open {
        transform: translateX(-50%) translateY(0);
    }
    
    /* Hero/Banner sections - התאמה לרוחב */
    .hero-banner-container,
    #mainCarousel,
    .hero-section {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* סקשנים - מרכוז */
    .categories-bar,
    .specials-section,
    .card-slider-section,
    .reviews-section,
    .products-section,
    section {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* כותרות סקשנים - התאמה למסכים גדולים */
    .magnets-title,
    .specials-title,
    .events-title,
    .section-title,
    section h2 {
        font-size: 1.8rem !important;
        margin-bottom: 28px !important;
        padding-left: 32px;
        padding-right: 32px;
    }
    
    /* Container padding במסכים גדולים */
    section > .container,
    .card-slider-section .container {
        padding-left: 32px !important;
        padding-right: 32px !important;
    }
    
    /* ריווח בין סקשנים במסכים גדולים */
    section {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }

    /* Keep marquee strip compact on desktop */
    .marquee-section {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .categories-bar {
        padding-top: 24px !important;
        padding-bottom: 24px !important;
    }
    
    .card-slider-section {
        margin-top: -140px !important;
    }
    
    /* כותרות הבאנר במסכים גדולים */
    .hero-overlay h1,
    .hero-overlay .display-4,
    .hero-banner-container .hero-overlay h1,
    #mainCarousel .hero-overlay h1.display-4 {
        font-size: 2rem !important;
    }
    
    .hero-overlay p,
    .hero-overlay .lead,
    #mainCarousel .hero-overlay .container p {
        font-size: 1.2rem !important;
    }
    
    /* Footer */
    .bottom-nav,
    .site-footer {
        max-width: 1200px;
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
    }
}

/* =========================================
   ממשק ניהול (Admin Interface) - משופר
   ========================================= */
body.admin-body { 
    background-color: var(--admin-bg); 
    height: 100vh; 
    overflow: hidden; 
}

.wrapper { 
    display: flex; 
    height: 100%; 
}

/* Sidebar משופר */
.sidebar { 
    width: var(--sidebar-width); 
    background: var(--sidebar-bg); 
    border-left: 1px solid var(--bg-gray-200); 
    display: flex; 
    flex-direction: column; 
    transition: transform var(--transition-base); 
    z-index: 1050;
    box-shadow: var(--shadow-md);
}

.sidebar .p-4 {
    background: linear-gradient(135deg, var(--sidebar-active) 0%, var(--primary-light) 100%);
    color: white;
    border-bottom: none;
}

.sidebar .p-4 h4 {
    color: white;
    font-weight: var(--font-weight-bold);
}

.main-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: var(--spacing-desktop); 
    width: 100%;
    background: var(--admin-bg);
}

/* Navigation Links משופרים */
.nav-link { 
    color: var(--text-secondary); 
    padding: 14px 20px; 
    margin: 6px 12px; 
    border-radius: var(--border-radius-sm); 
    font-weight: var(--font-weight-medium); 
    transition: all var(--transition-fast); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    border: none; 
    background: none; 
    width: auto;
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--sidebar-active);
    border-radius: 2px 0 0 2px;
    transition: height var(--transition-fast);
}

.nav-link:hover { 
    background-color: var(--sidebar-hover); 
    color: var(--text-primary); 
    transform: translateX(-2px);
}

.nav-link.active { 
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    color: var(--sidebar-active); 
    font-weight: var(--font-weight-semibold);
}

.nav-link.active::before {
    height: 60%;
}

.nav-link i { 
    width: 24px; 
    text-align: center; 
    font-size: 1.1rem;
}

/* Admin Gallery משופר */
.gallery-item-wrapper { 
    cursor: pointer; 
    position: relative; 
    transition: transform var(--transition-fast);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.gallery-item-wrapper:hover { 
    transform: scale(1.05); 
}

/* Gallery Items in Product Form */
.gallery-item {
    cursor: pointer;
    border-radius: var(--border-radius);
    overflow: visible;
}

.gallery-item:hover {
    transform: scale(1.08) !important;
    z-index: 10;
}

.gallery-item img,
.gallery-item video {
    transition: all var(--transition-fast);
}

.gallery-item:hover img,
.gallery-item:hover video {
    box-shadow: var(--shadow-lg) !important;
}

.gallery-edit-overlay {
    position: absolute; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: rgba(0,0,0,0.6); 
    display: flex; 
    align-items: center; 
    justify-content: center;
    opacity: 0; 
    transition: opacity var(--transition-fast); 
    border-radius: var(--border-radius-sm);
    backdrop-filter: blur(4px);
}

.gallery-item-wrapper:hover .gallery-edit-overlay { 
    opacity: 1; 
}

.gallery-edit-overlay i { 
    color: white; 
    font-size: 1.5rem; 
    transition: transform var(--transition-fast);
}

.gallery-item-wrapper:hover .gallery-edit-overlay i {
    transform: scale(1.1);
}

/* Admin Components משופרים */
.product-thumb { 
    width: 56px; 
    height: 56px; 
    border-radius: var(--border-radius-sm); 
    object-fit: cover; 
    border: 2px solid var(--bg-gray-200);
    transition: all var(--transition-fast);
    background: var(--bg-gray-100);
}

.product-thumb:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* טבלאות משופרות */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-gray-50);
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 16px;
    border-bottom: 2px solid var(--bg-gray-200);
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--bg-gray-100);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.card { 
    border: none; 
    border-radius: var(--border-radius); 
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-base);
    background: var(--bg-white);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.table-hover tbody tr { 
    transition: all var(--transition-fast);
}

.table-hover tbody tr:hover { 
    background-color: var(--bg-gray-50);
    transform: scale(1.01);
}

.admin-link-float { 
    position: fixed; 
    bottom: 24px; 
    left: 24px; 
    z-index: 1000; 
    opacity: 0.85; 
    transition: all var(--transition-base);
    box-shadow: var(--shadow-lg);
    border-radius: 50px;
}

.admin-link-float:hover { 
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* Admin Mobile משופר */
@media (max-width: 768px) {
    .sidebar { 
        position: fixed; 
        top: 0; 
        right: 0; 
        bottom: 0; 
        transform: translateX(100%); 
        box-shadow: var(--shadow-xl);
        z-index: 1050;
    }
    
    .sidebar.show { 
        transform: translateX(0); 
    }
    
    .sidebar-backdrop { 
        position: fixed; 
        top: 0; 
        left: 0; 
        right: 0; 
        bottom: 0; 
        background: rgba(0,0,0,0.5); 
        z-index: 1040; 
        display: none;
        backdrop-filter: blur(2px);
    }
    
    .sidebar-backdrop.show { 
        display: block; 
    }
    
    .main-content { 
        padding: var(--spacing-mobile); 
    }
    
    .table-responsive { 
        border: 1px solid var(--bg-gray-200); 
        border-radius: var(--border-radius); 
        background: var(--bg-white);
        box-shadow: var(--shadow-sm);
    }
    
    .table td, .table th { 
        white-space: nowrap; 
        padding: 12px 8px;
    }
}

/* Utils משופרים */
.loading-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background: rgba(255,255,255,0.95); 
    z-index: 9999; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    backdrop-filter: blur(4px);
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 3px;
}

.toast-container { 
    z-index: 1060 !important; 
}

