/* ==========================================================================
   Kids Trip Korea - Open-Run & D-Day Calendar Stylesheet (css/calendar.css)
   ========================================================================== */

.calendar-container {
    max-width: 1100px;
    margin: 1rem auto 5rem auto;
    padding: 0 0.5rem;
    box-sizing: border-box;
    min-width: 0;
}

@media (min-width: 768px) {
    .calendar-container {
        padding: 0 1.25rem;
    }
}

/* Calendar Header & Mode Filter Bar */
.calendar-hero-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.calendar-hero-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.calendar-hero-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Booking Mode Tabs */
.booking-mode-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.booking-mode-tabs::-webkit-scrollbar {
    display: none;
}

.cal-mode-btn {
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cal-mode-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.cal-mode-btn.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2));
    border-color: var(--accent-amber);
    color: var(--accent-amber);
    font-weight: 700;
    box-shadow: 0 0 12px var(--accent-amber-glow);
}

/* Platform Filter Chips */
.platform-chips-scroll {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.platform-chips-scroll::-webkit-scrollbar {
    display: none;
}

.platform-chip {
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.platform-chip:hover {
    color: var(--text-primary);
}

.platform-chip.active {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--accent-blue);
    font-weight: 700;
}

/* Calendar Tabs Switcher (Timeline vs Monthly Grid) */
.view-tabs-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cal-view-switch-btns {
    display: inline-flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2px;
}

.cal-view-tab {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cal-view-tab.active {
    background: var(--bg-card-hover);
    color: var(--accent-emerald);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   D-Day Timeline View
   -------------------------------------------------------------------------- */
.timeline-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.timeline-group {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.timeline-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.timeline-group-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.timeline-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .timeline-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.timeline-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.timeline-card:hover {
    border-color: var(--accent-amber);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.timeline-actions {
    cursor: default;
}

.timeline-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.timeline-time-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: var(--radius-xs);
}

.timeline-time-badge.first-come {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.timeline-time-badge.lottery {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.timeline-place-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

.timeline-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.timeline-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}

/* --------------------------------------------------------------------------
   Monthly Calendar Grid View
   -------------------------------------------------------------------------- */
.monthly-calendar-wrapper {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.calendar-month-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.month-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.btn-month-nav {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-month-nav:hover {
    background: var(--bg-card-hover);
}

/* Calendar Table Grid */
.calendar-grid-table {
    width: 100%;
    border-collapse: collapse;
}

.calendar-grid-table th {
    padding: 0.6rem 0.4rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.calendar-grid-table th.sun { color: var(--accent-rose); }
.calendar-grid-table th.sat { color: var(--accent-blue); }

.calendar-day-cell {
    height: 90px;
    border: 1px solid var(--border-color);
    vertical-align: top;
    padding: 4px 6px;
    background: var(--bg-primary);
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (max-width: 640px) {
    .calendar-day-cell {
        height: 70px;
        padding: 3px;
    }
}

.calendar-day-cell:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
}

.calendar-day-cell.other-month {
    opacity: 0.25;
    pointer-events: none;
}

.calendar-day-cell.today {
    border: 2px solid var(--accent-emerald);
    background: rgba(16, 185, 129, 0.05);
}

.day-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.calendar-day-cell.today .day-number {
    color: var(--accent-emerald);
}

.day-open-badge {
    display: block;
    margin-top: 4px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: var(--radius-xs);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-open-badge.lottery {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border-color: rgba(245, 158, 11, 0.3);
}

/* Day Detail Modal Sheet */
.day-detail-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 80vh;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 2500;
    padding: 1.25rem;
    padding-bottom: calc(1.25rem + var(--safe-bottom));
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    animation: drawerSlideUp 0.25s ease-out;
}

.day-detail-sheet.open {
    display: flex;
}
