* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #ff8c00;
    --background-color: #f8f9fa;
    --text-color: #333;
    --border-color: #ddd;
    --sidebar-width: 400px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Мобильное меню */
.mobile-menu {
    display: none;
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-title {
    font-size: 1.2rem;
    margin-left: 1rem;
}

/* Основной контейнер */
.container {
    display: flex;
    height: 100vh;
    padding-top: 0;
}

/* Боковая панель */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-color), #1e3a8a);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Секции */
.search-section,
.filters-section,
.results-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Поиск */
.search-box {
    display: flex;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    overflow: hidden;
}

.search-box i {
    padding: 1rem;
    background: #f8f9fa;
    color: #666;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 1rem;
    font-size: 1rem;
    outline: none;
}

.search-box button {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #e67e00;
}

/* Фильтры */
.filter-row {
    display: flex;
    gap: 0.5rem;
}

.filter-row select {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #545b62;
}

/* Результаты */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.results-header h3 {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#resultsCount {
    background: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.results-list {
    flex: 1;
    overflow-y: auto;
    max-height: 50vh;
}

.welcome-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.welcome-message h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* Элементы организаций */
.org-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.org-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.org-item.active {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.org-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.org-address {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.org-rubrics {
    color: #888;
    font-size: 0.8rem;
}

.rubric-tag {
    background: #e9ecef;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

/* Карта */
.map-section {
    flex: 1;
    position: relative;
    background: #e9ecef;
}

#map {
    width: 100%;
    height: 100%;
}

.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.map-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s;
    font-size: 1rem;
}

.map-btn:hover {
    background: #f8f9fa;
    border-color: #999;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-header {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 1.5rem;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
}

/* Состояния загрузки */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.error {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
    background: #fdf2f2;
    border-radius: 6px;
    margin: 1rem;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .mobile-menu {
        display: flex;
        align-items: center;
    }
    
    .container {
        flex-direction: column;
        height: 100vh;
        padding-top: 60px;
    }
    
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        z-index: 999;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .map-section {
        height: 100%;
    }
    
    .results-list {
        max-height: 40vh;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box input {
        border-radius: 0;
    }
    
    .search-box button {
        border-radius: 0 0 6px 6px;
    }
    
    .filter-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .sidebar-header {
        padding: 1.5rem 1rem;
    }
    
    .sidebar-header h1 {
        font-size: 1.3rem;
    }
    
    .search-section,
    .filters-section,
    .results-section {
        padding: 1rem;
    }
    
    .map-controls {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .map-btn {
        width: 40px;
        height: 40px;
    }
}

/* Стили для попапов Leaflet */
.leaflet-popup-content {
    margin: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.leaflet-popup-content h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.leaflet-popup-content p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: #666;
}

.leaflet-popup-content .popup-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.leaflet-popup-content .popup-btn:hover {
    background: #e67e00;
}