/* ============================================================================
   DEPARTURES WIDGET — choquequiraotrek.pe
   Reads from /api/departures.php (shared DB with WordPress plugin)
   Palette: navy #0e2547 · orange #ff7a1a · cream #f5f3ee
   ============================================================================ */

.cqt-departures {
    --cqt-navy: #0e2547;
    --cqt-navy-soft: #1a3458;
    --cqt-orange: #ff7a1a;
    --cqt-orange-dark: #d65f00;
    --cqt-cream: #f5f3ee;
    --cqt-cream-dark: #e8e3d6;
    --cqt-text: #1d2433;
    --cqt-text-muted: #6b7280;
    --cqt-border: #e5e7eb;
    --cqt-wa: #25d366;
    --cqt-wa-dark: #128c7e;
    --cqt-green: #27AE60;
    --cqt-orange-status: #E67E22;
    --cqt-gray: #95A5A6;
    --cqt-red: #C0392B;
    --cqt-radius: 14px;
    --cqt-radius-sm: 8px;
    --cqt-color: var(--cqt-navy); /* overridden per tab */

    font-family: inherit;
    color: var(--cqt-text);
    line-height: 1.5;
    margin: 32px 0;
}

.cqt-departures *,
.cqt-departures *::before,
.cqt-departures *::after { box-sizing: border-box; }

/* ===========================================================================
   HEADER WITH LANGUAGE TOGGLE
   =========================================================================== */
.cqt-dep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}
.cqt-dep-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--cqt-navy);
}
.cqt-dep-subtitle {
    font-size: 14px;
    color: var(--cqt-text-muted);
    margin: 4px 0 0 0;
}
.cqt-lang-toggle {
    display: inline-flex;
    background: var(--cqt-cream);
    border-radius: 8px;
    padding: 4px;
    gap: 2px;
}
.cqt-lang-btn {
    background: transparent;
    border: 0;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--cqt-text-muted);
    font-family: inherit;
    transition: all 0.2s;
}
.cqt-lang-btn.is-active {
    background: var(--cqt-navy);
    color: #fff;
}
.cqt-lang-btn:not(.is-active):hover {
    color: var(--cqt-navy);
}

/* ===========================================================================
   LOADING / EMPTY / ERROR STATES
   =========================================================================== */
.cqt-dep-loading,
.cqt-dep-empty,
.cqt-dep-error {
    background: var(--cqt-cream);
    border-radius: var(--cqt-radius);
    padding: 32px 20px;
    text-align: center;
    color: var(--cqt-text-muted);
}
.cqt-dep-error {
    background: #fff5f0;
    color: #8b3a00;
    border: 1px solid #ffd4b8;
}
.cqt-dep-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    border: 2px solid var(--cqt-orange);
    border-top-color: transparent;
    border-radius: 50%;
    animation: cqt-spin 0.8s linear infinite;
    vertical-align: middle;
}
@keyframes cqt-spin { to { transform: rotate(360deg); } }

/* ===========================================================================
   TABS: TREK SELECTOR (top, big)
   =========================================================================== */
.cqt-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.cqt-tab {
    background: #fff;
    border: 2px solid var(--cqt-border);
    border-radius: var(--cqt-radius);
    padding: 16px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    transition: all 0.2s;
    color: var(--cqt-text);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    width: 100%;
}
.cqt-tab:hover {
    border-color: var(--cqt-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.cqt-tab.is-active {
    background: var(--cqt-color);
    border-color: var(--cqt-color);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.cqt-tab-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}
.cqt-tab.is-active .cqt-tab-icon {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.cqt-tab-text { display: flex; flex-direction: column; }
.cqt-tab-title { font-weight: 700; font-size: 15px; }
.cqt-tab-sub {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

/* ===========================================================================
   PANEL (one per trek)
   =========================================================================== */
.cqt-panel { display: none; }
.cqt-panel.is-active { display: block; }

/* ===========================================================================
   MONTH FILTER PILLS
   =========================================================================== */
.cqt-months {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cqt-border);
}
.cqt-month-btn {
    background: #fff;
    border: 1px solid var(--cqt-border);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--cqt-text);
    font-family: inherit;
    transition: all 0.2s;
}
.cqt-month-btn:hover {
    border-color: var(--cqt-color);
}
.cqt-month-btn.is-active {
    background: var(--cqt-color);
    border-color: var(--cqt-color);
    color: #fff;
}
.cqt-month-btn .cqt-count {
    margin-left: 4px;
    opacity: 0.7;
    font-size: 11px;
    font-weight: 700;
}

/* ===========================================================================
   DEPARTURE CARDS
   =========================================================================== */
.cqt-month-group {
    margin-bottom: 28px;
}
.cqt-month-heading {
    font-size: 13px;
    font-weight: 700;
    color: var(--cqt-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 12px 0;
}
.cqt-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 700px) {
    .cqt-cards { grid-template-columns: 1fr 1fr; }
}

.cqt-card {
    background: #fff;
    border: 1px solid var(--cqt-border);
    border-left: 4px solid var(--cqt-color);
    border-radius: var(--cqt-radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s;
}
.cqt-card:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.cqt-card.is-not-bookable {
    opacity: 0.6;
    background: var(--cqt-cream);
}

.cqt-card-row1 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}
.cqt-card-date {
    font-weight: 700;
    color: var(--cqt-navy);
    font-size: 15px;
}
.cqt-card-range {
    font-size: 12px;
    color: var(--cqt-text-muted);
    margin-top: 2px;
}

.cqt-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    white-space: nowrap;
}

.cqt-card-message {
    font-size: 13px;
    color: var(--cqt-text);
    margin: 0;
}

.cqt-card-row3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--cqt-border);
}
.cqt-card-price {
    font-size: 14px;
    color: var(--cqt-text);
}
.cqt-card-price strong {
    font-size: 16px;
    color: var(--cqt-navy);
}
.cqt-card-price small {
    color: var(--cqt-text-muted);
    margin-left: 4px;
    font-weight: 400;
}

.cqt-btn-book {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--cqt-wa);
    color: #fff !important;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
    border: 0;
    cursor: pointer;
}
.cqt-btn-book:hover {
    background: var(--cqt-wa-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37,211,102,0.3);
}
.cqt-btn-book:disabled,
.cqt-btn-book.is-disabled {
    background: var(--cqt-gray);
    cursor: not-allowed;
    pointer-events: none;
}
.cqt-btn-book svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* ===========================================================================
   ALTERNATIVE DATE CTA (bottom of panel)
   =========================================================================== */
.cqt-alt-cta {
    background: var(--cqt-cream);
    border-radius: var(--cqt-radius);
    padding: 18px 20px;
    margin-top: 24px;
    text-align: center;
    border: 1px dashed var(--cqt-cream-dark);
}
.cqt-alt-cta p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--cqt-text);
}
.cqt-alt-cta strong {
    color: var(--cqt-navy);
}

/* ===========================================================================
   FOOTER NOTE
   =========================================================================== */
.cqt-dep-footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--cqt-border);
    font-size: 12px;
    color: var(--cqt-text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.cqt-dep-footer .cqt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.cqt-dep-footer .cqt-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.cqt-dep-footer .cqt-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

/* ===========================================================================
   MOBILE TWEAKS
   =========================================================================== */
@media (max-width: 600px) {
    .cqt-dep-header { flex-direction: column; align-items: stretch; }
    .cqt-tab { padding: 12px 14px; }
    .cqt-tab-icon { width: 38px; height: 38px; font-size: 16px; }
    .cqt-tab-title { font-size: 14px; }
    .cqt-card { padding: 12px 14px; }
    .cqt-card-row3 { flex-direction: column; align-items: stretch; }
    .cqt-btn-book { justify-content: center; }
}
