/* === RESET === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f5f3ee;
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

/* === LAYOUT === */
.app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 380px;
    flex-shrink: 0;
    background: #f5f3ee;
    border-right: 1px solid #e5e2da;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.map-container {
    flex: 1;
    position: relative;
    background: #e8e6df;
}

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

/* === SIDEBAR HEADER === */
.sidebar__header {
    padding: 28px 24px 20px;
    border-bottom: 1px solid #e5e2da;
}

.sidebar__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.sidebar__subtitle {
    font-size: 13px;
    color: #6b6862;
    line-height: 1.4;
}

/* === SEARCH === */
.search {
    padding: 14px 24px 0;
    position: relative;
}

.search__input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 1px solid #d8d4ca;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: #1a1a1a;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none' stroke='%238a8780' stroke-width='1.6' stroke-linecap='round'><circle cx='6' cy='6' r='4.5'/><path d='M9.5 9.5L13 13'/></svg>") no-repeat right 12px center;
    transition: border-color 0.15s ease;
}

.search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.search__input:focus {
    outline: none;
    border-color: #1a3d1f;
    background-color: #fff;
}

.search__input:not(:placeholder-shown) {
    background-image: none;
    padding-right: 36px;
}

.search__clear {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 7px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e5e2da;
    color: #6b6862;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.search__clear:hover {
    background: #d8d4ca;
    color: #1a1a1a;
}

/* === FILTERS === */
.filters {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e2da;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.filter:nth-child(3) {
    grid-column: 1 / -1;
}

.filter__label {
    font-size: 11px;
    font-weight: 500;
    color: #8a8780;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter__select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%231a1a1a' d='M6 9L1.5 4.5h9z'/></svg>") no-repeat right 10px center;
    border: 1px solid #d8d4ca;
    border-radius: 6px;
    padding: 8px 28px 8px 10px;
    font-size: 13px;
    color: #1a1a1a;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.filter__select:hover {
    border-color: #1a1a1a;
}

.filter__select:focus {
    outline: none;
    border-color: #1a1a1a;
}

.filter__reset {
    grid-column: 1 / -1;
    padding: 8px;
    font-size: 12px;
    color: #6b6862;
    border: 1px solid #d8d4ca;
    border-radius: 6px;
    background: transparent;
    transition: all 0.15s ease;
}

.filter__reset:hover {
    color: #1a1a1a;
    border-color: #1a1a1a;
}

/* === COUNTER === */
.counter {
    padding: 14px 24px;
    font-size: 12px;
    color: #6b6862;
    border-bottom: 1px solid #e5e2da;
    background: #efece6;
}

/* === PLACES LIST === */
.places-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.places-list::-webkit-scrollbar {
    width: 6px;
}

.places-list::-webkit-scrollbar-track {
    background: transparent;
}

.places-list::-webkit-scrollbar-thumb {
    background: #d8d4ca;
    border-radius: 3px;
}

.place-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 24px;
    cursor: pointer;
    transition: background 0.12s ease;
    border-bottom: 1px solid #e5e2da;
}

.place-item:hover {
    background: #efece6;
}

.place-item.is-active {
    background: #1a3d1f;
    color: #f5f3ee;
}

.place-item.is-active .place-item__meta,
.place-item.is-active .place-item__address {
    color: #c4d4c7;
}

.place-item__avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--avatar-color, #1a3d1f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-top: 2px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.place-item__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.place-item.is-active .place-item__avatar {
    box-shadow: 0 0 0 2px #f5f3ee, 0 0 0 4px var(--avatar-color, #1a3d1f);
}

.place-item__body {
    flex: 1;
    min-width: 0;
}

.place-item__name {
    font-size: 14px;
    font-weight: 600;
    color: inherit;
    margin-bottom: 4px;
    line-height: 1.3;
}

.place-item__address {
    font-size: 12px;
    color: #8a8780;
    line-height: 1.4;
    margin-bottom: 4px;
}

.place-item__meta {
    font-size: 11px;
    color: #6b6862;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* === SIDEBAR FOOTER === */
.sidebar__footer {
    padding: 14px 24px;
    border-top: 1px solid #e5e2da;
    font-size: 12px;
    color: #8a8780;
    background: #efece6;
    text-align: center;
}

.footer-link {
    color: #6b6862;
    transition: color 0.15s ease;
}

.footer-link:hover {
    color: #1a3d1f;
}

.footer-dot {
    margin: 0 8px;
    color: #c4c0b6;
}

/* === MAP MARKERS === */
.tea-marker {
    background: var(--marker-color, #1a3d1f);
    color: #fff;
    border-radius: 50%;
    width: 38px !important;
    height: 38px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.tea-marker img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.tea-marker:hover {
    transform: scale(1.15);
    z-index: 1000 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.tea-marker.is-active {
    transform: scale(1.25);
    z-index: 1000 !important;
    box-shadow: 0 0 0 3px var(--marker-color, #1a3d1f), 0 4px 16px rgba(0, 0, 0, 0.3);
    border-color: #fff;
}

/* === LEGEND === */
.legend {
    padding: 12px 24px 8px;
    border-bottom: 1px solid #e5e2da;
    background: #f5f3ee;
}

.legend__title {
    font-size: 11px;
    font-weight: 500;
    color: #8a8780;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.legend__items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #1a1a1a;
}

.legend__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* === LEAFLET OVERRIDES === */
.leaflet-container {
    background: #e8e6df !important;
    font-family: 'Inter', sans-serif;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: #fff !important;
    color: #1a1a1a !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    font-weight: 400 !important;
}

.leaflet-control-zoom a:hover {
    background: #f5f3ee !important;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.85) !important;
    font-size: 10px !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    margin: 8px !important;
}

/* === MODAL === */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none !important;
}

.modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal__content {
    position: relative;
    background: #f5f3ee;
    border-radius: 16px;
    max-width: 520px;
    width: calc(100% - 32px);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    z-index: 1;
}

.modal__close:hover {
    background: rgba(0, 0, 0, 0.12);
}

.place-detail {
    padding: 32px;
}

.place-detail__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.place-detail__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--avatar-color, #1a3d1f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.place-detail__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.place-detail__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.place-detail__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.place-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b6862;
    background: #fff;
    border: 1px solid #e5e2da;
    padding: 4px 10px;
    border-radius: 12px;
}

.place-tag__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.place-detail__section {
    padding: 16px 0;
    border-top: 1px solid #e5e2da;
}

.place-detail__section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.place-detail__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8a8780;
    font-weight: 500;
    margin-bottom: 6px;
}

.place-detail__value {
    font-size: 14px;
    color: #1a1a1a;
    line-height: 1.5;
}

.place-detail__value a {
    color: #1a3d1f;
    border-bottom: 1px solid #1a3d1f;
    transition: opacity 0.15s ease;
}

.place-detail__value a:hover {
    opacity: 0.7;
}

.place-detail__description {
    font-size: 15px;
    color: #1a1a1a;
    line-height: 1.55;
}

.place-detail__description p,
.place-detail__value p {
    margin-bottom: 8px;
}

.place-detail__description p:last-child,
.place-detail__value p:last-child {
    margin-bottom: 0;
}

.place-detail__section--intro .place-detail__description {
    font-weight: 400;
}

.place-detail__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.place-detail__list li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.place-detail__list li:last-child {
    margin-bottom: 0;
}

.place-detail__list li::before {
    content: "•";
    position: absolute;
    left: 2px;
    color: #1a3d1f;
    font-weight: 700;
}

.place-detail__sublabel {
    font-size: 12px;
    color: #6b6862;
    margin-top: 12px;
    margin-bottom: 8px;
}

.route-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.route-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #d8d4ca;
    border-radius: 18px;
    background: #fff;
    color: #1a1a1a;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.route-btn:hover {
    border-color: #1a3d1f;
    background: #1a3d1f;
    color: #f5f3ee;
    transform: translateY(-1px);
}

.route-btn__icon {
    font-size: 13px;
    line-height: 1;
}

/* === MOBILE TOGGLE === */
.mobile-toggle {
    display: none;
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a3d1f;
    color: #f5f3ee;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    align-items: center;
    gap: 8px;
    transition: bottom 0.3s ease;
    white-space: nowrap;
}

/* === MOBILE === */
@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid #e5e2da;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60vh;
        transform: translateY(calc(100% - 60px));
        transition: transform 0.3s ease;
        z-index: 1000;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }

    .sidebar.is-open {
        transform: translateY(0);
    }

    .map-container {
        height: 100vh;
        width: 100%;
    }

    .mobile-toggle {
        display: flex;
    }

    .sidebar.is-open + .map-container .mobile-toggle {
        display: flex;
        bottom: calc(60vh + 8px);
    }

    .sidebar__header {
        padding: 16px 20px 12px;
    }

    .sidebar__title {
        font-size: 18px;
    }

    .filters {
        padding: 12px 20px;
    }

    .place-detail {
        padding: 24px 20px;
    }
}
