/* הגדרות גלובליות ורקעים - כחול בהיר וניגודיות */
body {
    font-family: Arial, sans-serif;
    background: #f0f8ff; /* רקע בהיר המתאים לכחול */
    margin: 0;
    padding: 0;
    direction: rtl;
    color: #333;
}

/* Header ו-Footer - רקע כחול כהה */
header, footer {
    background: #c0daf5; /* כחול כהה */
    color: #FFFFFF;
    text-align: center;
    padding: 1rem;
}

/* ------------------------------------------- */
/* עיצוב Header - סידור לוגו, ניווט וחיפוש (דסקטופ) */
/* ------------------------------------------- */

header {
    display: flex;
    justify-content: space-between; /* מרווח בין האלמנטים */
    align-items: center; /* ממורכז אנכית */
    padding: 1rem 2rem;
    flex-wrap: wrap; 
    position: sticky; 
    top: 0; 
    z-index: 1000;
    /* ודא שהוא בשורה בדסקטופ */
    flex-direction: row; 
}

/* קונטיינר עטיפה ללוגו והמבורגר - מוסתר בדסקטופ */
.header-top-row {
    display: none; 
}

/* לוגו - הגדרת גודל בסיס רספונסיבי */
#responsive-logo {
    max-width: 120px;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

#responsive-logo:hover {
    transform: scale(1.05);
}

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


/* ניווט - קישורים */
nav {
    display: flex;
    gap: 25px;
}

nav a {
    color: #3b392c;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, transform 0.3s ease;
    display: inline-block;
}

nav a:hover {
    color: #FFFFFF;
    background-color: #00509e;
    transform: scale(1.1);
}

/* ------------------------------------------- */
/* סרגל חיפוש - דסקטופ */
/* ------------------------------------------- */

.search-bar {
    display: flex;
    position: relative;
    width: 250px; /* רוחב קבוע בדסקטופ */
}

/* תיבת הקלט */
.search-bar input {
    padding: 8px 15px;
    padding-left: 45px; 
    width: 100%;
    border: 1px solid #00509e;
    border-radius: 20px;
    font-size: 14px;
    direction: rtl;
    box-sizing: border-box;
}

/* כפתור/אייקון החיפוש - ממוקם על הגבול השמאלי */
#search-button {
    position: absolute;
    left: 0; 
    top: 50%;
    transform: translateY(-50%);
    
    background: none;
    border: none;
    padding: 8px 10px;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease;
}

#search-button:hover {
    background: none;
    transform: translateY(-50%) scale(1.1);
}

#search-icon {
    width: 20px;
    height: 20px;
    display: block;
}

/* ------------------------------------------- */
/* עיצוב גריד וכרטיסי מוצר (דסקטופ) */
/* ------------------------------------------- */

#products-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px;
}

.product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15); 
    padding: 15px;
    text-align: center;
    border-top: 5px solid #00509e; 
}

.product-image-wrapper {
    height: 180px; 
    width: 100%; 
    overflow: hidden; 
    margin-bottom: 10px;
    position: relative; 
    border-radius: 8px;
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* שמירה על פרופורציות התמונה */
    object-position: center; 
    border-radius: 0; 
}

.product-card h3 {
    margin: 10px 0 5px;
    font-size: 18px;
    color: #00509e;
}

.product-card p {
    margin: 5px 0;
    font-size: 14px;
}

/* ------------------------------------------- */
/* עיצוב Footer - קישורים */
/* ------------------------------------------- */

footer a {
    color: #FFD700;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.3s ease-in-out;
    display: inline-block;
}

footer a:hover {
    color: #FFFFFF;
    transform: scale(1.05);
}

/* ------------------------------------------- */
/* כפתור המבורגר - מוסתר בדסקטופ */
/* ------------------------------------------- */

#hamburger-menu {
    display: none; 
    width: 30px;
    height: 30px;
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    z-index: 1001; 
}

#hamburger-menu span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #3b392c;
    border-radius: 3px;
    margin-bottom: 5px;
    transition: all 0.3s ease-in-out;
}

/* ------------------------------------------- */
/* רספונסיביות - מסכים קטנים (עד 768px) */
/* ------------------------------------------- */

@media (max-width: 768px) {
    
    /* הופך את ההאדר לעמודה במובייל */
    header {
        flex-direction: column; 
        align-items: center; 
        padding: 1rem;
    }

    /* מציג את קונטיינר הלוגו/המבורגר ומארגן אותם בשורה אחת */
    .header-top-row {
        display: flex; /* מציג את ה-div רק במובייל */
        justify-content: space-between;
        width: 100%;
        align-items: center;
        margin-bottom: 15px;
        order: 1; 
    }
    
    /* הופך את כפתור ההמבורגר לגלוי רק במובייל */
    #hamburger-menu {
        display: block;
    }

    /* הניווט הראשי */
    nav {
        order: 3; 
        flex-direction: column;
        background: #c0daf5;
        position: absolute;
        top: 100%;
        right: 0;
        width: 100%;
        max-height: 0; /* מוסתר כברירת מחדל */
        overflow: hidden;
        transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
        padding: 0;
        z-index: 999;
    }

    /* פתיחת התפריט ע"י קלאס JS */
    nav.open {
        max-height: 300px; 
        padding: 10px 0;
    }
    
    nav a {
        display: block;
        padding: 10px 20px;
        text-align: center;
        width: auto;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        color: #3b392c;
    }

    /* שינוי ההמבורגר למצב סגור X */
    #hamburger-menu.open span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    #hamburger-menu.open span:nth-child(2) {
        opacity: 0;
    }
    #hamburger-menu.open span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    /* סרגל החיפוש */
    .search-bar {
        order: 2; /* סרגל החיפוש מגיע שני */
        width: 100%; 
        padding: 0 10px; 
        box-sizing: border-box; 
        margin-bottom: 15px;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    /* רספונסיביות כרטיסי המוצר */
    #products-container {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    #responsive-logo {
        max-width: 100px;
    }
}