/* ההוספה הפרטית שלי */
.center {text-align: center;}
.about {font-size: 20pt;}
/* ההוספה הפרטית שלי */

/* =========================================
   1. הגדרות בסיס ומשתנים
   ========================================= */
:root {
    --zap-blue: #004a99;
    --zap-orange: #ff6600;
    --zap-green: #2ecc71;
    --zap-light: #f0f2f5;
    --zap-dark: #2c3e50;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden; /* מניעה מוחלטת של גלילה אופקית */
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--zap-light);
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* =========================================
   2. ניווט (Header) - עיצוב מודרני מיושר
   ========================================= */
.main-header {
    width: 100%;
    background: #fff;
    border-bottom: 3px solid var(--zap-orange);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--zap-blue);
    text-decoration: none;
    flex-shrink: 0;
}

.logo span {
    color: var(--zap-orange);
}

/* --- שורת חיפוש ב-Header --- */
.header-search {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-form {
    display: flex;
    background: #f1f3f5;
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.search-form input {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 20px;
    outline: none;
    font-size: 15px;
}

.search-btn {
    background: var(--zap-blue);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    transition: 0.2s;
}

.search-btn:hover {
    background: #003a7a;
}

/* Dropdown הצעות (AJAX) */
.search-dropdown {
    position: absolute;
    top: 110%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 2000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.search-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.search-item:hover {
    background: #f1f8ff;
}

.search-item img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    margin-left: 15px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
}

.search-item .info {
    display: flex;
    flex-direction: column;
}

.search-item .name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.search-item .brand {
    font-size: 11px;
    color: var(--zap-orange);
}

/* --- תפריט ניווט ומשתמש --- */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-menu a {
    text-decoration: none;
    color: var(--zap-blue);
    font-weight: 600;
    font-size: 15px;
    transition: 0.2s;
}

.nav-menu a:hover {
    color: var(--zap-orange);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
    border-right: 1px solid #eee;
    padding-right: 20px;
}

.auth-btn {
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: bold;
    text-decoration: none;
    font-size: 13px;
}

.auth-btn.login {
    background: var(--zap-green);
    color: white;
}

/* =========================================
   3. Hero Section (דף הבית)
   ========================================= */
.hero-section {
    width: 100%;
    background: var(--zap-blue);
    color: white;
    padding: 60px 20px;
    text-align: center;
    margin: 0;
}

.hero-section h1 {
    font-size: 2.5em;
    margin: 0 0 10px 0;
}

/* =========================================
   4. גריד מוצרים (index, brand)
   ========================================= */
.product-grid, .grid, .brand-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 25px !important;
    margin-top: 20px;
}

.product-card {
    background: white;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* =========================================
   5. עמוד מוצר (product.php)
   ========================================= */
.page-layout {
    display: flex !important;
    flex-direction: row;
    gap: 30px !important;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
}

/* =========================================
   6. מרכז בקרה וטבלאות ניהול
   ========================================= */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.admin-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

/* =========================================
   7. פוטר רספונסיבי
   ========================================= */
.site-footer {
    background: var(--zap-dark);
    color: white;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

/* =========================================
   8. התאמות למובייל (Media Queries)
   ========================================= */

@media (max-width: 1024px) {
    .nav-menu {
        display: none; /* יופעל על ידי המבורגר */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        padding: 20px;
        border-top: 2px solid var(--zap-orange);
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    }
    
    .nav-menu.active {
        display: flex;
    }

    .user-section {
        border: none;
        padding: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
    }

    .header-search {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 10px;
    }

    .hero-section h1 {
        font-size: 1.8em;
    }

    .product-grid {
        grid-template-columns: 1fr !important;
    }

    /* !--- התיקון: מחריג את עמוד ההשוואה מהעיצוב הקורס ---! */
    .manage-table, .user-table, table:not(.compare-table) {
        display: block !important;
    }
    
    table:not(.compare-table) thead {
        display: none !important;
    }
    
    table:not(.compare-table) tr {
        display: block !important;
        margin-bottom: 20px !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        background: white !important;
        padding: 10px !important;
    }
    
    table:not(.compare-table) td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 5px !important;
        border-bottom: 1px dashed #eee !important;
    }
    
    table:not(.compare-table) td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--zap-blue);
    }
}

@media (max-width: 850px) {
    .page-layout {
        flex-direction: column !important;
    }
    .sidebar {
        width: 100% !important;
        order: -1;
    }
}

/* --- תיקון סופי לשורת החיפוש ב-Header --- */
.header-search {
    flex: 1;
    max-width: 500px;
    position: relative;
    margin: 0 20px;
}

.search-form {
    display: flex;
    flex-direction: row-reverse; 
    width: 100%;
    background: #f1f3f5;
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid #ddd;
    padding: 0; 
}

.search-form input {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 20px;
    outline: none;
    font-size: 15px;
    text-align: right; 
}

.search-btn {
    background: var(--zap-blue) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: none;
}

.search-btn:hover {
    background: #003a7a !important;
}

.search-form button:not(.search-btn) {
    display: none !important;
}

.menu-toggle {
    display: none; 
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--zap-blue);
    border-radius: 3px;
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: flex; 
    }

    .nav-menu {
        display: none; 
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        border-top: 2px solid var(--zap-orange);
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    }

    .nav-menu.active {
        display: flex; 
    }
}

/* --- תיקון אגרסיבי למפרט טכני במובייל --- */
@media (max-width: 768px) {
    table.specs-table {
        display: table !important;
        width: 100% !important;
    }
    
    table.specs-table tr {
        display: table-row !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        border-radius: 0 !important;
        background: transparent !important;
    }
    
    table.specs-table td {
        display: table-cell !important;
        text-align: right !important;
        padding: 10px !important;
        border: none !important;
        vertical-align: middle !important;
    }
    
    /* העלמת כותרות רפאים מהעיצוב הכללי */
    table.specs-table td::before {
        content: none !important;
        display: none !important;
    }
    
    /* עיצוב הצד הימני (שם המאפיין) */
    table.specs-table td:first-child {
        width: 40% !important;
        font-weight: bold !important;
        background-color: #f9fafb !important;
        color: var(--zap-blue) !important;
        border-left: 1px solid #eee !important;
    }
    
    /* עיצוב הצד השמאלי (הערך) */
    table.specs-table td:last-child {
        width: 60% !important;
    }
}