/* ═══════════════════════════════════════════════════════════════
   進階計算機 (Advance Calculator) - 獨立樣式表
   合併百岳與小百岳資料的多日行程規劃工具
   ═══════════════════════════════════════════════════════════════ */

/* ── 主容器 (Main Layout) ── */
.adv-calc-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 1.5rem;
    min-height: 85vh;
}

/* ── 左側面板 (Left Panel) ── */
.adv-left-panel {
    background: rgba(15, 20, 35, 0.92);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    overflow-y: auto;
    max-height: 90vh;
    scrollbar-width: thin;
    scrollbar-color: #8b5cf6 transparent;
}

.adv-left-panel::-webkit-scrollbar {
    width: 6px;
}

.adv-left-panel::-webkit-scrollbar-track {
    background: transparent;
}

.adv-left-panel::-webkit-scrollbar-thumb {
    background: #8b5cf6;
    border-radius: 3px;
}

/* ── 面板標題 (Panel Header) ── */
.adv-panel-header {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.1));
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.adv-panel-title {
    color: #8b5cf6;
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.adv-panel-subtitle {
    color: #94a3b8;
    font-size: 0.75rem;
    margin: 4px 0 0;
}

.adv-panel-body {
    padding: 1rem 1.2rem;
}

/* ── 欄位 (Fields) ── */
.adv-field {
    margin-bottom: 1rem;
}

.adv-field-label {
    display: block;
    color: #06b6d4;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

/* ── 下拉選單 (Select) ── */
.adv-select {
    width: 100%;
    padding: 10px 32px 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b5cf6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.adv-select:hover {
    border-color: #8b5cf6;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.adv-select:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.adv-select option {
    background: #1a1a2e;
    color: #e2e8f0;
}

.adv-select.adv-hidden {
    display: none;
}

/* ── 天數區段 (Day Section) ── */
.adv-day {
    margin-bottom: 0.6rem;
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(20, 25, 45, 0.8);
    transition: all 0.3s ease;
}

.adv-day:hover {
    border-color: rgba(139, 92, 246, 0.25);
}

.adv-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(6, 182, 212, 0.05));
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

.adv-day-header:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.1));
}

.adv-day-title {
    color: #f59e0b;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.adv-day-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.adv-day-toggle {
    color: #94a3b8;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.adv-day.open .adv-day-toggle {
    transform: rotate(180deg);
}

.adv-day-body {
    padding: 12px 14px;
    display: none;
}

.adv-day.open .adv-day-body {
    display: block;
}

.adv-peak-label {
    color: #94a3b8;
    font-size: 0.72rem;
    margin-bottom: 4px;
}

.adv-peak-select {
    margin-bottom: 6px;
    font-size: 0.8rem;
    padding: 8px 32px 8px 12px;
}

.adv-hut-label {
    color: #3b82f6;
    font-size: 0.72rem;
    font-weight: 600;
    margin: 8px 0 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(59, 130, 246, 0.15);
}

/* ── 按鈕 (Buttons) ── */
.adv-btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(139, 92, 246, 0.15);
}

.adv-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.adv-btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.adv-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.adv-btn-primary:active {
    transform: translateY(0);
}

.adv-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.adv-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* ── 右側面板 (Right Panel) ── */
.adv-right-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    max-width: 100%;
}

.adv-map-wrap {
    flex: 1;
    min-height: 500px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(139, 92, 246, 0.15);
    background: rgba(10, 12, 20, 0.95);
}

#adv-map {
    height: 100%;
    width: 100%;
    background: #0a0c14;
}

/* ── 行程統計 (Trip Summary) ── */
.adv-summary {
    background: rgba(15, 20, 35, 0.92);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    padding: 1.2rem;
    display: none;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.adv-summary.visible {
    display: block;
    animation: advFadeIn 0.4s ease;
}

.adv-summary-title {
    color: #10b981;
    font-size: 0.95rem;
    font-weight: 800;
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.adv-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 1rem;
}

.adv-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    word-break: break-word;
}

.adv-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: #8b5cf6;
}

.adv-stat-label {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 2px;
}

.adv-day-detail {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(139, 92, 246, 0.05);
    border-left: 3px solid #8b5cf6;
    border-radius: 0 6px 6px 0;
    font-size: 0.8rem;
    color: #e2e8f0;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
}

.adv-download-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
}

.adv-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* ── 動畫 (Animations) ── */
@keyframes advFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── 響應式 (Responsive) ── */
@media (max-width: 900px) {
    .adv-calc-layout {
        grid-template-columns: 1fr;
    }

    .adv-left-panel {
        max-height: 60vh;
    }

    .adv-map-wrap {
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    .adv-panel-body {
        padding: 0.8rem;
    }

    .adv-select {
        font-size: 0.8rem;
        padding: 8px 28px 8px 10px;
    }
}