body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    /* allows scrolling for long list */
    display: flex;
    flex-direction: column;
}

#map {
    width: 100%;
    height: 100%;
}

.map-title-overlay {
    position: absolute;
    top: 10px;
    right: 50px;
    /* Offset from zoom controls */
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    pointer-events: none;
    /* Let clicks pass through if needed, though title blocks view */
}

h1 {
    color: #2c3e50;
    margin-top: 0;
    font-size: 1.5rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

#filters {
    margin-top: 20px;
}

h3 {
    color: #555;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-container {
    display: flex;
    gap: 5px;
    margin: 10px 0;
}

#search-input {
    flex-grow: 1;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

#search-btn {
    padding: 8px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#search-btn:hover {
    background-color: #2980b9;
}

.filter-controls button {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #475569;
    transition: all 0.2s;
}

.filter-controls button:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

/* New Accordion Styles */
.general-category {
    margin-top: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.general-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    padding: 5px 0;
    user-select: none;
}

.general-header:hover {
    color: #3b82f6;
}

.general-checkbox {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.subcategory-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.subcategory-list.open {
    max-height: 2000px;
    /* Large max-height for animation */
    overflow: visible;
}

.toggle-icon {
    font-size: 0.8rem;
    color: #999;
    transform: rotate(0deg);
    transition: transform 0.3s;
}

.filter-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #444;
    transition: color 0.2s;
    margin-left: 28px;
    /* Indent sub-items */
}

.filter-item:hover {
    color: #000;
}

.filter-item input {
    margin-right: 10px;
    width: 14px;
    height: 14px;
    accent-color: #3b82f6;
}

/* Add Business Button */
.add-business-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.add-business-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Data Buttons Container */
.data-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.export-btn,
.import-btn {
    flex: 1;
    padding: 8px 12px;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.export-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

.import-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

.import-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-1px);
}

/* Edit Mode Button */
.edit-mode-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.edit-mode-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.edit-mode-btn.active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    }

    50% {
        box-shadow: 0 4px 20px rgba(245, 158, 11, 0.6);
    }
}

/* Edit Mode Banner */
.edit-mode-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-weight: 600;
    z-index: 3000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Custom Marker Styles */
.custom-marker {
    background: transparent !important;
    border: none !important;
}

.leaflet-marker-icon.custom-marker {
    cursor: grab;
}

.leaflet-marker-draggable .custom-marker {
    cursor: grabbing;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: #ef4444;
}

/* Form Styles */
#add-business-form {
    padding: 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.location-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
}

#selected-coords {
    flex-grow: 1;
    color: #6b7280;
    font-size: 0.9rem;
}

#selected-coords.has-coords {
    color: #10b981;
    font-weight: 500;
}

.pick-location-btn {
    padding: 8px 14px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.pick-location-btn:hover {
    background: #2563eb;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-secondary {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Location Picking Mode */
body.picking-location #map {
    cursor: crosshair !important;
}

body.picking-location .leaflet-container {
    cursor: crosshair !important;
}

.picking-mode-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    z-index: 3000;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    }

    50% {
        box-shadow: 0 4px 30px rgba(59, 130, 246, 0.6);
    }
}

/* ==========================================
   MOBILE RESPONSIVE STYLES
   ========================================== */

/* Mobile hamburger button - hidden on desktop */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 9999;
    /* Boosted z-index for iOS safety */
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    -webkit-appearance: none;
    /* iOS fix */
    -moz-appearance: none;
    appearance: none;
    align-items: center;
    /* Flex centering fix */
    justify-content: center;
}

.mobile-menu-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: scale(1.05);
}

/* Close button inside sidebar - hidden on desktop */
.close-sidebar-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1002;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
    -webkit-tap-highlight-color: transparent;
}

.close-sidebar-btn:hover,
.close-sidebar-btn:active {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: scale(1.05);
}

/* Overlay behind sidebar - hidden by default */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    /* Show hamburger button on mobile */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Close button on mobile - hidden by default, visible only when sidebar open */
    .close-sidebar-btn {
        display: none;
    }

    .sidebar.open .close-sidebar-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 1100;
    }

    /* Sidebar as slide-out drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        padding-top: 60px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Map takes full screen */
    #map-container {
        width: 100%;
        height: 100vh;
    }

    /* Adjust title overlay */
    .map-title-overlay {
        top: 15px;
        right: 15px;
        left: 75px;
        font-size: 0.95rem;
        padding: 8px 12px;
        text-align: center;
    }

    /* Adjust buttons inside sidebar */
    .add-business-btn,
    .edit-mode-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .data-buttons {
        flex-direction: column;
        gap: 6px;
    }

    /* Smaller filter text */
    .filter-item {
        font-size: 0.85rem;
        margin-left: 20px;
    }

    .general-header {
        font-size: 0.95rem;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        margin: 10px;
    }

    .modal-header {
        padding: 15px 20px;
    }

    #add-business-form {
        padding: 16px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .location-picker {
        flex-direction: column;
        align-items: stretch;
    }

    .pick-location-btn {
        width: 100%;
        text-align: center;
    }

    /* Edit mode banner adjustment */
    .edit-mode-banner {
        padding: 10px 15px;
        font-size: 0.9rem;
        padding-left: 70px;
        /* Space for hamburger */
    }

    /* Picking mode banner */
    .picking-mode-banner {
        top: 75px;
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}