:root {
    --bg-color: #f0f0f0;
    --container-bg: #ffffff;
    --text-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --btn-bg: #4CAF50;
    --btn-hover: #45a049;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --btn-bg: #388E3C;
    --btn-hover: #2E7D32;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    overflow: hidden; /* Prevent overall body scroll */
}

body {
    display: flex;
    flex-direction: column;
}

/* Header Section */
.header-section {
    width: 100%;
    padding: 3px 0;
    background-color: var(--container-bg);
    border-bottom: 1px solid var(--shadow-color);
    z-index: 1000;
    text-align: center;
    flex-shrink: 0;
    transition: transform 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.header-section.earth-panel-open {
    transform: translateX(-190px);
}

.main-logo {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(45deg, #2196F3, #673AB7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.logo-tagline {
    display: none;
}

/* User Controls & Theme Toggle */
.theme-switch-wrapper {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 2000;
}

#user-info {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#user-display {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--text-color);
    background: var(--container-bg);
    color: var(--text-color);
    font-size: 12px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#lang-select, #theme-toggle {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--text-color);
    background: var(--container-bg);
    color: var(--text-color);
    cursor: pointer;
    font-size: 12px;
}

#logout-btn {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #f44336;
    background: var(--container-bg);
    color: #f44336;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

#logout-btn:hover {
    background: #f44336;
    color: white;
}

/* Cookie Consent Banner */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.97);
    color: #f0f0f0;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 9999;
    font-size: 0.82rem;
    flex-wrap: wrap;
}

#cookie-banner.hidden { display: none; }

#cookie-banner a {
    color: #64b5f6;
    text-decoration: underline;
}

#cookie-accept-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.82rem;
    white-space: nowrap;
    flex-shrink: 0;
}

#cookie-accept-btn:hover { background: #1976D2; }

/* Site Footer */
#site-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 6px 16px;
    font-size: 0.78rem;
    background: var(--container-bg);
    border-top: 1px solid var(--shadow-color);
    color: var(--text-color);
    opacity: 0.7;
    z-index: 20;
    transition: transform 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#site-footer.earth-panel-open {
    transform: translateX(-190px);
}

#site-footer a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 8px;
}

#site-footer a:hover {
    text-decoration: underline;
}

#site-footer span {
    opacity: 0.4;
}

/* Main Layout */
.main-layout-wrapper {
    display: flex;
    flex: 1;
    width: 100%;
    overflow: hidden;
}

#map {
    flex: 1;
    height: 100%;
    min-width: 300px;
    background-color: #e5e3df;
    transition: opacity 0.5s ease;
}

#map.map-transitioning {
    opacity: 0;
    transition: none;
}

#map-resize-handle {
    display: none;
}

#ui-content-area {
    width: 380px;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-color);
    box-shadow: -5px 0 15px var(--shadow-color);
    z-index: 10;
}

.container {
    background-color: var(--container-bg);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px var(--shadow-color);
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
    text-align: center;
}

/* Tablet Devices */
@media (max-width: 1024px) {
    .main-logo { font-size: 1.8rem; }
    #ui-content-area { width: 320px; }
}

/* Earth Overlay (pre-login) */
#earth-overlay {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: flex;
    overflow: hidden;
    transition: opacity 0.9s ease;
}

#earth-overlay.fading-out {
    opacity: 0;
    pointer-events: none;
}

.earth-left-panel {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.earth-right-panel {
    width: 380px;
    flex-shrink: 0;
    background: var(--container-bg);
    border-left: 1px solid var(--shadow-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
}

/* Desktop: login panel slides in from the right */
@media (min-width: 601px) {
    .earth-right-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        border-right: none;
        border-left: 1px solid var(--shadow-color);
        border-radius: 20px 0 0 20px;
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.35);
        transform: translateX(100%);
        transition: transform 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        z-index: 5;
    }

    .earth-right-panel.earth-panel-open {
        transform: translateX(0);
    }

    .earth-left-panel {
        transition: transform 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    .earth-left-panel.earth-panel-open {
        transform: translateX(-190px);
    }

    #earth-overlay.earth-panel-open #public-stats-panel {
        transform: translateX(-190px);
    }

}

#earth-overlay #auth-container {
    width: 100%;
    max-width: 100%;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 40px 32px;
    margin: 0;
}

.earth-stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 25% 40%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 40% 10%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 55% 60%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 70% 25%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1.5px 1.5px at 80% 75%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 90% 45%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 15% 80%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 35% 65%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 60% 85%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 75% 5%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 5% 50%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 45% 35%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 85% 55%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 20% 95%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 65% 70%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 95% 20%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 30% 5%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 50% 50%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 88% 90%, rgba(255,255,255,0.8), transparent);
}

.earth-img {
    position: relative;
    margin-top: 2vh;
    width: min(60vw, 60vh);
    max-width: 520px;
    min-width: 220px;
    border-radius: 50%;
    box-shadow:
        0 0 60px 15px rgba(50, 130, 255, 0.35),
        0 0 150px 40px rgba(20, 80, 220, 0.15);
    animation: earth-float 9s ease-in-out infinite;
    display: block;
}

@keyframes earth-float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-18px); }
}

/* Public Stats Panel (pre-login, inside earth-overlay) */
#public-stats-panel {
    position: absolute;
    bottom: 34px;
    left: 190px;
    right: 190px;
    transition: transform 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(6px);
    color: white;
    padding: 12px 16px 16px;
    max-height: 44%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#public-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.public-stats-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.02em;
}

.public-stats-total {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
}

.public-stats-total strong {
    color: #64b5f6;
    font-size: 0.95rem;
    font-weight: 700;
}

#public-country-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.public-country-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.85);
}

.public-country-rank {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    min-width: 16px;
    text-align: right;
}

.public-country-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.public-country-count {
    color: #90caf9;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 28px;
    text-align: right;
}

/* Mobile Devices */
@media (max-width: 600px) {
    .header-section {
        padding: 2px 0;
        transform: none !important;
        transition: none !important;
    }

    .header-section.earth-panel-open {
        transform: none !important;
    }

    #site-footer {
        transform: none !important;
        transition: none !important;
    }

    #site-footer.earth-panel-open {
        display: none !important;
    }

    .main-logo { font-size: 1rem; }
    .logo-tagline { display: none; } /* Hide tagline to save space */

    .theme-switch-wrapper {
        position: relative;
        top: 0;
        right: 0;
        width: 100%;
        padding: 4px 8px;
        background: var(--container-bg);
        justify-content: center;
        border-bottom: 1px solid var(--shadow-color);
        flex-wrap: nowrap;
        gap: 4px;
    }

    #user-info {
        flex-wrap: nowrap;
        gap: 4px;
        flex-shrink: 1;
        min-width: 0;
    }

    #user-display {
        max-width: 90px;
        padding: 4px 8px;
        font-size: 11px;
    }

    #logout-btn {
        padding: 4px 8px;
        font-size: 11px;
        white-space: nowrap;
    }

    #lang-select, #theme-toggle {
        padding: 4px 6px;
        font-size: 11px;
    }

    .main-layout-wrapper {
        flex-direction: column;
        height: calc(100% - 60px); /* Adjust based on header/nav height */
    }

    #map {
        height: 25vh; /* Fixed map height on mobile */
        min-height: 150px;
        width: 100%;
        flex: none;
        transition: none;
    }

    #map-resize-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 22px;
        width: 100%;
        flex-shrink: 0;
        background: var(--container-bg);
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -3px 10px var(--shadow-color);
        cursor: ns-resize;
        touch-action: none;
        z-index: 5;
        user-select: none;
    }

    .handle-bar {
        display: block;
        width: 44px;
        height: 5px;
        background: rgba(0, 0, 0, 0.18);
        border-radius: 3px;
    }

    [data-theme="dark"] .handle-bar {
        background: rgba(255, 255, 255, 0.2);
    }

    #ui-content-area {
        flex: 1;
        width: 100%;
        overflow-y: auto; /* Enable scroll for content area */
        padding: 15px 8px; /* Reduced side padding to widen content */
        background: var(--container-bg);
        border-top: 1px solid var(--shadow-color);
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
        z-index: 10;
    }

    #ui-content-area .container {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        padding: 5px 0; /* Reduced vertical padding */
        margin: 0;
        max-width: 100%;
    }

    .container {
        max-width: 100%;
        padding: 12px 10px; /* Reduced padding */
        margin-bottom: 8px;
    }

    .container h2 {
        margin-top: 5px;
        margin-bottom: 12px;
        font-size: 1.3rem;
    }

    .form-group {
        margin-bottom: 10px; /* Reduced vertical spacing */
    }

    .rating-grid {
        grid-template-columns: 1fr;
        gap: 0px; /* Reduced gap */
    }

    .stats-buttons {
        margin-bottom: 12px;
    }

    #stats-count-area {
        gap: 8px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .tour-input-group input,
    .tour-input-group textarea {
        width: auto;
        min-width: 0;
    }

    .add-tour-field-btn,
    .remove-tour-field-btn,
    .remove-entry-btn {
        min-height: 40px;
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    #add-entry-btn,
    #submit-btn {
        padding: 12px;
        font-size: 1rem;
    }

    .delete-single-btn {
        min-height: 36px;
        padding: 6px 14px;
    }

    .entry-divider {
        margin: 10px 0 8px; /* Reduced vertical margin */
    }

    #earth-overlay {
        flex-direction: column;
        justify-content: flex-end;
    }

    .earth-left-panel {
        position: absolute;
        inset: 0;
        height: 100%;
        justify-content: center;
        align-items: center;
        padding-top: 0;
        padding-bottom: 0;
        transition: padding-bottom 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .earth-left-panel.earth-panel-open {
        padding-bottom: 48vh;
    }

    #public-stats-panel {
        display: none;
    }

    .earth-img {
        width: min(65vw, 46vh);
    }

    .earth-right-panel {
        position: relative;
        z-index: 1;
        width: 100%;
        flex: none;
        max-height: 48vh;
        min-height: 38vh;
        border-left: none;
        border-top: none;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.35);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        transform: translateY(100%);
        transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .earth-right-panel::before {
        content: '';
        display: block;
        width: 44px;
        height: 5px;
        background: rgba(0, 0, 0, 0.18);
        border-radius: 3px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }

    [data-theme="dark"] .earth-right-panel::before {
        background: rgba(255, 255, 255, 0.25);
    }

    .earth-right-panel.earth-panel-open {
        transform: translateY(0);
    }

    /* Tap hint on earth */
    .earth-left-panel::after {
        content: attr(data-hint);
        position: absolute;
        bottom: 28px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.75);
        font-size: 0.85rem;
        font-weight: 600;
        letter-spacing: 0.03em;
        white-space: nowrap;
        pointer-events: none;
        animation: tap-hint-float 2.2s ease-in-out infinite;
    }

    .earth-left-panel.earth-panel-open::after {
        display: none;
    }

    @keyframes tap-hint-float {
        0%, 100% { opacity: 0.6; transform: translateX(-50%) translateY(0); }
        50% { opacity: 1; transform: translateX(-50%) translateY(-6px); }
    }

    #earth-overlay #auth-container {
        flex: 1;
        width: 100%;
        max-width: 100%;
        padding: 28px 24px 32px;
        box-sizing: border-box;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* New Modal Styles for Mobile (Bottom Sheet) */
    .modal {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        max-height: 50vh;
        margin-bottom: 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.9rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--text-color);
    background: var(--container-bg);
    color: var(--text-color);
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background-color: #673AB7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
    font-weight: bold;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 12px 0;
    color: var(--text-color);
    opacity: 0.5;
    font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid currentColor;
}
.auth-divider span {
    padding: 0 10px;
}

.google-btn {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s, box-shadow 0.2s;
    margin-bottom: 4px;
}
.google-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.rating-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

#add-entry-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--btn-bg);
    border: 2px dashed var(--btn-bg);
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
}

#add-entry-btn:hover {
    background: rgba(76, 175, 80, 0.08);
}

#submit-btn {
    width: 100%;
    padding: 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.95rem;
}

#submit-btn:hover {
    background: #1976D2;
}

.tour-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.tour-input-group input,
.tour-input-group textarea {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.95rem;
    line-height: 1.5;
    align-self: flex-start;
}

.add-tour-field-btn {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--btn-bg);
    color: var(--btn-bg);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.add-tour-field-btn:hover {
    background: rgba(76, 175, 80, 0.1);
}

.remove-tour-field-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #f44336;
    color: #f44336;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.remove-tour-field-btn:hover {
    background: rgba(244, 67, 54, 0.08);
}

.remove-entry-btn {
    display: block;
    margin-left: auto;
    margin-bottom: 8px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #f44336;
    color: #f44336;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-entry-btn:hover {
    background: rgba(244, 67, 54, 0.08);
}

.entry-divider {
    margin: 16px 0 8px;
    border: none;
    border-top: 1px dashed rgba(0,0,0,0.15);
}

/* Map Tabs */
.map-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 5;
    background-color: var(--bg-color);
    padding: 10px 0;
    margin-top: -10px;
}

.map-tabs button {
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid var(--text-color);
    background: var(--container-bg);
    color: var(--text-color);
    cursor: pointer;
}

.map-tabs button.active {
    background: var(--btn-bg);
    color: white;
    border-color: var(--btn-bg);
}

/* Stats Buttons (Segmented Control style) */
.stats-buttons {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px;
    border-radius: 30px;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

[data-theme="dark"] .stats-buttons {
    background: rgba(255, 255, 255, 0.1);
}

.stats-buttons button {
    padding: 8px 12px;
    border-radius: 25px;
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    flex: 1;
}

.stats-buttons button.active {
    background: var(--container-bg);
    color: var(--btn-bg);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .stats-buttons button.active {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.stats-buttons button:hover:not(.active) {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .stats-buttons button:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.modal-content {
    background: var(--container-bg);
    width: 90%;
    max-width: 450px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    max-height: 50vh;
}

.modal-header {
    padding: 6px 15px;
    background: #f44336;
    color: white;
    border-radius: 15px 15px 0 0;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: calc(0.82rem + 2pt);
    margin: 0;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: flex-end;
}

#close-modal-btn {
    padding: 8px 20px;
    background: #9e9e9e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

#close-modal-btn:hover {
    background: #757575;
}

.modal-entry-item {
    display: flex;
    list-style: none;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.07);
}

#modal-entry-list {
    padding: 0;
    margin: 0;
}

.contact-modal-content {
    max-height: 85vh;
}

.contact-modal-header {
    background: linear-gradient(45deg, #2196F3, #673AB7) !important;
}

#contact-send-btn {
    padding: 8px 20px;
    background: linear-gradient(45deg, #2196F3, #673AB7);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

#contact-send-btn:hover {
    opacity: 0.88;
}

.delete-single-btn {
    padding: 5px 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.delete-single-btn:hover {
    background: #d32f2f;
}

/* Stats Styles */
#stats-count-area {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    gap: 6px;
}

[data-theme="dark"] .stat-card {
    background: rgba(255, 255, 255, 0.05);
}

.stat-card.active {
    background: rgba(76, 175, 80, 0.08);
    border-color: var(--btn-bg);
}

[data-theme="dark"] .stat-card.active {
    background: rgba(56, 142, 60, 0.15);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.6;
    text-align: center;
    line-height: 1.3;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
}

.stat-card.active .stat-value {
    color: var(--btn-bg);
}

.country-stats-container {
    margin-top: 20px;
    text-align: left;
}

.country-stats-container h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.55;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .country-stats-container h3 {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.country-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.03);
    margin-bottom: 6px;
    border-radius: 10px;
    transition: background 0.2s;
}

[data-theme="dark"] .country-stat-item {
    background: rgba(255, 255, 255, 0.05);
}

.country-stat-name {
    font-size: 0.9rem;
    color: var(--text-color);
}

.country-stat-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--btn-bg);
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 9px;
    border-radius: 12px;
}

[data-theme="dark"] .country-stat-count {
    background: rgba(56, 142, 60, 0.2);
}

.toggle-auth {
    margin-top: 15px;
    font-size: 0.9rem;
}

.toggle-auth a {
    color: #673AB7;
    text-decoration: none;
    font-weight: bold;
}

.hidden { display: none !important; }

.country-flag {
    height: 16px;
    width: auto;
    vertical-align: middle;
    object-fit: contain;
}

/* Timeline Styles */
#timeline-list {
    position: relative;
    padding-left: 24px;
    text-align: left;
}

#timeline-list::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: rgba(76, 175, 80, 0.25);
}

.timeline-empty {
    text-align: center;
    opacity: 0.5;
    padding: 20px 0;
}

.timeline-item {
    position: relative;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--btn-bg);
    border: 2px solid var(--bg-color);
}

.timeline-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--btn-bg);
    margin-bottom: 4px;
}

.timeline-city {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 3px;
}

.timeline-tour {
    font-size: 0.82rem;
    color: var(--text-color);
    opacity: 0.6;
    line-height: 1.4;
}

[data-theme="dark"] .timeline-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] #timeline-list::before {
    background: rgba(56, 142, 60, 0.3);
}

/* Google Maps InfoWindow 상단 공백 제거 */
.gm-style-iw-c {
    padding: 0 !important;
}
.gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
}
.gm-style-iw-chr {
    display: none !important;
}
