* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="ltr"] {
    text-align: left;
}

header {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

header h1 {
    margin: 0;
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-logo {
    height: 3rem;
    width: auto;
    max-width: 3rem;
    object-fit: contain;
    border-radius: 4px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    display: inline-block;
    vertical-align: middle;
    /* Ensure image loads properly */
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
}

/* Responsive logo sizing */
@media (max-width: 768px) {
    .site-logo {
        height: 2.4rem;
        max-width: 2.4rem;
    }
    
    header h1 {
        font-size: 1.5rem;
        gap: 0.5rem;
    }
}

.language-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.72rem;
    font-weight: bold;
}

.language-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.mode-switcher {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
    background: white;
    color: #2E7D32;
    border-color: white;
}

main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.view-container {
    display: none;
}

.view-container.active {
    display: block;
}

/* List View Styles */
.search-bar {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.filter-open-btn {
    background: #2196F3; /* Blue for "show only open" state */
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 0 0 33.33%; /* Takes exactly 1/3 of the width */
    font-weight: 500;
}

.filter-open-btn:hover {
    background: #1976D2;
}

.filter-open-btn.active {
    background: #FF9800; /* Orange for "show all" state when filtering is active */
    color: white;
}

.filter-open-btn.active:hover {
    background: #F57C00;
}

.button-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#searchInput {
    flex: 1; /* Takes remaining space (2/3) */
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: #4CAF50;
}

.toggle-all-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    flex: 2; /* Takes 2/3 of the width */
}

.toggle-all-btn:hover {
    background: #1976D2;
}

/* Contact button in button row */
.button-row .contact-btn {
    background: #FF9800;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    flex: 1; /* Takes 1/3 of the width */
}

.button-row .contact-btn:hover {
    background: #F57C00;
}

.places-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem; /* tighter spacing between region groups */
}

/* Region Group Styles */
.region-group {
    margin: 0; /* remove extra margin - gap now controls spacing */
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 2px solid #E8F5E8;
}

.region-header {
    background: linear-gradient(135deg, #2E7D32, #388E3C);
    color: white;
    padding: 0.9rem 1.4rem; /* tighter vertical padding */
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer; /* entire header clickable */
}

.region-title {
    flex: 1;
}

.region-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 1.3rem;
    font-weight: bold;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.region-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.region-cities {
    padding: 0;
    background: #F8F9FA;
}

.region-group.collapsed .region-cities {
    display: none;
}

.region-group.expanded .region-cities {
    display: block;
}

/* City Group Styles (updated for regional hierarchy) */
.region-cities .city-group {
    margin: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.city-group {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.city-header {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 1rem 1.5rem;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer; /* entire header clickable */
}

/* Focus outline for keyboard accessibility */
.region-header:focus, .city-header:focus {
    outline: 3px solid #FFEB3B;
    outline-offset: 2px;
}

.city-title {
    flex: 1;
}

.city-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 1.2rem;
    font-weight: bold;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.city-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.toggle-icon {
    line-height: 1;
}

[dir="rtl"] .city-header {
    text-align: right;
}

[dir="ltr"] .city-header {
    text-align: left;
}

.city-places {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    padding: 1.5rem;
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Expand/Collapse States */
.city-group.expanded .city-places {
    max-height: none;
    opacity: 1;
    padding: 1.5rem;
}

.city-group.collapsed .city-places {
    max-height: 0;
    opacity: 0;
    padding: 0 1.5rem;
}

.place-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* enable absolute positioning for hours */
}

.place-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: white;
}

.place-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2E7D32;
    margin-bottom: 0.5rem;
}

.place-address {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.place-street {
    margin-bottom: 0.2rem;
}

.place-city {
    color: #888;
    font-size: 0.9em;
}

.place-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* RTL layout for Hebrew */
[dir="rtl"] .place-bottom {
    flex-direction: row;
}

[dir="ltr"] .place-bottom {
    flex-direction: row;
}

.place-link {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.place-link:hover {
    background: #45a049;
}

/* Opening hours badge */
.place-hours {
    position: absolute;
    top: 1.65rem; /* slight additional downward adjustment for visual baseline alignment */
    font-size: 0.7rem;
    background: linear-gradient(135deg,#FF9800,#F57C00);
    color: #fff;
    padding: 0.25rem 0.55rem; /* slightly tighter vertical padding after shift */
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    opacity: 0.95;
    pointer-events: none;
    max-width: 165px;
    line-height: 1.15;
    white-space: normal;
    /* Allow full height for all schedule lines */
    max-height: none;
    overflow: visible;
}
[dir="rtl"] .place-hours, [dir="ltr"] .place-hours {
    display: inline-block;
}

.place-hours .ph-day { font-weight:700; display:inline-block; min-width:1.8em; text-align:right; }
.place-hours .ph-time { display:inline-block; direction:ltr; text-align:left; font-weight:500; }
.place-hours .ph-closed { opacity:0.85; }

/* Force each group line to behave like its own row */
.place-hours br { content:""; }
[dir="rtl"] .place-hours { left: 0.9rem; }
[dir="ltr"] .place-hours { right: 0.9rem; }

.place-card:hover .place-hours { opacity: 1; }

/* Open / Closed status */
.open-status { 
    font-size: 0.72rem; 
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    gap: 0.4rem; 
}
.open-status .dot { 
    width: 8px; 
    height: 8px; 
    border-radius: 50%; 
    display: inline-block; 
}
.open-status.open { 
    color: #1B5E20; 
}
.open-status.open .dot { 
    background: #2E7D32; 
    box-shadow: 0 0 4px rgba(46,125,50,0.6); 
}
.open-status.closed { 
    color: #B71C1C; 
    opacity: 0.9; 
}
.open-status.closed .dot { 
    background: #D32F2F; 
    box-shadow: 0 0 4px rgba(211,47,47,0.5); 
}
[dir="rtl"] .open-status { 
    justify-content: flex-start; 
}
[dir="ltr"] .open-status { 
    justify-content: flex-start; 
}

/* Language-specific text alignment */
[dir="rtl"] .place-card {
    text-align: right;
}

[dir="ltr"] .place-card {
    text-align: left;
}

/* RTL support for search container */
[dir="rtl"] .search-container {
    flex-direction: row-reverse;
}

[dir="ltr"] .search-container {
    flex-direction: row;
}

/* Map View Styles */
#map {
    width: 100%;
    height: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Map wrapper */
.map-wrapper {
    position: relative;
}

/* Custom vegan pin - Waze style */
.custom-vegan-pin { background: none; border: none; }
.custom-vegan-pin .pin-shell {
    width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    background: linear-gradient(135deg, #34a853 0%, #137333 100%);
    border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    display:flex; align-items:center; justify-content:center; transition: transform .2s;
}
.custom-vegan-pin .pin-shell:hover { transform: rotate(-45deg) scale(1.15); }
.custom-vegan-pin .pin-emoji { transform: rotate(45deg); font-size: 13px; }

/* Waze-style zoom controls */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-zoom a {
    background: #ffffff !important;
    color: #4285f4 !important;
    border: none !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
    font-size: 18px !important;
    font-weight: bold !important;
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    margin: 2px !important;
}

.leaflet-control-zoom a:hover {
    background: #f8f9fa !important;
    color: #1a73e8 !important;
}

/* Waze-style popups */
.leaflet-popup-content-wrapper {
    background: #ffffff !important;
    color: #202124 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 16px !important;
    line-height: 1.5 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.leaflet-popup-content h3 {
    color: #1a73e8 !important;
    margin: 0 0 8px 0 !important;
    font-weight: 600 !important;
    font-size: 16px !important;
}

.leaflet-popup-content p {
    color: #5f6368 !important;
    margin: 0 0 8px 0 !important;
    font-size: 14px !important;
}

.leaflet-popup-content a {
    color: #34a853 !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    font-size: 14px !important;
}

.leaflet-popup-content a:hover {
    color: #137333 !important;
    text-decoration: underline !important;
}

.leaflet-popup-tip {
    background: #ffffff !important;
    border: none !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-popup-close-button {
    color: #5f6368 !important;
    font-size: 24px !important;
    font-weight: normal !important;
    width: 24px !important;
    height: 24px !important;
    line-height: 24px !important;
}

.leaflet-popup-close-button:hover {
    color: #202124 !important;
    background: #f8f9fa !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .mode-switcher {
        flex-direction: column;
    }
    
    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        flex-direction: row; /* Keep side by side on mobile */
        gap: 0.5rem;
    }
    
    .filter-open-btn {
        flex: 0 0 40%; /* Take 40% width on mobile for better tap target */
        font-size: 0.85rem;
        padding: 0.7rem 0.5rem;
        white-space: nowrap;
    }
    
    #searchInput {
        flex: 1; /* Take remaining 60% */
        font-size: 0.9rem;
    }
    
    [dir="rtl"] .search-container,
    [dir="ltr"] .search-container {
        flex-direction: row; /* Keep row direction for both RTL and LTR on mobile */
    }
    
    [dir="rtl"] .search-container {
        flex-direction: row-reverse; /* Maintain RTL order on mobile */
    }

    .button-row {
        flex-direction: row; /* Keep buttons on same line */
        gap: 0.5rem;
    }
    
    .toggle-all-btn,
    .button-row .contact-btn {
        /* Keep the flex ratios on mobile too */
        font-size: 0.8rem; /* Slightly smaller text on mobile */
        padding: 0.6rem 1rem; /* Slightly smaller padding */
    }
    
    #searchInput {
        min-width: auto;
    }
    
    .city-places {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .city-group.expanded .city-places {
        padding: 1rem;
    }
    
    .city-header {
        font-size: 1.1rem;
        padding: 0.75rem 1rem;
    }
    
    .city-toggle-btn {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
    
    /* Apply same tight spacing on mobile */
    .places-list {
        gap: 0.65rem; /* same as desktop */
    }
    
    .region-group {
        margin: 0; /* same as desktop */
    }
    
    .region-header {
        padding: 0.9rem 1.4rem; /* same as desktop */
        font-size: 1.45rem;
    }
    
    /* Default mobile map height smaller, will expand in map-focused mode */
    #map {
        height: 55vh; /* relative height for mixed content */
        min-height: 320px;
    }
    /* When map is the active view, stretch it further */
    body.map-mode-active #map {
        height: calc(100dvh - 140px); /* subtract approx header + margin */
        min-height: 60vh;
    }
    /* Remove border radius in full height for edge-to-edge feel */
    body.map-mode-active #map {
        border-radius: 0;
        box-shadow: none;
    }
    body.map-mode-active .map-wrapper {
        margin: 0 -1rem; /* allow edge to edge on small screens */
    }
}

/* Loading state */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.error {
    text-align: center;
    padding: 2rem;
    color: #d32f2f;
    background: #ffebee;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Contact Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 2rem;
}

.email-contact-btn {
    background: #FF9800;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 1rem;
    width: 100%;
}

.email-contact-btn:hover {
    background: #F57C00;
}

.form-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.form-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.form-divider span {
    background: white;
    padding: 0 1rem;
    color: #666;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4CAF50;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.submit-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex: 1;
}

.submit-btn:hover {
    background: #45a049;
}

.cancel-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex: 1;
}

.cancel-btn:hover {
    background: #5a6268;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* Footer Styles */
footer {
    margin-top: 3rem;
    padding: 2rem;
    background: #f5f7fa;
    border-top: 1px solid #e9ecef;
}

.contact-section {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.contact-btn {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
    line-height: 1.4;
}

.contact-btn:hover {
    background: linear-gradient(135deg, #F57C00, #E65100);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

[dir="rtl"] .contact-btn {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Subscription Section */
.subscription-section {
    margin-top: 1.5rem;
    text-align: center;
}

.subscribe-btn {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    color: #fff;
    border: none;
    padding: 0.9rem 1.8rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
    line-height: 1.4;
}

.subscribe-btn:hover {
    background: linear-gradient(135deg, #1B5E20, #0d3a12);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

@media (max-width: 768px) {
    .subscribe-btn { font-size: 0.9rem; padding: 0.8rem 1.4rem; }
}