/* Dark Theme Base */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-sidebar: #0f3460;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent-city: #00b4d8;
    --accent-country: #f4845f;
    --border-color: #2a2a4a;
}

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

    body {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        background-color: var(--bg-primary);
        color: var(--text-primary);
        height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: auto; /* Changed from 'hidden' to 'auto' */
    }

/* Header */
header {
    background-color: var(--bg-secondary);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

#mug-count {
    font-size: 1rem;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

#mug-count #count {
    font-weight: bold;
    color: var(--accent-city);
}

/* Main Container */
.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    padding: 1.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

#sidebar h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

#mug-list {
    list-style: none;
}

#mug-list li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    position: relative;
}

#mug-list li:hover {
    background-color: var(--bg-primary);
    transform: translateX(4px);
}

#mug-list li.city-mug {
    border-left-color: var(--accent-city);
}

#mug-list li.country-mug {
    border-left-color: var(--accent-country);
}

.mug-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.mug-location {
    font-weight: 600;
    font-size: 1rem;
}

.mug-type {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.mug-type.city {
    background-color: var(--accent-city);
    color: #000;
}

.mug-type.country {
    background-color: var(--accent-country);
    color: #000;
}

.mug-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Delete button in sidebar */
.delete-mug-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #e63946;
    color: white;
    border: none;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
}

.delete-mug-btn:hover {
    background: #c1121f;
}

/* Map */
#map {
    flex: 1;
    z-index: 1;
}

/* Custom Marker Styles */
.city-marker {
    background-color: var(--accent-city);
    border-radius: 50%;
    border: 2px solid #fff;
    width: 16px;
    height: 16px;
}

.country-marker {
    background-color: var(--accent-country);
    border-radius: 4px;
    border: 2px solid #fff;
    width: 16px;
    height: 16px;
    transform: rotate(45deg);
}

/* Leaflet Popup Dark Theme */
.leaflet-popup-content-wrapper {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-tip {
    background-color: var(--bg-secondary) !important;
}

.leaflet-popup-content {
    font-size: 0.9rem;
    line-height: 1.5;
}

.leaflet-popup-content strong {
    color: var(--accent-city);
}

.popup-location {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.popup-notes {
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.popup-notes img {
    max-width: 100%;
    margin-top: 0.5rem;
    border-radius: 4px;
}

/* Add Mug Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

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

.modal {
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.modal form {
    display: grid;
    gap: 1rem;
}

.modal label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal input,
.modal select,
.modal textarea {
    width: 100%;
    padding: 0.5rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.modal textarea {
    resize: vertical;
    min-height: 60px;
}

.modal button {
    padding: 0.5rem 1rem;
    background-color: var(--accent-city);
    border: none;
    border-radius: 4px;
    color: #000;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}

.modal button:hover {
    background-color: #0096c7;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.back-to-map-btn {
    margin-top: 8px;
    padding: 4px 8px;
    background: var(--accent-city);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
}

.back-to-map-btn:hover {
    background: #0096c7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: 35vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    #map {
        height: 65vh;
    }

    header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    header h1 {
        font-size: 1.2rem;
    }
}