:root {
    --bg-color: #05070a;
    --glass-bg: rgba(26, 31, 43, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-primary: #00f2ff; /* Cyber Cyan */
    --accent-secondary: #ff007a; /* Neon Pink */
    --success-color: #39ff14;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

* {
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(0, 242, 255, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255, 0, 122, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    max-width: 500px;
    width: 100%;
    padding: 20px 15px 80px 15px; /* Extra bottom padding for sync bar */
}

header {
    text-align: center;
    padding: 20px 0;
}

h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 0;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

/* Tab Navigation - Segmented Control Style */
.tabs {
    display: flex;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
}

.tab-btn {
    flex: 1;
    padding: 10px 5px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-primary);
    box-shadow: inset 0 0 0 1px var(--glass-border);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Glass Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

h2::before {
    content: '';
    width: 3px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 2px;
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

input, select {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    transition: all 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 4px rgba(0, 242, 255, 0.1);
}

.custom-input {
    display: none;
    margin-top: 12px;
    border-color: var(--accent-secondary);
}

button {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

#submit-btn {
    background: linear-gradient(135deg, var(--accent-primary), #00a2ff);
    color: #05070a;
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.3);
    margin-top: 10px;
}

#submit-btn:active {
    transform: scale(0.97);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 14px;
    padding: 12px;
    margin-bottom: 10px;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Leaderboard Table */
.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.leaderboard-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 0 10px;
}

.leaderboard-table td {
    padding: 15px 10px;
    background: rgba(255, 255, 255, 0.03);
}

.leaderboard-table tr td:first-child { border-radius: 10px 0 0 10px; font-weight: 700; }
.leaderboard-table tr td:last-child { border-radius: 0 10px 10px 0; text-align: right; color: var(--accent-primary); }

/* Map Styling */
#map {
    height: 450px;
    width: 100%;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
}

/* Native Detail Sheet - High Performance */
.detail-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    border-radius: 25px 25px 0 0;
    padding: 25px;
    z-index: 3000;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0, 0, 0.2, 1);
    will-change: transform;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
}

.detail-sheet.active {
    transform: translateY(0);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.detail-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    color: var(--accent-primary);
}

.close-sheet {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: white;
}

.detail-meta {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.detail-img-container {
    width: 100%;
    max-height: 450px;
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.detail-img {
    max-width: 100%;
    max-height: 450px;
    display: block;
    object-fit: contain;
}

/* Custom Leaflet Popup Styling */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: rgba(15, 20, 30, 0.95) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: white !important;
    box-shadow: var(--card-shadow) !important;
}

.leaflet-popup-content {
    margin: 15px !important;
    width: auto !important;
}

.mini-popup {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 150px;
}

.popup-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--glass-border);
    background: #000;
}

.popup-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.popup-user {
    font-weight: 800;
    font-size: 14px;
    color: var(--accent-primary);
}

.popup-drink {
    font-size: 12px;
    color: var(--text-secondary);
}

.popup-link {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent-secondary);
    text-decoration: none;
    margin-top: 5px;
    display: block;
    cursor: pointer;
}

.leaflet-container {
    background: #05070a !important;
}

.popup-content {
    color: #333;
    font-size: 13px;
    line-height: 1.4;
}

.popup-img {
    width: 100%;
    border-radius: 8px;
    margin-top: 8px;
}

/* Sync Bar - The refined UX */
.sync-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 30px);
    max-width: 470px;
    background: rgba(15, 20, 30, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.3s;
}

.sync-bar:active {
    transform: translateX(-50%) scale(0.98);
}

.sync-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.sync-dot {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success-color);
}

.sync-dot.syncing {
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

.sync-btn-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-primary);
    font-weight: 800;
}

.status-msg {
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
}

.success-msg { color: var(--success-color); font-weight: 700; }
