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

html, body {
    height: 100%;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f5f7fa;
    color: #2c3e50;
}

body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============= HEADER ============= */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    height: 56px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.header__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.header__filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.header__filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* ============= MAP CONTAINER ============= */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
}

.map {
    width: 100%;
    height: 100%;
    flex: 1;
}

.map.selecting-mode {
    cursor: crosshair !important;
}

.selection-status {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 50;
    white-space: nowrap;
}

/* ============= ADD MARKER BUTTON ============= */
.add-marker-btn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.add-marker-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

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

.add-marker-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.add-marker-btn.disabled:hover {
    transform: scale(1);
}

/* ============= SIDEBAR ============= */
.sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    width: 280px;
    height: calc(100vh - 56px);
    background: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

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

.sidebar__overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 150;
}

.sidebar__overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar__title {
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.sidebar__close:hover {
    background: #f0f0f0;
    color: #2c3e50;
}

.sidebar__content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar__footer {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

.filter-item__checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.filter-item__label {
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
}

/* ============= MODAL ============= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    align-items: flex-end;
}

.modal.active {
    display: flex;
}

.modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal__content {
    position: relative;
    background: white;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.1);
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
}

.modal__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal__close:hover {
    background: #f0f0f0;
}

.modal__form {
    padding: 20px;
}

.modal__actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ============= FORM ============= */
.form-group {
    margin-bottom: 20px;
}

.form-group__label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 0.95rem;
}

.form-group__select,
.form-group__textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    color: #2c3e50;
    background: white;
    transition: all 0.2s ease;
}

.form-group__select:focus,
.form-group__textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group__textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group__counter {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 6px;
    text-align: right;
}

.lifetime-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.lifetime-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lifetime-option:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.lifetime-option__input {
    cursor: pointer;
    accent-color: #667eea;
}

.lifetime-option__label {
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
}

/* ============= BUTTONS ============= */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: inline-block;
    width: 100%;
}

.btn--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn--secondary {
    background: #f0f0f0;
    color: #2c3e50;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============= TOAST ============= */
.toast-container {
    position: fixed;
    top: 72px;
    left: 16px;
    right: 16px;
    z-index: 400;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: white;
    color: #2c3e50;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    border-left: 4px solid #667eea;
}

.toast.success {
    border-left-color: #50c878;
}

.toast.error {
    border-left-color: #e74c3c;
}

.toast.warning {
    border-left-color: #f39c12;
}

.toast__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast__message {
    flex: 1;
    font-size: 0.95rem;
}

/* ============= ANIMATIONS ============= */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============= LEAFLET CUSTOMIZATION ============= */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: none;
}

.leaflet-popup-content {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

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

.marker-popup {
    font-size: 0.9rem;
    line-height: 1.4;
}

.marker-popup__header {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}

.marker-popup__description {
    margin-bottom: 12px;
    color: #7f8c8d;
}

.marker-popup__info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.marker-popup__info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.marker-popup__info-label {
    color: #7f8c8d;
    font-weight: 500;
    font-size: 0.85rem;
}

.marker-popup__info-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.marker-popup__actions {
    display: flex;
    gap: 6px;
    flex-direction: column;
}

.marker-popup__btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.marker-popup__btn--join {
    background: #667eea;
    color: white;
}

.marker-popup__btn--join:hover {
    background: #5568d3;
}

.marker-popup__btn--leave {
    background: #e74c3c;
    color: white;
}

.marker-popup__btn--leave:hover {
    background: #c0392b;
}

/* ============= RESPONSIVE ============= */
@media (min-width: 768px) {
    .header__title {
        font-size: 1.5rem;
    }

    .add-marker-btn {
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
    }

    .modal__content {
        width: 90%;
        max-width: 500px;
        border-radius: 12px;
        margin: auto;
    }

    .modal {
        align-items: center;
        justify-content: center;
    }

    .lifetime-options {
        grid-template-columns: repeat(4, 1fr);
    }

    .toast-container {
        left: auto;
        right: 24px;
        width: auto;
        max-width: 400px;
    }
}

/* ============= UTILITIES ============= */
.leaflet-container a.leaflet-popup-close-button {
    color: #7f8c8d;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: #2c3e50;
}