* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, "Apple SD Gothic Neo", sans-serif;
    background: #f6f7fb;
    color: #1f2937;
}
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #111827; color: #fff; position: sticky; top: 0; z-index: 100; }
.topbar-inner { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.logo { font-size: 24px; font-weight: 800; }
.nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page { padding: 24px 0 56px; }

.card { background: #fff; border-radius: 18px; box-shadow: 0 8px 30px rgba(15, 23, 42, 0.07); padding: 20px; }
.hero { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 20px; }
.hero h1 { margin: 0 0 8px; font-size: 32px; }
.hero p { margin: 0; color: #6b7280; }
.hero-actions { display: flex; align-items: center; }

.search-panel { margin-bottom: 20px; }
.search-grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto auto; gap: 12px; align-items: center; }

input, select, textarea {
    width: 100%; padding: 12px 14px; border: 1px solid #d9deea;
    border-radius: 12px; font-size: 15px; background: #fff;
}

.btn {
    border: none; border-radius: 12px; padding: 12px 16px; font-size: 14px;
    font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn.small { padding: 9px 12px; font-size: 13px; }
.btn.primary { background: #2563eb; color: white; }
.btn.outline { background: #fff; border: 1px solid #2563eb; color: #2563eb; }
.btn.ghost { background: #eef2ff; color: #374151; }
.btn.danger { background: #ef4444; color: white; }

.checkline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.checkline input { width: auto; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 14px; }
.section-head h1, .section-head h2 { margin: 0; }

#map { width: 100%; height: 420px; border-radius: 14px; overflow: hidden; }
.map-section { margin-bottom: 22px; }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.room-card { padding: 0; overflow: hidden; }
.thumb-wrap { position: relative; height: 220px; background: #e5e7eb; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.empty-thumb {
    width: 100%; height: 100%; display: grid; place-items: center;
    color: #9ca3af; font-weight: 700; letter-spacing: 1px;
}
.premium-badge {
    position: absolute; top: 12px; left: 12px; background: #f59e0b; color: white;
    font-size: 12px; font-weight: 800; padding: 7px 10px; border-radius: 999px;
}
.room-body { padding: 18px; }
.room-meta-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chip {
    display: inline-block; background: #dbeafe; color: #1d4ed8; padding: 6px 10px;
    border-radius: 999px; font-size: 12px; font-weight: 700;
}
.muted { color: #6b7280; }
.small-text { font-size: 13px; }
.price { font-size: 18px; font-weight: 800; margin: 10px 0; }
.price.big { font-size: 24px; }
.room-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.auth-card, .form-card { max-width: 860px; margin: 0 auto; }
.auth-form { display: grid; gap: 12px; margin-top: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.detail-image-box {
    height: 520px; background: #e5e7eb; border-radius: 14px; overflow: hidden;
}
.detail-image { width: 100%; height: 100%; object-fit: cover; }
.detail-empty { border-radius: 14px; }
.detail-info h1 { margin: 10px 0 8px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.info-grid div {
    background: #f8fafc; border-radius: 12px; padding: 12px; display: grid; gap: 6px;
}
.desc-box { background: #f8fafc; padding: 16px; border-radius: 14px; }
.desc-box h3 { margin-top: 0; }
.premium-inline { color: #d97706; font-weight: 800; }

.gallery-toolbar {
    display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px;
}
.thumb-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 16px;
}
.thumb-button {
    border: 2px solid transparent; background: #fff; border-radius: 12px; padding: 0; overflow: hidden; cursor: pointer;
}
.thumb-button.active { border-color: #2563eb; }
.thumb-button img { width: 100%; height: 72px; object-fit: cover; }

.existing-images {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 14px;
}
.existing-image-card {
    border: 1px solid #e5e7eb; border-radius: 14px; padding: 10px; background: #f8fafc;
}
.existing-image-card img {
    width: 100%; height: 120px; object-fit: cover; border-radius: 10px; margin-bottom: 8px;
}
.existing-image-meta {
    font-size: 12px; color: #6b7280; word-break: break-all; margin-bottom: 8px;
}

.flash-wrap { margin-bottom: 16px; }
.flash {
    background: #ecfdf5; color: #166534; border: 1px solid #a7f3d0;
    padding: 12px 14px; border-radius: 12px; margin-bottom: 8px;
}
.empty-state { text-align: center; color: #6b7280; padding: 40px 20px; }
.footer { background: #111827; color: #cbd5e1; padding: 18px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 980px) {
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
    .search-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .topbar-inner, .hero, .section-head, .footer-inner { flex-direction: column; align-items: flex-start; }
    .cards, .form-grid, .info-grid, .search-grid { grid-template-columns: 1fr; }
    #map { height: 340px; }
    .detail-image-box { height: 320px; }
}

#map,
.leaflet-container {
    z-index: 1;
    position: relative;
}

.leaflet-pane,
.leaflet-top,
.leaflet-bottom,
.leaflet-control {
    z-index: 2 !important;
}

.topbar {
    z-index: 1000;
}