.modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(22,163,74,0.10), transparent 28%),
        rgba(7, 12, 20, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    z-index: 2;
    width: min(980px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 30px;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.97) 0%,
        rgba(248,251,255,0.96) 100%
    );
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow:
        0 30px 80px rgba(15, 23, 42, 0.18),
        0 10px 30px rgba(15, 23, 42, 0.10);
    animation: modalPremiumIn 0.28s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(100,116,139,0.45) transparent;
}

@keyframes modalPremiumIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-body {
    padding: 28px;
}

.modal-body::before {
    content: "";
    display: block;
    width: 56px;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0.34;
    margin: 0 auto 20px;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background: rgba(255,255,255,0.92);
    color: #0f172a;
    border: 1px solid rgba(226,232,240,0.95);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.modal-close:hover {
    transform: translateY(-1px) scale(1.04);
    background: #ffffff;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
    padding-right: 74px;
}

.modal-header h2 {
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.1;
    margin: 0 0 8px;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.modal-location {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

.modal-price {
    flex-shrink: 0;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 13px 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #ffffff;
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
    margin-right: 6px;
    white-space: nowrap;
}

.modal-price span {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.82;
    margin-left: 2px;
    color: rgba(255,255,255,0.82);
}

.modal-gallery {
    margin-bottom: 22px;
}

.main-image {
    position: relative;
    height: 460px;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(226,232,240,0.9), rgba(241,245,249,0.9));
    border: 1px solid rgba(226,232,240,0.8);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image-box {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.92);
    color: #0f172a;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
    transition: var(--transition);
}

.gallery-nav:hover {
    background: #ffffff;
    transform: translateY(-50%) scale(1.05);
}

.gallery-nav.prev {
    left: 14px;
}

.gallery-nav.next {
    right: 14px;
}

.image-thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.image-thumbnails img {
    width: 88px;
    height: 66px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 14px;
    border: 2px solid transparent;
    opacity: 0.72;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.image-thumbnails img:hover,
.image-thumbnails img.active {
    opacity: 1;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.modal-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: rgba(255,255,255,0.72);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.detail-item i {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(22,163,74,0.12), rgba(14,165,233,0.12));
    color: var(--primary-dark);
    font-size: 16px;
    flex-shrink: 0;
}

.detail-item strong {
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}

.detail-item span {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.modal-tags .tag {
    padding: 8px 13px;
    border-radius: 999px;
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.modal-description {
    margin-bottom: 22px;
    padding: 20px;
    background: rgba(255,255,255,0.58);
    border: 1px solid rgba(219,228,238,0.8);
    border-radius: 22px;
}

.modal-description h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-weight: 800;
}

.modal-description p {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 15px;
    margin: 0;
}

.modal-actions,
.modal-actions.modal-actions-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.modal-reserve-btn,
.contact-btn-large,
.favorite-btn-modal,
.copy-link-btn {
    min-height: 52px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    transition: var(--transition);
}

.modal-reserve-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    border: none;
    box-shadow: 0 14px 26px rgba(22, 163, 74, 0.18);
}

.modal-reserve-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(22, 163, 74, 0.22);
}

.contact-btn-large {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #ffffff;
    border: none;
    box-shadow: 0 14px 26px rgba(18, 140, 126, 0.18);
}

.contact-btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(18, 140, 126, 0.22);
}

.favorite-btn-modal {
    background: rgba(255,255,255,0.82);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.favorite-btn-modal:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.favorite-btn-modal.active {
    background: #fff1f2;
    color: #e11d48;
    border-color: rgba(225,29,72,0.18);
}

.copy-link-btn {
    background: rgba(240,249,255,0.95);
    color: #0f766e;
    border: 1px solid rgba(153,246,228,0.9);
}

.copy-link-btn:hover {
    transform: translateY(-1px);
    background: #ecfeff;
}

/* dark */
body.dark-theme .modal-overlay {
    background:
        radial-gradient(circle at top, rgba(34,197,94,0.10), transparent 28%),
        rgba(2, 6, 23, 0.76);
}

body.dark-theme .modal-content {
    background: linear-gradient(
        180deg,
        rgba(12, 19, 34, 0.98) 0%,
        rgba(15, 23, 42, 0.96) 100%
    );
    border: 1px solid rgba(49,68,94,0.88);
    box-shadow:
        0 28px 80px rgba(0,0,0,0.46),
        0 8px 28px rgba(0,0,0,0.24);
}

body.dark-theme .modal-close {
    background: rgba(17,24,39,0.95);
    color: #f8fafc;
    border-color: rgba(51,65,85,0.95);
}

body.dark-theme .modal-price {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #ffffff;
}

body.dark-theme .main-image {
    background: linear-gradient(135deg, #111827, #1e293b);
    border-color: #243244;
}

body.dark-theme .gallery-nav {
    background: rgba(15,23,42,0.92);
    color: #f8fafc;
}

body.dark-theme .detail-item,
body.dark-theme .modal-description,
body.dark-theme .modal-tags .tag,
body.dark-theme .favorite-btn-modal {
    background: rgba(17,24,39,0.88);
    border-color: #243244;
}

body.dark-theme .detail-item i {
    background: linear-gradient(135deg, rgba(22,163,74,0.18), rgba(14,165,233,0.18));
    color: #86efac;
}

body.dark-theme .modal-header h2,
body.dark-theme .detail-item span,
body.dark-theme .modal-description h3 {
    color: #f8fafc;
}

body.dark-theme .modal-location,
body.dark-theme .detail-item strong,
body.dark-theme .modal-description p,
body.dark-theme .modal-tags .tag {
    color: #cbd5e1;
}

body.dark-theme .copy-link-btn {
    background: rgba(14, 116, 144, 0.16);
    color: #a5f3fc;
    border-color: rgba(34,211,238,0.2);
}