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

:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --dark: #34495e;
    --text: #2c3e50;
    --border: #bdc3c7;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text);
    background: var(--light);
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.controls {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--accent);
    color: white;
}

.btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

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

/* Panels */
.panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 8px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease-out;
}

.panel-hidden {
    transform: translateX(100%);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: white;
}

.panel-header h2 {
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.25rem 0.5rem;
}

/* Category Filters */
.category-filters {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Source Filters */
.source-filters {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 4px;
    background: var(--light);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-item:hover {
    background: #d5dbdb;
}

.filter-item input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

.filter-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
    width: 2rem;
}

.filter-label {
    flex: 1;
    cursor: pointer;
}

/* Places List */
.places-list {
    padding: 0;
}

.place-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.place-item:hover {
    background: var(--light);
}

.place-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.place-item-icon {
    font-size: 1.3rem;
}

.place-item-name {
    font-weight: 600;
    flex: 1;
}

.place-category {
    font-size: 0.75rem;
    background: var(--accent);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.place-item-desc {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}

.source-label {
    font-size: 0.75rem;
    color: #95a5a6;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Detail Panel */
.detail-panel {
    position: fixed;
    background: white;
    z-index: 1500;
    overflow-y: auto;
    transition: transform 0.3s ease-out;
    box-shadow: -4px 0 16px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
}

.detail-panel-hidden {
    pointer-events: none;
}

/* Desktop: Side panel */
@media (min-width: 769px) {
    .detail-panel {
        right: 0;
        top: 0;
        height: 100vh;
        width: 400px;
        transform: translateX(100%);
    }

    .detail-panel:not(.detail-panel-hidden) {
        transform: translateX(0);
        pointer-events: auto;
    }

    .drag-handle {
        display: none;
    }
}

/* Mobile: Bottom sheet */
@media (max-width: 768px) {
    .detail-panel {
        left: 0;
        right: 0;
        bottom: 0;
        height: 55vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .detail-panel:not(.detail-panel-hidden) {
        transform: translateY(0);
        pointer-events: auto;
    }

    .drag-handle {
        height: 4px;
        width: 40px;
        background: #ccc;
        border-radius: 2px;
        margin: 12px auto;
        display: block;
    }
}

.detail-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: white;
}

.detail-panel-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.detail-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.25rem 0.5rem;
}

.detail-close:hover {
    color: var(--accent);
}

.detail-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-top: 1rem;
}

.detail-icon {
    font-size: 2rem;
}

.detail-title {
    flex: 1;
}

.detail-name {
    font-size: 1.3rem;
    font-weight: 600;
}

.detail-category {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.detail-section {
    margin: 1.5rem 0;
}

.detail-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.detail-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text);
}

.detail-link {
    color: var(--accent);
    text-decoration: none;
}

.detail-link:hover {
    text-decoration: underline;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-direction: column;
}

.action-btn {
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

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

.action-btn-primary:hover {
    background: #2980b9;
}

.action-btn-secondary {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

.action-btn-secondary:hover {
    background: #d5dbdb;
}

/* Leaflet customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.leaflet-popup-tip {
    background: white;
}

.popup-content {
    padding: 0.5rem 0;
}

.popup-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.popup-btn {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.6rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.popup-btn:hover {
    background: #2980b9;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.2rem;
    }

    .panel {
        max-width: 100%;
    }
}

/* Utility classes */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}
