/* CSS Variables */
:root {
    --yb-yellow: #F3C800;
    --yb-dark: #2D3436;
    --bg-color: #F2F4F8;
    --card-radius: 20px;
    --nav-height: 90px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
    color: var(--yb-dark);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* App Container */
.app-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Header - Glassmorphism */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    position: relative;
    min-height: 48px;
}

/* Hamburger Menu Button */
.menu-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    color: var(--yb-dark);
    transition: background 0.2s;
}

.menu-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.menu-toggle:active {
    background: rgba(0, 0, 0, 0.08);
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2.5px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.25s;
}

/* Location Button */
#location-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 24px;
    border: none;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(33, 150, 243, 0.35);
    background: linear-gradient(135deg, #42A5F5 0%, #1E88E5 100%);
    color: #fff;
}

#location-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.45);
}

#location-btn:active {
    transform: translateY(0);
}

#location-btn.active {
    background: linear-gradient(135deg, #66BB6A 0%, #43A047 100%);
    box-shadow: 0 4px 14px rgba(67, 160, 71, 0.4);
}

/* Layer Drawer */
.layer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.layer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.layer-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 85vw);
    background: #fff;
    z-index: 2600;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    padding: 60px 0 24px;
    overflow-y: auto;
}

.layer-drawer.open {
    transform: translateX(0);
}

.layer-drawer h6 {
    padding: 8px 20px 12px;
    color: #888;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.layer-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    color: #333;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.layer-option:hover {
    background: #f5f5f5;
}

.layer-option.active {
    background: rgba(243, 200, 0, 0.12);
    border-left-color: var(--yb-yellow);
    font-weight: 700;
    color: var(--yb-dark);
}

.layer-option i {
    font-size: 1.25rem;
    color: #666;
}

.layer-option.active i {
    color: var(--yb-yellow);
}

/* Content Areas */
main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.content-area {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(var(--nav-height) + 20px + env(safe-area-inset-bottom));
    background: var(--bg-color);
    display: none;
}

.content-area.active {
    display: block;
}

#view-map {
    padding-bottom: 0;
    overflow: hidden;
}

/* Home Page */
.greeting {
    padding: 24px 20px 16px;
    text-align: center;
}

.greeting h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--yb-dark);
}

.greeting p {
    font-size: 0.9rem;
    color: #666;
}

.quick-access {
    display: flex;
    gap: 12px;
    padding: 0 20px 20px;
}

.quick-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: #fff;
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.quick-btn:active {
    transform: scale(0.95);
}

.quick-btn i {
    font-size: 2rem;
    color: var(--yb-yellow);
}

.quick-btn span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--yb-dark);
}

.section-title {
    padding: 20px 20px 10px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-container {
    padding: 0 16px;
}

.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 0.9rem;
}

/* Station Card */
.station-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.station-card:active {
    transform: scale(0.98);
}

.station-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #333;
    padding-right: 40px;
}

.station-meta {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 12px;
}

.badge-row {
    display: flex;
    gap: 8px;
}

.badge {
    flex: 1;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 8px;
    text-align: center;
}

.badge.yellow {
    background: rgba(243, 200, 0, 0.15);
}

.badge-num {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
}

.badge-label {
    font-size: 0.7rem;
    color: #666;
    margin-top: 4px;
}

.pin-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #ddd;
    padding: 5px;
    cursor: pointer;
    transition: color 0.2s;
}

.pin-btn.active {
    color: var(--yb-yellow);
}

/* Info Page */
.info-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    padding: 20px;
    margin: 16px;
}

.info-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--yb-dark);
}

.info-card p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 8px;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    font-size: 0.9rem;
    line-height: 1.8;
    color: #666;
    padding-left: 0;
}

.info-card li strong {
    color: var(--yb-dark);
}

/* Map */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-marker {
    background: #fff;
    border: 3px solid #666;
    border-radius: 50%;
    text-align: center;
    width: 36px;
    height: 36px;
    line-height: 30px;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    color: #333;
}

.marker-green {
    border-color: #2ecc71;
    color: #2ecc71;
}

.marker-orange {
    border-color: #f39c12;
    color: #f39c12;
}

.marker-red {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #ffebeb;
}

.marker-ebike::after {
    content: "⚡";
    position: absolute;
    right: -6px;
    top: -8px;
    font-size: 12px;
    color: var(--yb-yellow);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Settings Page */
.settings-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    padding: 20px;
    margin: 16px;
}

.settings-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--yb-dark);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 28px;
    background: #ccc;
    border-radius: 14px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-label input:checked + .toggle-slider {
    background: var(--yb-yellow);
}

.toggle-label input:checked + .toggle-slider::after {
    transform: translateX(22px);
}

#default-layer-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}

.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--yb-dark);
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--yb-yellow);
    color: var(--yb-dark);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* FAB (Floating Action Button) */
.fab {
    position: fixed;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--yb-dark);
    color: var(--yb-yellow);
    border: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 1500;
}

.fab:active {
    transform: scale(0.9);
}

.refresh-fab {
    bottom: calc(110px + env(safe-area-inset-bottom));
    right: 24px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.refresh-fab.hide {
    transform: scale(0);
    pointer-events: none;
}

.map-recenter-btn {
    bottom: calc(110px + env(safe-area-inset-bottom));
    right: 24px;
}

/* Bottom Navigation - Glassmorphism */
.nav-bottom {
    position: fixed;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    display: flex;
    justify-content: space-around;
    padding: 15px 0;
    z-index: 2000;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border-radius: 50px;
    isolation: isolate;
    overflow: hidden;
}

/* Liquid Glass Highlight */
#nav-highlight {
    position: absolute;
    top: 0;
    left: 0;
    height: 0;
    width: 0;
    border-radius: 999px;
    pointer-events: none;
    z-index: 0;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    will-change: left, top, width, height;
    transition: left 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                top 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                height 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#nav-highlight::before {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: inherit;
    background: radial-gradient(120% 160% at 28% 18%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 60%),
                radial-gradient(120% 160% at 72% 85%, rgba(243, 200, 0, 0.18), rgba(243, 200, 0, 0) 62%);
    opacity: 0.95;
}

#nav-highlight::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(243, 200, 0, 0.16), inset 0 -10px 20px rgba(0, 0, 0, 0.06);
    opacity: 0.9;
}

.nav-item {
    text-align: center;
    color: #aaa;
    font-size: 0.75rem;
    cursor: pointer;
    flex: 1;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 8px;
}

.nav-item.active {
    color: var(--yb-dark);
    font-weight: 800;
    transform: translateY(-2px);
}

.nav-item i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 6px;
}

/* Slide-up Card */
.slide-up-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.slide-up-overlay.open {
    opacity: 1;
    visibility: visible;
}

.slide-up-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 3001;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    max-height: 70vh;
    overflow-y: auto;
}

.slide-up-card.open {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: #666;
}

#slide-up-content h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--yb-dark);
}

#slide-up-content p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 8px;
}

#slide-up-content a {
    color: #1E88E5;
    text-decoration: none;
}

.nav-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.nav-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s;
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn.google {
    background: #4285F4;
    color: #fff;
}

.nav-btn.apple {
    background: #000;
    color: #fff;
}

/* Responsive */
@media (min-width: 768px) {
    .nav-bottom {
        max-width: 400px;
    }
    
    .station-card {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Focus States for Accessibility */
button:focus-visible,
.nav-item:focus-visible {
    outline: 2px solid var(--yb-yellow);
    outline-offset: 2px;
}
