/* ============================================
   여행 일정표 시스템 - 프론트 CSS
   .ts- 접두사 사용 (이윰빌더 독립)
   ============================================ */

:root {
    --ts-primary: #2c3e50;
    --ts-accent: #3498db;
    --ts-accent-dark: #2980b9;
    --ts-bg: #f8f9fa;
    --ts-border: #e0e0e0;
    --ts-text: #333333;
    --ts-text-light: #777777;
    --ts-white: #ffffff;
    --ts-success: #27ae60;
    --ts-warning: #f39c12;
    --ts-danger: #e74c3c;
    --ts-font: 'Noto Sans KR', '맑은 고딕', sans-serif;
    --ts-radius: 4px;
}

/* 툴바 (전체펼침/PDF) */
.ts-toolbar {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 12px;
}
.ts-btn {
    padding: 6px 14px;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    background: var(--ts-white);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--ts-text);
}
.ts-btn:hover { background: var(--ts-bg); }
.ts-btn:disabled { opacity: 0.5; cursor: wait; }
.ts-btn-expand { color: var(--ts-accent); border-color: var(--ts-accent); }
.ts-btn-expand:hover { background: var(--ts-accent); color: var(--ts-white); }
.ts-btn-pdf { color: var(--ts-danger); border-color: var(--ts-danger); }
.ts-btn-pdf:hover { background: var(--ts-danger); color: var(--ts-white); }

@media (max-width: 480px) {
    .ts-toolbar { justify-content: center; }
    .ts-btn { font-size: 12px; padding: 5px 10px; }
}

/* 전체 래퍼 */
.ts-wrap {
    font-family: var(--ts-font);
    color: var(--ts-text);
    max-width: 100%;
    margin: 30px 0;
    padding: 0;
    line-height: 1.6;
}

.ts-wrap * {
    box-sizing: border-box;
}

.ts-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--ts-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--ts-accent);
}

/* 출발일자 선택 영역 */
.ts-departure-selector {
    margin-bottom: 20px;
}

.ts-departure-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ts-departure-tab {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background: var(--ts-white);
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    text-align: center;
}

.ts-departure-tab:hover {
    border-color: var(--ts-accent);
    background: #eaf4fc;
}

.ts-departure-tab.active {
    border-color: var(--ts-accent);
    background: var(--ts-accent);
    color: var(--ts-white);
}

.ts-departure-tab .ts-tab-date {
    font-size: 14px;
    font-weight: 600;
}

.ts-departure-tab .ts-tab-price {
    font-size: 11px;
    margin-top: 2px;
    opacity: 0.8;
}

.ts-departure-tab.active .ts-tab-price {
    color: rgba(255, 255, 255, 0.9);
}

/* 항공편 정보 바 */
.ts-flight-info {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--ts-bg);
    padding: 12px 18px;
    border-radius: var(--ts-radius);
    border-left: 3px solid var(--ts-accent);
    margin-bottom: 20px;
    font-size: 13px;
}

.ts-flight-info .ts-fi-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ts-flight-info .ts-fi-label {
    color: var(--ts-text-light);
}

.ts-flight-info .ts-fi-value {
    font-weight: 600;
    color: var(--ts-primary);
}

/* 일정표 출력 영역 */
.ts-schedule-area {
    margin-top: 10px;
}

.ts-day-item {
    margin-bottom: 15px;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    overflow: hidden;
}

.ts-day-header {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    background: var(--ts-primary);
    color: var(--ts-white);
    cursor: pointer;
    transition: background 0.2s;
}

.ts-day-header:hover {
    background: #34495e;
}

.ts-day-toggle {
    margin-left: auto;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    position: relative;
}
.ts-day-toggle::after {
    content: '▲';
    font-size: 10px;
    color: rgba(255,255,255,0.6);
}
.ts-day-header.collapsed .ts-day-toggle::after {
    content: '▼';
}

.ts-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    margin-right: 12px;
    flex-shrink: 0;
}

.ts-day-date {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.85;
    margin-right: 10px;
    flex-shrink: 0;
}

.ts-day-title {
    font-size: 15px;
    font-weight: 600;
}

.ts-day-content {
    padding: 18px;
    background: var(--ts-white);
}

.ts-day-content .ts-day-desc {
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--ts-text);
}

.ts-day-content .ts-day-desc p {
    margin: 0 0 8px;
}

/* ─────────────────────────────
   여정 경로 (Privia 스타일)
   ───────────────────────────── */
.ts-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: linear-gradient(90deg, #eaf4fc 0%, #f8fbff 100%);
    border-left: 3px solid var(--ts-accent);
    border-radius: var(--ts-radius);
}
.ts-path-place {
    font-size: 14px;
    font-weight: 700;
    color: var(--ts-primary);
    padding: 2px 2px;
}
.ts-path-arrow {
    color: var(--ts-accent);
    font-size: 16px;
    font-weight: 700;
    user-select: none;
}

/* ─────────────────────────────
   교통편 + 시간 칩 스트립
   ───────────────────────────── */
.ts-trip-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    padding: 8px 0 12px;
    border-bottom: 1px dashed var(--ts-border);
}
.ts-trip-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ts-trip-label {
    flex: 0 0 38px;
    font-size: 11px;
    font-weight: 700;
    color: var(--ts-text-light);
    letter-spacing: 0.3px;
}
.ts-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ts-transport-chip {
    display: inline-block;
    padding: 3px 10px;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.ts-time-chip {
    display: inline-block;
    padding: 3px 10px;
    background: var(--ts-white);
    color: var(--ts-accent-dark);
    border: 1px solid var(--ts-accent);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────
   상세 활동 영역
   ───────────────────────────── */
.ts-activities {
    font-size: 14px;
    line-height: 1.75;
    color: var(--ts-text);
    margin-bottom: 14px;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.ts-activities p { margin: 0 0 8px; }
.ts-activities b, .ts-activities strong { color: var(--ts-primary); }
.ts-activities table {
    max-width: 100% !important;
    width: 100% !important;
    margin: 10px 0;
    border-collapse: collapse;
}
.ts-activities table td {
    padding: 8px 12px !important;
    font-size: 13px;
    line-height: 1.6;
}
.ts-activities img {
    max-width: 100%;
    height: auto;
}
.ts-activities br + br { display: none; } /* 연속 br 축소 */

/* ─────────────────────────────
   타임라인 (시간별 일정)
   ───────────────────────────── */
.ts-timeline {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    position: relative;
}
.ts-timeline::before {
    content: '';
    position: absolute;
    left: 42px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #e3edf7;
}
.ts-tl-item {
    position: relative;
    padding: 6px 0 10px 70px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--ts-text);
}
.ts-tl-item::before {
    content: '';
    position: absolute;
    left: 37px;
    top: 14px;
    width: 12px;
    height: 12px;
    background: var(--ts-accent);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--ts-accent);
}
.ts-tl-time {
    position: absolute;
    left: 0;
    top: 6px;
    display: inline-block;
    width: 52px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--ts-accent-dark);
    font-variant-numeric: tabular-nums;
    background: #fff;
    padding: 2px 0;
}
.ts-tl-body {
    display: block;
    color: var(--ts-text);
}
.ts-tl-body b, .ts-tl-body strong { color: var(--ts-primary); }
.ts-tl-body br + br { display: none; }
.ts-tl-body table {
    max-width: 100% !important;
    width: 100% !important;
    margin: 8px 0;
    border-collapse: collapse;
    font-size: 12.5px;
}
.ts-tl-body table td { padding: 6px 10px !important; }
.ts-tl-body img { max-width: 100%; height: auto; }

/* ─────────────────────────────
   활동 리스트 (시간 매칭 없는 항목)
   ───────────────────────────── */
.ts-acts {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
}
.ts-acts li {
    position: relative;
    padding: 4px 0 4px 18px;
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--ts-text);
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.ts-acts li::before {
    content: '•';
    position: absolute;
    left: 4px;
    top: 4px;
    color: var(--ts-accent);
    font-size: 14px;
    font-weight: 700;
}
.ts-acts li b, .ts-acts li strong { color: var(--ts-primary); }
.ts-acts li img { max-width: 100%; height: auto; }
.ts-acts li span[style*="color"] { /* 원본 인라인 컬러 유지 */ }

/* 정보 뱃지 */
.ts-info-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ts-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--ts-bg);
    border-radius: var(--ts-radius);
    font-size: 12px;
    color: var(--ts-text);
}

.ts-info-badge .ts-badge-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.ts-info-badge .ts-badge-label {
    color: var(--ts-text-light);
    font-size: 11px;
}

.ts-info-badge .ts-badge-value {
    font-weight: 500;
}

/* 관광지 카드 */
.ts-spots {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--ts-border);
}

.ts-spots-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ts-text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ts-spot-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.ts-spot-card {
    display: flex;
    gap: 12px;
    background: var(--ts-bg);
    border: 1px solid var(--ts-border);
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.ts-spot-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ts-spot-img {
    width: 120px;
    min-height: 100px;
    object-fit: cover;
    flex-shrink: 0;
}

/* 이미지 슬라이더 */
.ts-spot-slider {
    position: relative;
    width: 120px;
    min-height: 100px;
    flex-shrink: 0;
    overflow: hidden;
}
.ts-spot-slider-inner {
    position: relative;
    width: 100%;
    height: 100%;
}
.ts-spot-slide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    min-height: 100px;
}
.ts-spot-slide.active {
    display: block;
}
.ts-slide-prev,
.ts-slide-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    color: #fff;
    border: none;
    width: 22px;
    height: 22px;
    font-size: 12px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    z-index: 2;
}
.ts-slide-prev { left: 3px; }
.ts-slide-next { right: 3px; }
.ts-slide-prev:hover,
.ts-slide-next:hover {
    background: rgba(0,0,0,0.7);
}
.ts-slide-dots {
    position: absolute;
    bottom: 4px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 2;
}
.ts-slide-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    margin: 0 2px;
    cursor: pointer;
}
.ts-slide-dot.active {
    background: #fff;
}

.ts-spot-noimg {
    width: 120px;
    min-height: 100px;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 12px;
    flex-shrink: 0;
}

.ts-spot-info {
    padding: 10px 12px 10px 0;
    flex: 1;
    min-width: 0;
}

.ts-spot-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ts-primary);
    margin-bottom: 4px;
}

.ts-spot-region {
    font-size: 11px;
    color: var(--ts-accent);
    margin-bottom: 6px;
}

.ts-spot-desc {
    font-size: 12px;
    color: var(--ts-text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 상품요약정보 */
.ts-summary {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid var(--ts-primary);
}

.ts-summary-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ts-primary);
    margin-bottom: 15px;
}

.ts-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.ts-summary-card {
    background: var(--ts-white);
    border: 1px solid var(--ts-border);
    border-radius: 6px;
    padding: 14px 16px;
}

.ts-summary-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ts-accent);
    text-transform: uppercase;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.ts-summary-value {
    font-size: 14px;
    color: var(--ts-text);
    line-height: 1.7;
    white-space: pre-line;
}

/* 로딩 */
.ts-loading {
    text-align: center;
    padding: 40px;
    color: var(--ts-text-light);
    font-size: 14px;
}

.ts-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--ts-border);
    border-top-color: var(--ts-accent);
    border-radius: 50%;
    animation: ts-spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes ts-spin {
    to { transform: rotate(360deg); }
}

/* 빈 상태 */
.ts-empty {
    text-align: center;
    padding: 30px;
    color: var(--ts-text-light);
    font-size: 14px;
}

/* 반응형 */
@media (max-width: 768px) {
    .ts-departure-tabs {
        flex-direction: column;
    }

    .ts-departure-tab {
        flex-direction: row;
        justify-content: space-between;
        min-width: auto;
    }

    .ts-flight-info {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .ts-day-header {
        padding: 10px 14px;
    }

    .ts-day-number {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .ts-day-title {
        font-size: 14px;
    }

    .ts-day-content {
        padding: 14px;
    }

    .ts-info-badges {
        flex-direction: column;
    }

    .ts-path {
        padding: 8px 10px;
    }
    .ts-path-place { font-size: 13px; }
    .ts-trip-label { flex-basis: 34px; font-size: 10px; }
    .ts-transport-chip, .ts-time-chip { font-size: 11px; padding: 2px 8px; }
    .ts-activities { font-size: 13px; }

    .ts-spot-cards {
        grid-template-columns: 1fr;
    }

    .ts-summary-cards {
        grid-template-columns: 1fr;
    }

    .ts-spot-img, .ts-spot-noimg {
        width: 100px;
        min-height: 80px;
    }
}
