:root {
    --bg: #0f1117;
    --bg2: #1a1d27;
    --bg3: #242836;
    --text: #e2e8f0;
    --text2: #94a3b8;
    --accent: #e74c3c;
    --accent2: #c0392b;
    --green: #2ecc71;
    --border: #2d3348;
    --region1: #e74c3c;
    --region2: #3498db;
    --region3: #2ecc71;
    --region4: #f39c12;
    --region5: #9b59b6;
    --region6: #1abc9c;
    --region7: #e67e22;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1.5rem; background: var(--bg2); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1000;
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.nav-brand:hover { text-decoration: none; }
.logo { flex-shrink: 0; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--text2); font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.btn {
    display: inline-block; padding: 0.5rem 1rem; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg3); color: var(--text); cursor: pointer; font-size: 0.875rem; transition: all 0.2s;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent2); }
.btn-accent { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-accent:hover { background: var(--accent); color: white; }
.btn-danger { border-color: #e74c3c; color: #e74c3c; }
.btn-danger:hover { background: #e74c3c; color: white; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

.map-container { position: relative; }
#map { height: 65vh; width: 100%; z-index: 1; }
.region-filter {
    position: absolute; top: 10px; right: 10px; z-index: 1000;
    background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
    padding: 0.75rem; min-width: 160px;
}
.region-filter h3 { font-size: 0.875rem; margin-bottom: 0.5rem; color: var(--text2); }
.filter-item { display: block; padding: 0.2rem 0; cursor: pointer; font-size: 0.85rem; color: var(--text); }
.filter-item input { margin-right: 0.4rem; }

.route-panel {
    background: var(--bg2); border-top: 1px solid var(--border);
    padding: 0.75rem 1.5rem; display: none;
}
.route-panel.active { display: block; }
.route-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.route-header h3 { font-size: 1rem; }
.route-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.route-item {
    display: flex; align-items: center; gap: 0.4rem;
    background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
    padding: 0.3rem 0.6rem; font-size: 0.85rem;
}
.route-item .remove { cursor: pointer; color: var(--text2); font-weight: bold; }
.route-item .remove:hover { color: var(--accent); }

.places-section { padding: 2rem 1.5rem; }
.places-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.places-header h2 { font-size: 1.5rem; }
.search-wrap { position: relative; display: inline-block; }
.search-input {
    padding: 0.5rem 2rem 0.5rem 1rem; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg3); color: var(--text); font-size: 0.9rem; width: 250px;
}
.search-clear {
    position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
    cursor: pointer; color: var(--text2); font-size: 1.2rem; line-height: 1; display: none;
}
.search-clear:hover { color: var(--accent); }
.search-clear.visible { display: block; }

.places-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.place-card {
    background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden; transition: transform 0.2s, border-color 0.2s; cursor: pointer;
}
.place-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-img {
    height: 180px; background-size: cover; background-position: center;
    position: relative; background-color: var(--bg3);
}
.region-badge {
    position: absolute; top: 8px; left: 8px; padding: 0.2rem 0.6rem;
    border-radius: 4px; font-size: 0.7rem; font-weight: 600; color: white;
}
.region-1 { background: var(--region1); }
.region-2 { background: var(--region2); }
.region-3 { background: var(--region3); }
.region-4 { background: var(--region4); }
.region-5 { background: var(--region5); }
.region-6 { background: var(--region6); }
.region-7 { background: var(--region7); }

.card-body { padding: 1rem; }
.card-body h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.card-body h3 a { color: var(--text); }
.card-body h3 a:hover { color: var(--accent); }
.card-body p { color: var(--text2); font-size: 0.85rem; line-height: 1.5; margin-bottom: 0.75rem; }
.card-actions { display: flex; gap: 0.5rem; }

.place-detail { }
.place-hero {
    height: 50vh; background-size: cover; background-position: center;
    display: flex; align-items: flex-end; background-color: var(--bg3);
}
.hero-overlay {
    width: 100%; padding: 2rem 1.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.hero-overlay h1 { font-size: 2.5rem; margin-bottom: 0.25rem; }
.place-name-tr { color: var(--text2); font-size: 1.1rem; margin-bottom: 0.5rem; }
.category-badge {
    display: inline-block; padding: 0.2rem 0.6rem; background: var(--bg3);
    border-radius: 4px; font-size: 0.75rem; color: var(--text2); margin-left: 0.5rem;
}
.place-content { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding: 2rem 1.5rem; }
.place-info p { color: var(--text2); line-height: 1.8; font-size: 1rem; margin-bottom: 1rem; }
.place-meta { color: var(--text2); font-size: 0.85rem; margin-bottom: 1rem; }
.place-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.detail-map { height: 400px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }

.contact-page, .auth-page { max-width: 600px; margin: 2rem auto; padding: 0 1.5rem; }
.contact-page h1, .auth-page h1 { margin-bottom: 0.5rem; }
.contact-page > p { color: var(--text2); margin-bottom: 1.5rem; }
.contact-form, .auth-form, .edit-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.85rem; color: var(--text2); }
.form-group input, .form-group textarea, .form-group select {
    padding: 0.6rem 0.8rem; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg3); color: var(--text); font-size: 0.9rem;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--accent);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: rgba(46,204,113,0.15); border: 1px solid var(--green); color: var(--green); }
.alert-error { background: rgba(231,76,60,0.15); border: 1px solid var(--accent); color: var(--accent); }

.admin-page { padding: 1.5rem; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.admin-header > div { display: flex; align-items: center; gap: 0.75rem; }
.admin-user { color: var(--text2); font-size: 0.85rem; }
.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
.admin-table th, .admin-table td {
    padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.85rem;
}
.admin-table th { color: var(--text2); font-weight: 600; }
.admin-table tr:hover { background: var(--bg3); }
.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }

.current-photo { margin-bottom: 0.5rem; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.photo-thumb { position: relative; width: 120px; height: 90px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-remove {
    position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
    background: rgba(0,0,0,0.7); color: white; border: none; border-radius: 50%;
    cursor: pointer; font-size: 14px; line-height: 18px; text-align: center; padding: 0;
}
.photo-remove:hover { background: var(--accent); }

.carousel { position: relative; margin-bottom: 1rem; }
.carousel-track {
    display: flex; gap: 0.5rem; overflow-x: auto; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 0.25rem;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide {
    flex: 0 0 auto; width: 160px; height: 110px; border-radius: 8px; overflow: hidden;
    cursor: pointer; border: 2px solid transparent; scroll-snap-align: center; transition: border-color 0.2s;
}
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-slide:hover, .carousel-slide.active { border-color: var(--accent); }
.carousel-btn {
    position: absolute; top: 50%; transform: translateY(-70%);
    background: rgba(0,0,0,0.6); color: white; border: none; border-radius: 50%;
    width: 28px; height: 28px; font-size: 18px; line-height: 26px; text-align: center;
    cursor: pointer; z-index: 2; transition: background 0.2s;
}
.carousel-btn:hover { background: var(--accent); }
.carousel-prev { left: 0; }
.carousel-next { right: 0; }
.carousel-dots { display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.5rem; }
.carousel-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--border);
    cursor: pointer; transition: background 0.2s;
}
.carousel-dot.active { background: var(--accent); }

.hero-intro {
    padding: 2.5rem 1.5rem 1.5rem; text-align: center; margin: 0 auto;
}
.hero-intro h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.hero-intro p { color: var(--text2); line-height: 1.7; font-size: 0.95rem; }

.card-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
.tag {
    display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px;
    background: var(--bg3); border: 1px solid var(--border);
    font-size: 0.7rem; color: var(--text2); text-decoration: none;
}
.clickable-tag { cursor: pointer; transition: all 0.2s; }
.clickable-tag:hover { background: var(--accent); color: white; border-color: var(--accent); text-decoration: none; }

.route-fab {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
    background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
    padding: 0.75rem 1rem; max-width: 340px; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: none;
}
.route-fab.visible { display: block; }
@keyframes fabPulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
.route-fab.pulse { animation: fabPulse 0.4s ease; }
.route-fab-items { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.6rem; max-height: 120px; overflow-y: auto; }
.route-fab-item {
    display: inline-flex; align-items: center; gap: 0.3rem;
    background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
    padding: 0.2rem 0.5rem; font-size: 0.75rem; color: var(--text);
}
.route-fab-item .remove { cursor: pointer; color: var(--text2); font-weight: bold; margin-left: 0.2rem; }
.route-fab-item .remove:hover { color: var(--accent); }
.route-fab-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

.nearby-section { margin-top: 1.5rem; }
.nearby-section h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--text); }
.nearby-list { list-style: none; }
.nearby-list li { padding: 0.3rem 0; font-size: 0.9rem; }
.nearby-list li a { color: var(--accent); }
.nearby-dist { color: var(--text2); font-size: 0.75rem; margin-left: 0.3rem; }

footer { text-align: center; padding: 2rem; color: var(--text2); font-size: 0.8rem; border-top: 1px solid var(--border); }

@media (max-width: 768px) {
    .place-content { grid-template-columns: 1fr; }
    .places-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .region-filter { position: static; margin: 0; border-radius: 0; border: none; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.5rem 1rem; }
    .region-filter h3 { margin-bottom: 0; margin-right: 0.5rem; }
    #map { height: 40vh; }
    .navbar { padding: 0.5rem 0.75rem; }
    .nav-brand { font-size: 1rem; }
    .nav-links { gap: 0.75rem; }
    .nav-links a { font-size: 0.85rem; }
    .hero-intro { padding: 1.5rem 1rem 1rem; }
    .hero-intro h1 { font-size: 1.5rem; }
    .hero-intro p { font-size: 0.85rem; }
    .places-section { padding: 1rem 0.75rem; }
    .places-header { margin-bottom: 1rem; }
    .places-header h2 { font-size: 1.2rem; }
    .search-wrap { width: 100%; }
    .search-input { width: 100%; }
    .card-img { height: 150px; }
    .card-body { padding: 0.75rem; }
    .card-body h3 { font-size: 1rem; }
    .place-hero { height: 35vh; }
    .hero-overlay h1 { font-size: 1.5rem; }
    .place-content { padding: 1.5rem 0.75rem; }
    .detail-map { height: 280px; }
    .carousel-slide { width: 120px; height: 80px; }
    .carousel-btn { display: none; }
    .photo-thumb { width: 90px; height: 68px; }
    .route-fab { max-width: calc(100vw - 1rem); left: 0.5rem; right: 0.5rem; bottom: 0.5rem; }
    .admin-table { font-size: 0.75rem; }
    .admin-table th, .admin-table td { padding: 0.4rem; }
    footer { padding: 1rem; }
}

@media (max-width: 480px) {
    .nav-links { gap: 0.5rem; }
    .nav-links a { font-size: 0.8rem; }
    .place-actions { flex-direction: column; }
    .place-actions .btn { text-align: center; }
    .card-body p { font-size: 0.8rem; }
}
