:root {
    --color-red: #e94b3c;
    --color-blue: #0070bd;
    --color-green: #008659;
    --color-orange: #f7941d;
    --color-brown: #996633;
    --color-yellow: #ffd900;
    --color-primary: #2c3e50;
    --color-secondary: #3498db;
    --color-success: #27ae60;
    --color-warning: #f39c12;
    --color-danger: #e74c3c;
    --color-bg: #f5f7fa;
    --color-card: #ffffff;
    --color-border: #e1e8ed;
    --color-text: #2c3e50;
    --color-text-secondary: #7f8c8d;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    --transition-slow: all 0.5s ease;
}

/* 無障礙性 - 尊重使用者的動畫偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Apple LiGothic Medium', sans-serif;
    background: 
        linear-gradient(45deg, transparent 30%, rgba(0, 112, 189, 0.1) 30%, rgba(0, 112, 189, 0.1) 35%, transparent 35%),
        linear-gradient(-45deg, transparent 30%, rgba(0, 134, 89, 0.1) 30%, rgba(0, 134, 89, 0.1) 35%, transparent 35%),
        linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 25%, #e8f5e9 50%, #ffffff 75%, #e1f5fe 100%);
    background-size: 100px 100px, 100px 100px, 100% 100%;
    background-position: 0 0, 50px 50px, 0 0;
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--color-red) 0%, 
        var(--color-red) 14.28%, 
        var(--color-blue) 14.28%, 
        var(--color-blue) 28.56%, 
        var(--color-green) 28.56%, 
        var(--color-green) 42.84%, 
        var(--color-orange) 42.84%, 
        var(--color-orange) 57.12%, 
        var(--color-brown) 57.12%, 
        var(--color-brown) 71.4%, 
        var(--color-yellow) 71.4%, 
        var(--color-yellow) 85.68%,
        var(--color-red) 85.68%,
        var(--color-red) 100%
    );
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(90deg, 
            transparent 0px, 
            transparent 48px, 
            rgba(0, 112, 189, 0.03) 48px, 
            rgba(0, 112, 189, 0.03) 50px
        ),
        repeating-linear-gradient(0deg, 
            transparent 0px, 
            transparent 48px, 
            rgba(0, 134, 89, 0.03) 48px, 
            rgba(0, 134, 89, 0.03) 50px
        );
    pointer-events: none;
    z-index: 0;
}

/* API Banner */
.api-banner {
    background: linear-gradient(90deg, var(--color-warning) 0%, var(--color-danger) 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.3s ease;
}

.api-banner.hidden {
    display: none;
}

.api-banner.success {
    background: linear-gradient(90deg, var(--color-success) 0%, #27ae60 100%);
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.banner-btn {
    background: white;
    color: var(--color-warning);
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.banner-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header */
.header {
    background: #ffffff;
    padding: 30px 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border-bottom: 3px solid var(--color-blue);
    position: relative;
    overflow: hidden;
}

.header h1 {
    font-size: 3.5rem;
    background: linear-gradient(90deg, #0066CC 0%, #4cb1ec 20%, #058650 85%, #4cec4c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}
/* Header Paragraph */
.header p {
    color: var(--color-text-secondary); 
    font-size: 1.1rem;
}

/* Controls Section */
.controls-section {
    background: linear-gradient(to right, #ffffff 0%, #f0f9ff 100%);
    margin: 20px;
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--color-blue);
    position: relative;
    z-index: 1;
}

.smart-controls {
    max-width: 1200px;
    margin: 0 auto;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 0.9rem;
}

.control-input {
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background: white;
}

.control-input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.price-range-container {
    position: relative;
}

.price-range-slider {
    width: 100%;
    cursor: pointer;
}

.price-display {
    text-align: center;
    margin-top: 8px;
    color: var(--color-secondary);
    font-weight: 600;
}

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--color-border);
}

.filter-chip {
    padding: 8px 16px;
    background: var(--color-bg);
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-chip:hover {
    background: var(--color-secondary);
    color: white;
    transform: translateY(-2px);
}

.filter-chip.active {
    background: var(--color-secondary);
    color: white;
    border-color: var(--color-secondary);
}

/* Popular Stations */
.popular-section {
    margin: 0 20px 20px;
}

.popular-stations {
    background: linear-gradient(135deg, #ffffff 0%, #e8f5e9 100%);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--color-green);
    position: relative;
    z-index: 1;
}

.popular-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-danger);
}

.popular-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.popular-station {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--color-danger) 0%, var(--color-warning) 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.popular-station:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Main Container */
.main-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    padding: 0 20px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Sidebar */
.sidebar {
    background: linear-gradient(to bottom, #ffffff 0%, #f0f9ff 50%, #f1f8f4 100%);
    border-radius: var(--radius-lg);
    padding: 15px;
    height: fit-content;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 80px;
    border: 2px solid rgba(0, 112, 189, 0.1);
    z-index: 1;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--color-bg);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--color-secondary);
    border-radius: 10px;
}

.line-section {
    margin-bottom: 15px;
}

.line-header {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    transition: var(--transition);
}

.line-header:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.line-red { background: linear-gradient(135deg, var(--color-red) 0%, #c0392b 100%); }
.line-blue { background: linear-gradient(135deg, var(--color-blue) 0%, #0052a3 100%); }
.line-green { background: linear-gradient(135deg, var(--color-green) 0%, #006644 100%); }
.line-orange { background: linear-gradient(135deg, var(--color-orange) 0%, #e67e22 100%); }
.line-brown { background: linear-gradient(135deg, var(--color-brown) 0%, #795548 100%); }
.line-yellow { background: linear-gradient(135deg, var(--color-yellow) 0%, #f1c40f 100%); color: #333; }

.chevron {
    transition: var(--transition);
}

.line-header.active .chevron {
    transform: rotate(180deg);
}

.stations {
    display: none;
    padding: 10px 5px;
    animation: slideDown 0.3s ease;
}

.stations.show {
    display: block;
}

.station-item {
    width: 100%;
    padding: 10px 15px;
    margin: 4px 0;
    background: var(--color-bg);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

/* 紅線站點 hover 效果 */
.line-section:has(.line-red) .station-item:hover {
    background: #FF7575;
    color: white;
    transform: translateX(10px);
    border-left: 4px solid var(--color-red);
}

/* 藍線站點 hover 效果 */
.line-section:has(.line-blue) .station-item:hover {
    background: #66B3FF;
    color: white;
    transform: translateX(10px);
    border-left: 4px solid var(--color-blue);
}

/* 綠線站點 hover 效果 */
.line-section:has(.line-green) .station-item:hover {
    background: #66C299;
    color: white;
    transform: translateX(10px);
    border-left: 4px solid var(--color-green);
}

/* 橘線站點 hover 效果 */
.line-section:has(.line-orange) .station-item:hover {
    background: #FFB366;
    color: white;
    transform: translateX(10px);
    border-left: 4px solid var(--color-orange);
}

/* 棕線站點 hover 效果 */
.line-section:has(.line-brown) .station-item:hover {
    background: #C9A581;
    color: white;
    transform: translateX(10px);
    border-left: 4px solid var(--color-brown);
}

/* 黃線站點 hover 效果 */
.line-section:has(.line-yellow) .station-item:hover {
    background: #FFE566;
    color: #333;
    transform: translateX(10px);
    border-left: 4px solid var(--color-yellow);
}

.station-item.selected {
    background: var(--color-secondary);
    color: white;
    border-left: 4px solid var(--color-warning);
    font-weight: 600;
}

/* Content Area */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Map Section */
.map-section {
    background: linear-gradient(to right, #ffffff 0%, #e3f2fd 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border-top: 3px solid var(--color-blue);
    position: relative;
    z-index: 1;
}

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

.station-info h2 {
    color: var(--color-primary);
    font-size: 1.5rem;
}

.loading-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    color: var(--color-secondary);
    font-weight: 600;
    margin-top: 10px;
}

.loading-indicator.show {
    display: flex;
}

.search-stats {
    background: var(--color-bg);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.map-container {
    width: 100%;
    height: 500px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--color-bg);
}

/* Food Section */
.food-section {
    background: linear-gradient(to left, #ffffff 0%, #e8f5e9 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border-top: 3px solid var(--color-green);
    position: relative;
    z-index: 1;
}

.food-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-border);
}

.food-header h3 {
    color: var(--color-primary);
    font-size: 1.3rem;
}

.search-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--color-secondary) 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.search-btn:disabled {
    background: var(--color-text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Welcome Card */
.welcome-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 40px;
    background: 
        linear-gradient(135deg, transparent 25%, rgba(0, 112, 189, 0.03) 25%, rgba(0, 112, 189, 0.03) 50%, transparent 50%, transparent 75%, rgba(0, 134, 89, 0.03) 75%, rgba(0, 134, 89, 0.03)),
        linear-gradient(to right, #f8f9fa 0%, #e3f2fd 50%, #e8f5e9 100%);
    background-size: 40px 40px, 100% 100%;
    border-radius: var(--radius-lg);
    border: 3px solid rgba(0, 112, 189, 0.2);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        repeating-linear-gradient(45deg, 
            transparent 0px, 
            transparent 60px, 
            rgba(0, 112, 189, 0.02) 60px, 
            rgba(0, 112, 189, 0.02) 120px
        );
    animation: slideBackground 20s linear infinite;
    pointer-events: none;
}

@keyframes slideBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.welcome-icon {
    font-size: 4rem;
    background: linear-gradient(135deg, var(--color-blue) 0%, var(--color-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.welcome-card h3 {
    color: var(--color-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
    position: relative;
    z-index: 1;
}

.welcome-card p {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.features {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--color-blue) 0%, var(--color-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

.feature i {
    font-size: 2rem;
}

/* Food Card */
.food-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.food-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

/* 可點擊的卡片區域（不包含按鈕） */
.food-card-clickable {
    cursor: pointer;
    flex: 1;
}

.food-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--color-bg) 0%, #e0e0e0 100%);
}

.food-card-content {
    padding: 20px;
}

.food-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.food-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 5px;
}

.smart-score {
    background: linear-gradient(135deg, var(--color-warning) 0%, var(--color-danger) 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.food-card-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.meta-item i {
    color: var(--color-secondary);
    width: 16px;
}

.rating-stars {
    color: var(--color-warning);
}

.food-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.food-tag {
    padding: 4px 10px;
    background: var(--color-bg);
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.food-tag.price {
    background: var(--color-success);
    color: white;
}

.food-tag.open {
    background: var(--color-success);
    color: white;
}

.food-tag.closed {
    background: var(--color-danger);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 25px;
    border-bottom: 2px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--color-primary);
    font-size: 1.5rem;
}

.close-btn {
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--color-danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
}

.setup-steps ol {
    padding-left: 20px;
    line-height: 2;
}

.setup-steps code {
    background: var(--color-bg);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--color-danger);
    font-family: 'Courier New', monospace;
}

.api-help {
    margin-top: 25px;
    padding: 20px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.api-help a {
    color: var(--color-secondary);
    font-weight: 600;
}

.current-status {
    margin-top: 20px;
    padding: 15px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--color-secondary);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary {
    background: var(--color-text-secondary);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 250px 1fr;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: relative;
        top: 0;
        max-height: 400px;
    }
    
    .control-grid {
        grid-template-columns: 1fr;
    }
    
    .map-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .food-grid {
        grid-template-columns: 1fr;
    }
    
    .features {
        flex-direction: column;
        gap: 20px;
    }
}

/* ==========================================
   過場動畫載入畫面
   ========================================== */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-screen.hide {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    width: 90%;
}

.loading-logo {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-logo i {
    font-size: 4rem;
    color: #FFD700;
    animation: logoPulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
    }
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.logo-main {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.logo-sub {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
    letter-spacing: 1px;
}

.loading-animation {
    margin: 40px 0;
}

.train-track {
    position: relative;
    width: 300px;
    height: 60px;
    margin: 0 auto;
}

.track-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #666 0%, #999 50%, #666 100%);
    border-radius: 2px;
    transform: translateY(-50%);
}

.track-line::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 20px,
        rgba(255, 255, 255, 0.3) 20px,
        rgba(255, 255, 255, 0.3) 40px
    );
    animation: trackMove 2s linear infinite;
}

@keyframes trackMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(40px); }
}

.train-car {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 35px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    animation: trainMove 3s ease-in-out infinite;
}

.train-car i {
    color: white;
    font-size: 1.2rem;
    animation: trainShake 0.5s ease-in-out infinite alternate;
}

@keyframes trainMove {
    0%, 100% {
        left: 20%;
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        left: 80%;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes trainShake {
    0% { transform: translateX(-1px); }
    100% { transform: translateX(1px); }
}

.track-stations {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
}

.station-dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.station-dot.active {
    background: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    animation: stationGlow 1s ease-in-out infinite alternate;
}

@keyframes stationGlow {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    100% {
        transform: scale(1.2);
        box-shadow: 0 0 20px rgba(255, 215, 0, 1);
    }
}

.loading-text {
    margin: 30px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #FFD700;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
    border-radius: 2px;
    width: 0%;
    animation: progressFill 3s ease-out forwards;
}

@keyframes progressFill {
    0% { width: 0%; }
    70% { width: 90%; }
    100% { width: 100%; }
}

/* 載入畫面完成後的淡出動畫 */
.loading-screen.fade-out {
    animation: loadingFadeOut 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes loadingFadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}

/* 響應式調整 */
@media (max-width: 768px) {
    .loading-logo i {
        font-size: 3rem;
    }

    .logo-main {
        font-size: 1.5rem;
    }

    .logo-sub {
        font-size: 1rem;
    }

    .train-track {
        width: 250px;
        height: 50px;
    }

    .train-car {
        width: 40px;
        height: 28px;
    }

    .loading-text {
        font-size: 1rem;
    }
}

/* 骨架屏基礎樣式 */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #f8f8f8 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 美食卡片骨架屏 */
.food-card.skeleton {
    pointer-events: none;
    cursor: default;
}

.food-card.skeleton .food-card-image {
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
}

.food-card.skeleton .food-card-title,
.food-card.skeleton .meta-item,
.food-card.skeleton .food-tag {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #f8f8f8 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
    color: transparent;
    border-radius: 4px;
}

/* 載入 Spinner */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 102, 204, 0.1);
    border-top: 4px solid #0066CC;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-spinner.large {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 脈衝載入效果 */
.loading-pulse {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 波紋載入效果 */
.loading-ripple {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.loading-ripple div {
    position: absolute;
    border: 4px solid #0066CC;
    opacity: 1;
    border-radius: 50%;
    animation: ripple 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.loading-ripple div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes ripple {
    0% {
        top: 36px;
        left: 36px;
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        top: 0px;
        left: 0px;
        width: 72px;
        height: 72px;
        opacity: 0;
    }
}

/* 載入容器樣式 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 20px;
}

.loading-container .loading-text {
    color: var(--color-text-secondary);
    font-size: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

/* ==========================================
   視覺改善 - 平滑過渡效果
   ========================================== */

/* 淡入效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 從下往上滑入 */
.slide-up {
    animation: slideUpAnimation 0.5s ease-out;
}

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

/* 從左往右滑入 */
.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 縮放進入 */
.scale-in {
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 卡片進入動畫 - 交錯效果 */
.food-card {
    animation: cardEnter 0.5s ease-out backwards;
}

.food-card:nth-child(1) { animation-delay: 0.05s; }
.food-card:nth-child(2) { animation-delay: 0.1s; }
.food-card:nth-child(3) { animation-delay: 0.15s; }
.food-card:nth-child(4) { animation-delay: 0.2s; }
.food-card:nth-child(5) { animation-delay: 0.25s; }
.food-card:nth-child(6) { animation-delay: 0.3s; }
.food-card:nth-child(7) { animation-delay: 0.35s; }
.food-card:nth-child(8) { animation-delay: 0.4s; }
.food-card:nth-child(9) { animation-delay: 0.45s; }
.food-card:nth-child(10) { animation-delay: 0.5s; }
.food-card:nth-child(11) { animation-delay: 0.55s; }
.food-card:nth-child(12) { animation-delay: 0.6s; }

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

/* 平滑滾動 */
html {
    scroll-behavior: smooth;
}

/* 按鈕按下效果 */
button,
.btn,
.station-item,
.filter-chip,
.popular-station {
    transition: var(--transition);
    will-change: transform;
}

button:active,
.btn:active,
.station-item:active,
.filter-chip:active,
.popular-station:active {
    transform: scale(0.95);
}

/* ==========================================
   視覺改善 - 無障礙性改善
   ========================================== */

/* 鍵盤焦點樣式 */
*:focus {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 3px solid #0066CC;
    outline-offset: 3px;
    border-radius: 4px;
}

/* 高對比度模式支援 */
@media (prefers-contrast: high) {
    :root {
        --color-text: #000000;
        --color-bg: #ffffff;
        --color-border: #000000;
    }
    
    .food-card,
    .control-input,
    .station-item {
        border: 2px solid #000000;
    }
}

/* 跳過導航連結 (無障礙) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0066CC;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* 螢幕閱讀器專用文字 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 可見焦點指示器 */
.station-item:focus,
.filter-chip:focus,
.popular-station:focus {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);
    z-index: 1;
}

/* ARIA 即時區域樣式 */
[aria-live="polite"],
[aria-live="assertive"] {
    position: relative;
}

/* ==========================================
   視覺改善 - 互動回饋
   ========================================== */

/* Hover 發光效果 */
.food-card:hover {
    box-shadow: 
        0 8px 16px rgba(0,0,0,0.15),
        0 0 20px rgba(0, 102, 204, 0.1);
    transition: var(--transition);
}

/* 按鈕波紋效果 */
.btn,
.search-btn,
.banner-btn {
    position: relative;
    overflow: hidden;
}

.btn::after,
.search-btn::after,
.banner-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after,
.search-btn:active::after,
.banner-btn:active::after {
    width: 300px;
    height: 300px;
}

/* 成功提示動畫 */
.success-checkmark {
    display: inline-block;
    animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 錯誤震動效果 */
.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* 工具提示淡入 */
.tooltip {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tooltip.show {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================
   視覺改善 - 載入狀態優化
   ========================================== */

/* 按鈕載入狀態 */
.btn.loading,
.search-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::before,
.search-btn.loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 地圖載入覆蓋層 */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: fadeIn 0.3s ease;
}

/* 內容載入狀態 */
.content-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.5;
}

.content-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(0, 102, 204, 0.1);
    border-top-color: #0066CC;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 進度條 */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 102, 204, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066CC 0%, #009100 100%);
    transition: width 0.3s ease;
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* ==========================================
   視覺改善 - 響應式動畫調整
   ========================================== */

@media (max-width: 768px) {
    /* 移動裝置減少動畫複雜度 */
    .food-card {
        animation-duration: 0.3s;
    }
    
    .loading-ripple {
        width: 60px;
        height: 60px;
    }
    
    .food-card:hover {
        transform: translateY(-4px);
    }
}

/* 列印模式優化 */
@media print {
    .loading-spinner,
    .skeleton,
    .loading-container {
        display: none !important;
    }
    
    .food-card {
        animation: none !important;
        break-inside: avoid;
    }
}

/* ==========================================
   導航功能樣式
   ========================================== */

/* 美食卡片導航按鈕區域 */
.food-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.btn-navigate,
.btn-google-maps {
    flex: 1;
    padding: 12px 18px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.btn-navigate {
    background: linear-gradient(135deg, #0066CC 0%, #0052a3 100%);
    color: white;
}

.btn-navigate:hover {
    background: linear-gradient(135deg, #0052a3 0%, #003d7a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* 禁用狀態 */
.btn-navigate.btn-disabled {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-navigate.btn-disabled:hover {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    transform: none;
    box-shadow: none;
}

.btn-google-maps {
    background: linear-gradient(135deg, #34A853 0%, #2d8e47 100%);
    color: white;
}

.btn-google-maps:hover {
    background: linear-gradient(135deg, #2d8e47 0%, #26753c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.3);
}

.btn-navigate:active,
.btn-google-maps:active {
    transform: scale(0.95);
}

/* 路線資訊面板 */
.route-info-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    opacity: 0;
    transform: translateX(350px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.route-info-panel.show {
    opacity: 1;
    transform: translateX(0);
}

.route-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #0066CC 0%, #009100 100%);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.route-info-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-route-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-route-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.route-info-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.route-stat {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.route-stat i {
    font-size: 1.5rem;
    color: #0066CC;
    width: 30px;
    text-align: center;
}

.route-stat div {
    display: flex;
    flex-direction: column;
}

.route-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 2px;
}

.route-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
}

.route-actions {
    padding: 15px 20px 20px;
    display: flex;
    gap: 10px;
}

.btn-route-action {
    flex: 1;
    padding: 10px 16px;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: 20px;
    color: var(--color-primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-route-action:hover {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
    transform: translateY(-2px);
}

/* 地圖位置標記樣式優化 */
.gm-style .gm-style-iw-c {
    border-radius: var(--radius-md);
    padding: 12px;
}

.gm-style .gm-style-iw-d {
    overflow: auto !important;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .route-info-panel {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
    
    .food-card-actions {
        flex-direction: column;
    }
    
    .btn-navigate,
    .btn-google-maps {
        width: 100%;
    }
}

/* 無障礙性 - 按鈕焦點 */
.btn-navigate:focus,
.btn-google-maps:focus,
.btn-route-action:focus {
    outline: 3px solid rgba(0, 102, 204, 0.5);
    outline-offset: 2px;
}

/* 我的最愛按鈕 */
.favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    padding: 0;
}

.favorite-btn i {
    font-size: 18px;
    color: #ffffff;
    transition:
        transform 0.15s ease,
        color 0.15s ease,
        text-shadow 0.15s ease,
        background-color 0.15s ease;
}

.favorite-btn:hover i {
    transform: scale(1.1);
}

.favorite-btn.active i {
    color: #ff4b5c;
    text-shadow: 0 0 6px rgba(255, 75, 92, 0.8);
}

.favorite-btn:focus-visible {
    outline: 2px solid #ff4b5c;
    outline-offset: 2px;
}

#favoritesListBtn {
    margin-left: 8px;
    background: linear-gradient(135deg, #ff6b81 0%, #e84118 100%);
}
