/**
 * Trip Planner - Map Page Styles
 * 地圖頁面專用樣式
 */

/* ========================================
   Header
   ======================================== */
header {
    background: linear-gradient(135deg, #1a5f7a 0%, #2d8659 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
}

header p {
    opacity: 0.9;
    font-size: 0.95em;
}

.version-info {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.75em;
    opacity: 0.8;
}

/* ========================================
   Main Content Layout
   ======================================== */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.sidebar-header {
    background: #1a5f7a;
    color: white;
    padding: 15px;
    font-weight: bold;
}

.day-list {
    max-height: 600px;
    overflow-y: auto;
}

.day-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.day-item:hover {
    background: #f0f7ff;
}

.day-item.active {
    background: #e3f2fd;
    border-left: 4px solid #1a5f7a;
}

/* Day Header - 日期與狀態同一行 */
.day-item .day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.day-item .day-number {
    font-weight: bold;
    color: #1a5f7a;
    font-size: 0.85em;
}

.day-item .day-title {
    font-size: 0.95em;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 2px;
}

.day-item .day-detail {
    font-size: 0.8em;
    color: #666;
    line-height: 1.3;
}

.day-item .status {
    display: inline-block;
    font-size: 0.65em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Day Type styling */
.day-item.travel {
    border-left: 4px solid #1976d2;
    background: #f3f8ff;
}

.day-item.transit {
    border-left: 4px solid #f57c00;
    background: #fffaf5;
}

.day-item.rest {
    border-left: 4px solid #c2185b;
    background: #fef5f8;
}

.day-item.travel.active,
.day-item.transit.active,
.day-item.rest.active {
    background: #e3f2fd;
}

.day-type-icon {
    margin-right: 5px;
}

/* Detail Button - 統一按鈕樣式 */
.detail-btn {
    display: inline-block;
    padding: 4px 10px;
    background: #1a5f7a;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.7em;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
}

.detail-btn:hover {
    background: #145a6e;
    transform: translateY(-1px);
}

/* 住宿資訊按鈕 - 綠色樣式 */
.detail-btn.btn-accommodation {
    background: #27ae60;
}

.detail-btn.btn-accommodation:hover {
    background: #219a52;
}

/* ========================================
   Map Container
   ======================================== */
.map-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.map-header {
    background: #2d8659;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-header h3 {
    font-size: 1.1em;
}

#map {
    width: 100%;
    height: 550px;
}

/* ========================================
   Route Buttons
   ======================================== */
.route-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 15px;
    background: #f5f5f5;
}

.route-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
    background: white;
    color: #333;
    border: 1px solid #ddd;
}

.route-btn:hover {
    background: #1a5f7a;
    color: white;
    border-color: #1a5f7a;
}

.route-btn.active {
    background: #1a5f7a;
    color: white;
    border-color: #1a5f7a;
}

.external-link {
    display: inline-block;
    margin-left: auto;
    padding: 8px 16px;
    background: #1a5f7a;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.85em;
    transition: background 0.2s;
}

.external-link:hover {
    background: #145a6e;
}

/* ========================================
   Info Cards
   ======================================== */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.info-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-card h4 {
    color: #1a5f7a;
    margin-bottom: 10px;
    font-size: 1em;
}

.info-card ul {
    list-style: none;
    font-size: 0.9em;
}

.info-card li {
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-card li:last-child {
    border-bottom: none;
}

/* ========================================
   Legend
   ======================================== */
.legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Default legend colors (can be overridden by JS) */
.legend-dot.start {
    background: #4CAF50;
}

.legend-dot.lake {
    background: #2196F3;
}

.legend-dot.mountain {
    background: #795548;
}

.legend-dot.town {
    background: #FF9800;
}

.legend-dot.glacier {
    background: #00BCD4;
}

/* ========================================
   Leaflet Popup
   ======================================== */
.leaflet-popup-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.leaflet-popup-content h4 {
    margin: 0 0 5px 0;
    color: #1a5f7a;
}

.leaflet-popup-content p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

/* ========================================
   Flight Card (for modal)
   ======================================== */
.flight-card {
    background: #f8f9fa;
    border: 1px solid #e3f2fd;
    border-left: 4px solid #1976d2;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.flight-card .flight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.flight-card .flight-no {
    font-weight: 700;
    color: #1976d2;
    font-size: 1.1rem;
}

.flight-card .airline {
    color: #666;
}

.flight-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
}

.flight-route .airport {
    text-align: center;
}

.flight-route .airport-code {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
}

.flight-route .airport-name {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.flight-route .arrow {
    font-size: 2rem;
    color: #1976d2;
}

.flight-times {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.flight-times .time {
    font-weight: 600;
}

.flight-times .duration {
    background: #e3f2fd;
    padding: 3px 10px;
    border-radius: 12px;
    color: #1976d2;
}

/* ========================================
   Timezone & Checklist
   ======================================== */
.timezone-box {
    background: #fff8e1;
    border-left: 4px solid #f57c00;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
}

.timezone-box strong {
    color: #f57c00;
}

.checklist-box {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.checklist-box ul {
    list-style: none;
    padding: 0;
}

.checklist-box li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checklist-box li:last-child {
    border-bottom: none;
}

.checklist-box li::before {
    content: '☐';
    color: #1976d2;
}

/* ========================================
   Status Badge (for attractions table)
   ======================================== */
.status-badge.ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.warn {
    background: #fff3e0;
    color: #ef6c00;
}

.status-badge.no {
    background: #ffebee;
    color: #c62828;
}

/* ========================================
   Day Item Buttons
   ======================================== */
.day-item-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* ========================================
   Accommodation Card (Modal)
   ======================================== */
.accommodation-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.accommodation-header {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accommodation-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.accommodation-header .status {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
}

.accommodation-details {
    padding: 15px 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #666;
    font-size: 0.9em;
}

.detail-value {
    color: #2c3e50;
    font-size: 0.95em;
    text-align: right;
}

.highlight-row {
    background: #e8f5e9;
    margin: 0 -20px;
    padding: 12px 20px;
    border-bottom: none;
}

.confirmation-code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: 700;
    color: #27ae60;
    font-size: 1.1em;
    letter-spacing: 1px;
}

.cancel-row {
    background: #fff3e0;
    margin: 0 -20px;
    padding: 12px 20px;
    border-bottom: none;
}

.cancel-row .detail-value {
    color: #f57c00;
    font-weight: 600;
}

.accommodation-actions {
    padding: 15px 20px;
    text-align: center;
    border-top: 1px solid #eee;
}

.btn-map-link {
    display: inline-block;
    padding: 10px 20px;
    background: #1a5f7a;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9em;
    transition: background 0.2s;
}

.btn-map-link:hover {
    background: #145a6e;
}
