/* ============================================================
   HOME.CSS - Map, Search Overlay, Bottom Sheet
   ============================================================ */

/* Map Container */
.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

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

/* ============================================================
   SEARCH OVERLAY (Cho mobile/tablet)
   ============================================================ */

.search-overlay {
    position: absolute;
    top: var(--khoang-cach-md);
    left: var(--khoang-cach-md);
    right: var(--khoang-cach-md);
    max-width: 400px;
    background: white;
    border-radius: var(--bo-goc-lg);
    box-shadow: var(--bong-lg);
    z-index: var(--z-dropdown);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--chuyen-canh-trung-binh);
}

.search-overlay--active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--khoang-cach-md);
    border-bottom: 1px solid var(--mau-vien);
}

.search-header__title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--mau-chu-chinh);
    margin: 0;
}

.btn-close {
    color: var(--mau-chu-phu);
    width: 44px;
    height: 44px;
    font-size: var(--font-size-lg);
}

.search-content {
    padding: var(--khoang-cach-md);
}

.search-results {
    margin-top: var(--khoang-cach-md);
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.search-results__item {
    display: flex;
    align-items: center;
    gap: var(--khoang-cach-sm);
    padding: var(--khoang-cach-md);
    border-radius: var(--bo-goc-md);
    cursor: pointer;
    transition: all var(--chuyen-canh-nhanh);
    min-height: 60px;
}

.search-results__item:hover,
.search-results__item:active {
    background-color: var(--mau-nen-xam);
}

.search-results__icon {
    width: 44px;
    height: 44px;
    background-color: var(--mau-chinh);
    color: white;
    border-radius: var(--bo-goc-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--font-size-lg);
}

.search-results__info {
    flex: 1;
    min-width: 0; /* Cho phép text truncate */
}

.search-results__name {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--mau-chu-chinh);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-results__address {
    font-size: var(--font-size-sm);
    color: var(--mau-chu-phu);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ẩn search overlay trên desktop (dùng sidebar thay thế) */
@media (min-width: 1024px) {
    .search-overlay {
        display: none;
    }
}

/* ============================================================
   BOTTOM SHEET
   ============================================================ */

.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 80vh;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
    will-change: transform;
    transition: transform 0.3s ease-out;
}

.bottom-sheet--collapsed {
    transform: translateY(calc(100% - 75px));
}

.bottom-sheet--peek {
    transform: translateY(calc(100% - 400px));
}

.bottom-sheet--expanded {
    transform: translateY(15%);
}

.bottom-sheet--hidden {
    transform: translateY(100%);
}

.bottom-sheet--dragging {
    transition: none !important;
}

.bottom-sheet__handle {
    width: 40px;
    height: 5px;
    background-color: #d1d5db;
    border-radius: 3px;
    margin: 10px auto;
    cursor: grab;
    flex-shrink: 0;
}

.bottom-sheet__handle:active {
    cursor: grabbing;
    background-color: #9ca3af;
}

.bottom-sheet--dragging .bottom-sheet__handle {
    background-color: var(--mau-chinh);
}

/* Bottom Sheet Header (cho custom mode) */
.bottom-sheet__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--khoang-cach-md);
    flex-shrink: 0;
}

.bottom-sheet__title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--mau-chu-chinh);
    margin: 0;
}

.bottom-sheet__close {
    width: 36px;
    height: 36px;
    border-radius: var(--bo-goc-md);
    color: var(--mau-chu-phu);
}

.bottom-sheet__close:hover {
    background: var(--mau-nen-xam);
    color: var(--mau-chu-chinh);
}

/* Custom mode - mở hết */
.bottom-sheet--custom {
    transform: translateY(10%) !important;
}

.bottom-sheet--custom .bottom-sheet__handle {
    display: none;
}

.bottom-sheet__content {
    padding: 0 var(--khoang-cach-md) var(--khoang-cach-md);
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}
.bottom-sheet__content p {
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--khoang-cach-md);
    margin: 0;
}
.bottom-sheet__content h3{
  padding-bottom: 10px;
}

/* Thong tin mac dinh */
.thong-tin-mac-dinh {
    text-align: center;
    padding: var(--khoang-cach-sm) var(--khoang-cach-md);
}

.thong-tin-mac-dinh h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--mau-chu-chinh);
    margin: 0;
}

.thong-tin-mac-dinh p {
    font-size: var(--font-size-sm);
    color: var(--mau-chu-phu);
    margin: var(--khoang-cach-xs) 0 0 0;
}

/* Thông tin di tích */
.thong-tin-di-tich {
    padding: var(--khoang-cach-md) 0;
}

.thong-tin-di-tich__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--khoang-cach-md);
    gap: var(--khoang-cach-sm);
}

.thong-tin-di-tich__title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--mau-chu-chinh);
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--khoang-cach-xs);
    padding: var(--khoang-cach-sm) var(--khoang-cach-md);
    font-size: var(--font-size-sm);
    color: var(--mau-chinh);
    background: transparent;
    border: 1px solid var(--mau-chinh);
    border-radius: var(--bo-goc-md);
    cursor: pointer;
    transition: all var(--chuyen-canh-nhanh);
    min-height: 44px;
    flex-shrink: 0;
}

.btn-back:hover,
.btn-back:active {
    background-color: var(--mau-chinh);
    color: white;
}

.thong-tin-di-tich__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--khoang-cach-sm);
    margin-bottom: var(--khoang-cach-md);
}

.thong-tin-di-tich__badge {
    display: inline-flex;
    align-items: center;
    gap: var(--khoang-cach-xs);
    padding: var(--khoang-cach-xs) var(--khoang-cach-sm);
    background-color: var(--mau-nen-xam);
    border-radius: var(--bo-goc-full);
    font-size: var(--font-size-sm);
    color: var(--mau-chu-phu);
}

.thong-tin-di-tich__address {
    display: flex;
    align-items: flex-start;
    gap: var(--khoang-cach-xs);
    font-size: var(--font-size-sm);
    color: var(--mau-chu-phu);
    margin-bottom: var(--khoang-cach-md);
    line-height: 1.5;
}

.thong-tin-di-tich__address i {
    margin-top: 3px;
    flex-shrink: 0;
}

.thong-tin-di-tich__description {
    font-size: var(--font-size-base);
    color: var(--mau-chu-chinh);
    line-height: 1.7;
    margin-bottom: var(--khoang-cach-lg);
}

.thong-tin-di-tich__actions {
    display: flex;
    gap: var(--khoang-cach-sm);
    flex-wrap: wrap;
}

.thong-tin-di-tich__actions .btn {
    flex: 1;
    min-width: 120px;
    min-height: 48px;
}

/* Gallery trong bottom sheet */
.thong-tin-di-tich__gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--khoang-cach-sm);
    margin-bottom: var(--khoang-cach-lg);
}

.gallery__item {
    aspect-ratio: 1;
    border-radius: var(--bo-goc-md);
    overflow: hidden;
    cursor: pointer;
}

.gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--chuyen-canh-trung-binh);
}

.gallery__item:hover img {
    transform: scale(1.05);
}

/* Ẩn bottom sheet trên desktop (dùng sidebar thay thế) */
@media (min-width: 1024px) {
    .bottom-sheet {
        display: none;
    }
}

/* ============================================================
   STORY SIDEBAR (Desktop) 
   ============================================================ */

.story-sidebar {
    display: none;
}

@media (min-width: 1400px) {
    .story-sidebar {
        display: block;
        position: absolute;
        top: 15%;
        left: 20px;
        width: 53rem;
        max-height: 68%;
        z-index: 1000;
        overflow: hidden;
    }
    
    .story-container {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 20px;
        transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    
    .story {
        scroll-snap-align: center;
        background: #8B4513;
        color: white;
        border-radius: 16px;
        padding: 106px 30px;
        cursor: pointer;
        opacity: 0.6;
        transform: scale(0.9);
        transition: all 0.3s ease;
        position: relative;
    }
    
    .story:hover {
        opacity: 0.8;
    }
    
    .story.active {
        opacity: 1;
        transform: scale(1);
        transform: translateX(50px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    }
    .story.active .story__summary{
        width: 95%;
    }
    
    .story__title {
        font-size: 1.1rem;
        font-weight: 600;
        margin: 0 0 8px 0;
        line-height: 1.3;
    }
    
    .story__summary {
        font-size: 0.95rem;
        font-weight: 300;
        line-height: 1.4;
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .story__link {
        color: #ffc107;
        font-weight: 600;
        font-style: italic;
        cursor: pointer;
        margin-left: 5px;
    }
    
    .story__link:hover {
        text-decoration: underline;
    }
    
    .story__number {
        position: absolute;
        top: -16px;
        right: 45%;
        width: 42px;
        height: 42px;
        background: white;
        color: #333;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 0.9rem;
        box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    }
    
    /* An bottom sheet va search overlay tren desktop */
    .bottom-sheet {
        display: none;
    }
    
    .search-overlay {
        display: none;
    }
}
/* Search Box tren Map (Desktop/Tablet) */
.map-search {
    display: none;
}

@media (min-width: 1024px) {
    .map-search {
        display: flex;
        align-items: center;
        position: absolute;
        top: 16px;
        left: 50.6%;
        transform: translateX(-50%);
        background: white;
        border-radius: var(--bo-goc-full);
        padding: 12px 20px;
        gap: 10px;
        box-shadow: var(--bong-lg);
        z-index: 1000;
        width: 90%;
        max-width: 500px;
    }
    
    .map-search i {
        color: var(--mau-chu-phu);
        font-size: var(--font-size-base);
    }
    
    .map-search input {
        border: none;
        background: transparent;
        outline: none;
        width: 100%;
        font-size: var(--font-size-base);
    }
    
    .map-search__results {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-radius: var(--bo-goc-md);
        box-shadow: var(--bong-lg);
        margin-top: 8px;
        max-height: 300px;
        overflow-y: auto;
        display: none;
    }
    
    .map-search__results.active {
        display: block;
    }
    
    .map-search__item {
        padding: 12px 16px;
        cursor: pointer;
        border-bottom: 1px solid var(--mau-vien);
    }
    
    .map-search__item:hover {
        background: var(--mau-nen-xam);
    }
    
    .map-search__item:last-child {
        border-bottom: none;
    }
}