/* =========================================================
   JourneyXpress – Flight Price Calendar Widget
   MMT-style date picker with day-wise pricing overlay
   ========================================================= */

/* ── Trigger: show a tiny fare-loading dot while pre-fetching ── */
.jx-cal-trigger.jx-cal-fetching::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #1a56db;
    border-radius: 50%;
    margin-left: 6px;
    animation: jxCalPulse 1s ease-in-out infinite;
    flex-shrink: 0;
    align-self: center;
}
@keyframes jxCalPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%       { opacity: 1;   transform: scale(1.2); }
}

/* ── Calendar trigger button ── */
.jx-cal-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    text-align: left;
    color: #1a2340;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
    min-height: 48px;
}
.jx-cal-trigger:hover,
.jx-cal-trigger:focus {
    border-bottom-color: #1a56db;
}
.jx-cal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #888;
    width: 20px;
}
.jx-cal-icon svg {
    display: block;
    flex-shrink: 0;
}
.jx-cal-date-display {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.jx-cal-day-num {
    font-size: 24px;
    font-weight: 700;
    color: #1a2340;
    line-height: 1;
}
.jx-cal-mon-yr {
    font-size: 12px;
    color: #555;
    margin-top: 1px;
}
.jx-cal-dow {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.jx-cal-placeholder {
    color: #999;
    font-size: 14px;
}

/* ── Calendar overlay ── */
.jx-cal-overlay {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1200;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(26,35,64,0.18);
    padding: 12px;
    min-width: 320px;
    width: 340px;
    animation: jxCalFadeIn 0.15s ease;
    /* Prevent clipping on right side */
    right: auto;
}
@media (max-width: 480px) {
    .jx-cal-overlay {
        width: 300px;
        min-width: unset;
        left: 50%;
        transform: translateX(-50%);
    }
}
@keyframes jxCalFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.jx-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 4px;
}
.jx-cal-title {
    font-weight: 700;
    font-size: 15px;
    color: #1a2340;
    letter-spacing: 0.01em;
}
.jx-cal-nav {
    background: none;
    border: 1px solid #e0e7ef;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #1a56db;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}
.jx-cal-nav:hover {
    background: #eef3ff;
    border-color: #1a56db;
}

/* ── Grid ── */
.jx-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

/* ── Day-header cells ── */
.jx-cal-cell.jx-cal-head {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Blank padding cells ── */
.jx-cal-cell.jx-cal-blank {
    background: transparent;
}

/* ── Day cells ── */
.jx-cal-cell.jx-cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 2px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    min-height: 42px;
    user-select: none;
}
.jx-cal-cell.jx-cal-day:hover:not(.jx-cal-past) {
    background: #eef3ff;
}
.jx-cal-cell.jx-cal-today .jx-cal-num {
    color: #1a56db;
    font-weight: 700;
}
.jx-cal-cell.jx-cal-today {
    border: 1px solid #1a56db;
}

/* ── Selected day ── */
.jx-cal-cell.jx-cal-selected,
.jx-cal-cell.jx-cal-selected:hover {
    background: #1a56db;
    border-color: #1a56db;
}
.jx-cal-cell.jx-cal-selected .jx-cal-num,
.jx-cal-cell.jx-cal-selected .jx-cal-price {
    color: #fff !important;
}

/* ── Past / disabled days ── */
.jx-cal-cell.jx-cal-past {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Day number ── */
.jx-cal-num {
    font-size: 14px;
    font-weight: 600;
    color: #1a2340;
    line-height: 1;
}

/* ── Price tag ── */
.jx-cal-price {
    font-size: 9.5px;
    color: #555;
    margin-top: 2px;
    line-height: 1;
    white-space: nowrap;
    font-weight: 500;
}
.jx-cal-price--cheap {
    color: #0a7c4a;
    font-weight: 700;
}
.jx-cal-price--loading {
    display: inline-block;
    width: 22px;
    height: 7px;
    background: linear-gradient(90deg, #e0e7ef 25%, #c8d4e8 50%, #e0e7ef 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: jxCalShimmer 1.2s infinite;
    margin-top: 3px;
}
@keyframes jxCalShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Banner (status row below header) ── */
.jx-cal-banner {
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}
.jx-cal-banner--info   { background: #f0f4ff; color: #3b5bdb; }
.jx-cal-banner--warn   { background: #fff8e1; color: #856404; }
.jx-cal-banner--ok     { background: #f0fdf4; color: #166534; }
.jx-cal-banner--loading { background: #f5f7ff; color: #555; }

/* Loading spinner for banner */
.jx-cal-spin {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid #c5c5c5;
    border-top-color: #1a56db;
    border-radius: 50%;
    animation: jxCalRotate 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes jxCalRotate {
    to { transform: rotate(360deg); }
}

/* ── Cheapest day highlight ── */
.jx-cal-cell.jx-cal-cheap:not(.jx-cal-selected) {
    background: #f0fdf6;
}
.jx-cal-cell.jx-cal-cheap:not(.jx-cal-selected):hover {
    background: #d4f5e3;
}

/* ── Ensure parent is position:relative for overlay positioning ── */
.jx-field--date {
    position: relative;
}
