/* --- routes.css (路線列表頁專用樣式) --- */
body.page-routes {
    padding-top: 60px; /* 為固定 header 留出空間 */
}

.routes-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--dark-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 100;
}

.routes-header h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 600;
    text-align: center;
}

.back-btn {
    width: auto;
    padding: 0 15px;
    font-size: 16px;
    text-decoration: none;
}

.header-placeholder {
    width: 85px; /* 與返回按鈕寬度相同，以確保標題居中 */
}

/* ==================== 核心修改：調整網格佈局以容納更多項目 ==================== */
#route-list-container {
    display: grid;
    /* 
     * auto-fit 比 auto-fill 在只有一行時的表現更好。
     * 減小最小寬度 (minmax) 至 40px，讓更多項目能放入一行。
     * 在 350px 寬度下，減去左右 padding 和 6 個 gap，大約能容納 7 個 40px 的項目。
     */
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 10px; /* 略微減小間距 */
    padding: 10px;
}
/* ============================================================================== */


/* ==================== 核心修改：將項目變為正方形並調整細節 ==================== */
.route-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background-color: var(--card-bg);
    font-weight: bold;
    position: relative;
    transition: background-color 0.2s ease, transform 0.1s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    
    /* 移除固定高度 */
    /* height: 60px; */ 

    /* 新增：關鍵屬性，讓元素保持 1:1 的長寬比 (正方形) */
    aspect-ratio: 1 / 1;

    /* 調整字體大小以適應較小的方塊 */
    font-size: 15px; 
    
    /* 稍微增加圓角半徑，使其看起來更圓潤 */
    border-radius: 12px;
}
/* ============================================================================== */

.route-item:active {
    transform: scale(0.95);
    background-color: #3a3a3c;
}

/* ==================== 核心修改：縮小圖標以匹配新的方塊尺寸 ==================== */
.route-change-icon {
    position: absolute;
    bottom: -5px; /* 微調位置 */
    right: -5px;  /* 微調位置 */
    width: 18px;   /* 縮小尺寸 */
    height: 18px;  /* 縮小尺寸 */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><g><path fill="%23FFFFFF" d="M38.1,80.7h23.8v7.8H38.1V80.7z M25.8,92.2h48.3v7.8H25.8V92.2z"/><path fill="%23FF453A" d="M48.2,0L19.4,77h61.2L48.2,0z M49.5,13.6l19,48.2H30.4L49.5,13.6z"/><path fill="%23FFFFFF" d="M34.3,24.8h31.3v7.8H34.3V24.8z M28.7,47.4h42.5v7.8H28.7V47.4z"/></g></svg>');
    background-size: contain;
}
/* ============================================================================== */

/* 根據公司 ID 設定顏色 */
.route-item.company-10001 { /* 新福利 */
    color: #4497e1;
}

.route-item.company-10002 { /* 澳巴 */
    color: #f39c12;
}

/* 預設/未知公司的顏色 */
.route-item.company-default {
    color: var(--highlight-color);
}