:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-sans: 'Inter', sans-serif;
    --radius: 12px;
}

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

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    overflow: hidden;
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.header-glass {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    /* Assuming shadow-sm was a typo and should be shadow-lg */
    /* margin-bottom: 16px; This property is not suitable for an absolutely positioned element */
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    /* Assuming --border-color is defined elsewhere or will be added */
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s;
}

.lang-btn:hover {
    background: #f1f5f9;
}

.file-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    /* Assuming --border-color is defined elsewhere or will be added */
    border-radius: 8px;
    background: #f8fafc;
}

.popup-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
    max-height: 150px;
    object-fit: cover;
}

.photo-preview {
    margin-top: 10px;
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    border-radius: 8px;
}

.photo-preview.hidden {
    display: none;
}

.preview-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.header-glass h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
}

.fab-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: all 0.2s ease;
    z-index: 1000;
}

.locate-btn {
    bottom: 100px;
    /* Positioned above the add button */
    background: white;
    color: var(--text-color);
}

.locate-btn:hover {
    background: #f8fafc;
    transform: scale(1.05);
}

.fab-btn:hover {
    transform: scale(1.05);
    background-color: var(--primary-hover);
}

.locate-btn:hover {
    background-color: #f1f5f9;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-glass {
    background: white;
    width: 90%;
    max-width: 400px;
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-glass {
    transform: translateY(20px);
}

.modal-glass h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #0f172a;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
    font-size: 0.95rem;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Search Bar */
.search-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    z-index: 1000;
    pointer-events: auto;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 48px 12px 20px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 1rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    background: white;
    transform: scale(1.02);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: rgba(37, 99, 235, 0.1);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 1001;
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestions.hidden {
    display: none;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

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

.marker-pin {
    width: 40px;
    height: 40px;
    border-radius: 50% 50% 50% 0;
    background: #2563eb;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -20px 0 0 -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
    transition: transform 0.2s ease;
}

.marker-pin.red-pin {
    background: #dc2626;
    /* Bloody Red */
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

.marker-pin svg {
    transform: rotate(45deg);
    /* Counteract parent rotation */
    color: white;
    width: 20px;
    height: 20px;
}

.custom-marker:hover .marker-pin {
    transform: rotate(-45deg) scale(1.1);
    z-index: 1000;
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    padding: 16px;
    min-width: 200px;
}

.popup-content h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 600;
}

.popup-content p {
    margin: 0 0 8px;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.4;
}

.popup-content small {
    display: block;
    color: #94a3b8;
    font-size: 0.75rem;
}

/* Filter Controls */
.filter-controls {
    position: absolute;
    top: 100px;
    /* Moved down to accommodate search bar */
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding-right: 10px;
    /* Space for scrollbar */
    z-index: 1000;
}

.filter-chip {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-chip:hover {
    background: white;
    transform: translateX(2px);
}

.filter-chip.active {
    background: #1e293b;
    color: white;
}

.filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .filter-controls {
        display: none;
    }

    .header-glass {
        display: none;
        /* Optional: hide title on mobile to save space, or make it smaller */
    }

    .search-container {
        width: 95%;
        top: 10px;
    }
}