:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    
    /* Light Mode (Default) */
    --bg-body: #f1f5f9;
    --bg-header: rgba(255, 255, 255, 0.8);
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-nav: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.08);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

body.dark-mode {
    /* Dark Mode Override */
    --bg-body: #0f172a;
    --bg-header: rgba(15, 23, 42, 0.8);
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-nav: rgba(30, 41, 59, 0.8);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-main {
    font-size: 1.6rem;
    font-weight: 900;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.logo-sub {
    font-size: 0.75rem; /* Increased size slightly */
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.1px;
}

.header-action {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Language Switcher */
.lang-switcher {
    position: relative;
    cursor: pointer;
}

.lang-selected {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    width: 100px;
    display: none; /* Toggle with JS */
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

body.dark-mode .lang-dropdown {
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.lang-dropdown.show {
    display: flex;
}

.lang-option {
    padding: 10px 12px;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.lang-option:hover {
    background: var(--glass);
}

/* Top Navigation */
.top-nav {
    position: sticky;
    top: 73px;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    z-index: 99;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.3s ease;
    gap: 4px;
    flex: 1;
}

.nav-item i {
    font-size: 1.4rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

.nav-item.active {
    color: var(--primary-light);
    transform: translateY(-4px);
}

.nav-item.active i {
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

/* Map Container */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 40vh;
    margin: 1rem 0 1.5rem 0; /* Added top margin for rounded corners */
}

#map {
    width: 100%;
    height: 100%;
    border-radius: 24px;
}

.map-inner-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 24px;
    z-index: 5;
    gap: 12px;
}

.spinner-small {
    width: 24px;
    height: 24px;
    border: 2px solid var(--glass);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.map-inner-loader span {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Content Sections */
.content {
    padding: 0 1.25rem;
    margin-top: 1.5rem;
}

/* Main Action Button */
.search-action-container {
    padding: 0 1.25rem;
    margin-top: -2.5rem; /* Overlap with map */
    position: relative;
    z-index: 10;
}

.btn-main-action {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 16px;
    padding: 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-main-action:active {
    transform: scale(0.97);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title span {
    font-size: 0.8rem;
    color: var(--primary-light);
    font-weight: 400;
}

/* Recommendation Cards */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.place-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    transition: transform 0.2s;
}

.place-card:active {
    transform: scale(0.98);
}

.place-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    background: #1e293b;
}

.place-info {
    flex: 1;
}

.place-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.place-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.place-rating {
    color: #fbbf24;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.place-card {
    animation: fadeInUp 0.5s ease backwards;
}

/* Utility */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-body);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.3s;
}

.theme-toggle:active {
    transform: rotate(45deg) scale(0.9);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Radius Selector */
.radius-selector {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2px 8px;
    display: flex;
    align-items: center;
}

.radius-selector select {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    padding: 4px;
}

.radius-selector select option {
    background: var(--bg-card);
    color: var(--text-main);
}

/* Place Card Distance Tag */
.place-distance-tag {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    margin-left: auto;
    padding-left: 12px;
}

.dist-val {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

.walk-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.walk-time i {
    font-size: 0.7rem;
}

/* Logo Link */
.logo-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
}

.logo-link:active {
    opacity: 0.8;
}

/* Category Chips */
.category-container {
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.category-scroll {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping to multiple lines */
    gap: 10px;
    padding: 10px 1.25rem;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-chip {
    white-space: nowrap;
    padding: 8px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Clock Section */
.clock-section {
    padding: 8px 1.25rem;
    background: var(--bg-body);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
}

.clock-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.time-diff {
    padding: 2px 8px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
}

.clock-flag {
    font-size: 1rem;
}

.clock-time {
    color: var(--text-main);
}

/* Disabled Nav Item */
.nav-item.disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.3 !important;
}

.nav-item.disabled i, .nav-item.disabled span {
    color: var(--text-muted) !important;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 1.5rem;
    padding-bottom: 1rem;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:active:not(.disabled) {
    transform: scale(0.95);
}

.page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-nav-btn {
    padding: 0 12px;
}
