* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    padding: 10px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

.tab-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--tg-theme-bg-color, #ffffff);
    border-top: 1px solid var(--tg-theme-hint-color, #cccccc);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-button {
    flex: 1;
    padding: 18px 5px;
    background: none;
    border: none;
    color: var(--tg-theme-hint-color, #999999);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: var(--tg-theme-button-color, #2481cc);
    font-weight: 500;
}

.tab-content {
    display: none;
    padding: 20px 0;
}

.tab-content.active {
    display: block;
}

.filter-card {
    background: var(--tg-theme-secondary-bg-color, #f8f8f8);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.filter-card:hover {
    transform: translateY(-2px);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.filter-activate-btn {
    display: none;
}

.filter-active-radio {
    width: 18px;
    height: 18px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid var(--tg-theme-hint-color, #bbbbbb);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    background: var(--tg-theme-bg-color, #ffffff);
}
.filter-active-radio:checked {
    border-color: #22c55e;
}
.filter-active-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.filter-active-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
    color: var(--tg-theme-hint-color, #666666);
    font-size: 12px;
    white-space: nowrap;
}

.filter-active-dot { display: none; }

.add-filter-footer {
    position: sticky;
    bottom: calc(70px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: center;
    padding: 10px 0 0 0;
    background: linear-gradient(to top, var(--tg-theme-bg-color, #ffffff), rgba(255,255,255,0));
    z-index: 900;
}

.add-filter-button {
    width: 100%;
    border-radius: 12px;
    border: none;
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #ffffff);
    font-size: 16px;
    line-height: 1.2;
    padding: 14px 16px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-title {
    font-weight: 600;
    font-size: 18px;
}

.filter-preview {
    color: var(--tg-theme-hint-color, #666666);
    font-size: 14px;
}

/* Selected locations chips on edit page */
.chip-list{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.chip{ display:inline-flex; gap:6px; align-items:center; padding:6px 10px; border-radius:14px; background: var(--tg-theme-secondary-bg-color, rgba(0,0,0,0.06)); border:1px solid var(--tg-theme-hint-color, rgba(0,0,0,0.08)); font-size:13px; color: var(--tg-theme-text-color, #000000); line-height:1; }
.chip-remove{ display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:50%; border:0; background:transparent; cursor:pointer; padding:0; font-weight:700; color:#ef4444; line-height:1; font-size:14px; }
.chip-remove:hover{ background: rgba(239,68,68,0.12); color:#b91c1c; }

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--tg-theme-bg-color, #ffffff);
    margin: 20px;
    padding: 25px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.range-group {
    margin-bottom: 25px;
}

.range-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.range-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--tg-theme-hint-color, #dddddd);
    border-radius: 8px;
    background: var(--tg-theme-secondary-bg-color, #f8f8f8);
    color: var(--tg-theme-text-color, #000000);
    margin-bottom: 10px;
}

.accordion {
    border: 1px solid var(--tg-theme-hint-color, #dddddd);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    padding: 15px;
    background: var(--tg-theme-secondary-bg-color, #f8f8f8);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.accordion-content {
    display: none;
    padding: 15px;
    background: var(--tg-theme-bg-color, #ffffff);
    border-top: 1px solid var(--tg-theme-hint-color, #eeeeee);
}

.accordion-content.active {
    display: block;
}

.checkbox-group {
    margin: 10px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-label.nested {
    margin-left: 20px;
    color: var(--tg-theme-hint-color, #666666);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.modal-actions .btn{ min-height: 44px; }

.btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #ffffff);
}

.btn-secondary {
    background: var(--tg-theme-secondary-bg-color, #f8f8f8);
    color: var(--tg-theme-text-color, #000000);
}

.btn-danger {
    background: #ef4444;
    color: #ffffff;
}
.btn-danger:hover {
    background: #dc2626;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--tg-theme-hint-color, #666666);
}

.welcome-section {
    text-align: center;
    padding: 30px 20px;
}

.welcome-title {
    font-size: 24px;
    margin-bottom: 10px;
}

/* Fade-in helper */
.fade-in{ opacity:0; transition: opacity .25s ease; }
.fade-in.show{ opacity:1; }

/* Page fade navigation */
body.fade-page{ transition: opacity .25s ease; opacity: 1; }
body.fade-page.hide{ opacity: 0; }

/* Location selector (panel) */
.ls-backdrop{
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
    background: rgba(0,0,0,0.25);
    padding: 0;
}
.ls-panel{
    background: var(--tg-theme-bg-color, #ffffff);
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    height: 100vh;
    max-height: calc(100vh - env(safe-area-inset-top));
}
.ls-col{ padding: 14px; }
.ls-left{ flex: 0 0 240px; width: 240px; max-width: 240px; border-right: 1px solid var(--tg-theme-hint-color, #efefef); }
.ls-right{ flex: 1 1 auto; min-width: 0; max-width: none; }
.ls-region-item, .ls-city-item{ padding:10px 8px; cursor:pointer; border-radius:8px; }
.ls-region-item.active, .ls-city-item.active{ background: rgba(0,0,0,0.04); }
.ls-scroll{ max-height: calc(100vh - 200px - env(safe-area-inset-bottom)); overflow:auto; padding:6px 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.ls-search{ margin: 10px 0; }
.ls-search input[type="search"]{ width:100%; padding:8px 12px; border-radius:8px; border:1px solid var(--tg-theme-hint-color, #e3e3e3); background: var(--tg-theme-secondary-bg-color, #f8f8f8); color: var(--tg-theme-text-color, #000); }
.ls-footer{ display:flex; gap:8px; padding:12px 14px; border-top:1px solid var(--tg-theme-hint-color, #eee); justify-content:flex-end; background: var(--tg-theme-bg-color, #fff); position: sticky; bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.btn-ghost{ background:transparent; color: var(--tg-theme-button-color, #2481cc); border:1px solid var(--tg-theme-button-color, #2481cc); padding:10px 14px; border-radius:8px; cursor:pointer; }
.btn-solid{ background: var(--tg-theme-button-color, #2481cc); color: var(--tg-theme-button-text-color, #fff); border:0; padding:10px 14px; border-radius:8px; cursor:pointer; }
.ls-tags{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.ls-tag{ display:inline-flex; gap:8px; align-items:center; padding:6px 10px; border-radius:16px; background: var(--tg-theme-secondary-bg-color, rgba(0,0,0,0.06)); border:1px solid var(--tg-theme-hint-color, rgba(0,0,0,0.08)); font-size:12px; }
.ls-tag button{ border:0; background:transparent; cursor:pointer; padding:0; font-weight:700; }

@media (max-width: 600px){
    .ls-panel{ height: 100vh; max-height: calc(100vh - env(safe-area-inset-top)); border-radius: 0; flex-direction: column; }
    .ls-left{ display:block; width:100%; max-width:100%; padding: 12px 14px; border-right: none; border-bottom: 1px solid var(--tg-theme-hint-color, #efefef); flex: 0 0 35vh; }
    .ls-right{ width:100%; max-width:100%; padding: 12px 14px; flex: 1 1 auto; }
    .ls-left .ls-scroll{ max-height: calc(35vh - 40px); }
    .ls-right .ls-scroll{ max-height: calc(65vh - 180px - env(safe-area-inset-bottom)); }
}