/* =========================================================
   Railway Events & Tickets — Calendar Styles
   ========================================================= */

:root {
    --ret-running:  #2e7d32;
    --ret-special:  #1565c0;
    --ret-cancel:   #b71c1c;
    --ret-today:    #f9a825;
    --ret-cell-bg:  #f5f5f5;
    --ret-border:   #e0e0e0;
    --ret-text:     #212121;
    --ret-muted:    #757575;
    --ret-radius:   6px;
}

/* Wrapper */
.ret-calendar {
    font-family: inherit;
    max-width: 900px;
    margin: 0 auto;
}

/* Nav */
.ret-calendar__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.ret-calendar__title {
    margin: 0;
    font-size: 1.5rem;
}

.ret-calendar__nav-btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: #fff;
    border: 1px solid var(--ret-border);
    border-radius: var(--ret-radius);
    text-decoration: none;
    color: var(--ret-text);
    font-size: 1.1rem;
    transition: background 0.15s;
}

.ret-calendar__nav-btn:hover {
    background: var(--ret-cell-bg);
    color: var(--ret-text);
    text-decoration: none;
}

/* Grid */
.ret-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.ret-calendar__day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ret-muted);
    padding: 0.4rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ret-calendar__cell {
    min-height: 72px;
    background: #fff;
    border: 1px solid var(--ret-border);
    border-radius: var(--ret-radius);
    padding: 6px 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: transform 0.1s, box-shadow 0.1s;
}

.ret-calendar__cell--empty {
    background: transparent;
    border-color: transparent;
}

/* Clickable days */
.ret-calendar__cell--active {
    cursor: pointer;
}

.ret-calendar__cell--active:hover,
.ret-calendar__cell--active:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    outline: 2px solid currentColor;
}

/* Running day */
.ret-calendar__cell--running_day {
    border-color: var(--ret-running);
    border-width: 2px;
}

.ret-calendar__cell--running_day .ret-calendar__day-label {
    color: var(--ret-running);
}

/* Special event */
.ret-calendar__cell--special_event {
    border-color: var(--ret-special);
    border-width: 2px;
    background: #e3f2fd;
}

.ret-calendar__cell--special_event .ret-calendar__day-label {
    color: var(--ret-special);
}

/* Cancelled */
.ret-calendar__cell--cancelled {
    background: #ffebee;
    border-color: var(--ret-cancel);
    opacity: 0.7;
    cursor: default;
}

.ret-calendar__cell--cancelled .ret-calendar__day-num {
    text-decoration: line-through;
    color: var(--ret-cancel);
}

/* Today */
.ret-calendar__cell--today .ret-calendar__day-num::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--ret-today);
    border-radius: 50%;
    margin: 2px auto 0;
}

.ret-calendar__day-num {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}

.ret-calendar__day-label {
    font-size: 0.7rem;
    margin-top: auto;
    line-height: 1.2;
    font-weight: 600;
}

/* Legend */
.ret-calendar__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.25rem;
    font-size: 0.85rem;
}

.ret-calendar__legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ret-calendar__legend-item::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 2px solid transparent;
}

.ret-calendar__legend-item--running_day::before  { border-color: var(--ret-running); }
.ret-calendar__legend-item--special_event::before { border-color: var(--ret-special); background: #e3f2fd; }
.ret-calendar__legend-item--cancelled::before     { border-color: var(--ret-cancel); background: #ffebee; }

/* =========================================================
   Ticket panel (slide-in from bottom on mobile, inline on desktop)
   ========================================================= */

.ret-ticket-panel {
    margin-top: 1.5rem;
    border: 1px solid var(--ret-border);
    border-radius: var(--ret-radius);
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
}

.ret-ticket-panel[hidden] {
    display: none;
}

.ret-ticket-panel__inner {
    padding: 1.5rem;
}

.ret-ticket-panel__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--ret-muted);
    line-height: 1;
    padding: 0.25rem 0.5rem;
}

.ret-ticket-panel__close:hover {
    color: var(--ret-text);
}

/* Ticket product cards */
.ret-ticket-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ret-ticket-product {
    border: 1px solid var(--ret-border);
    border-radius: var(--ret-radius);
    padding: 1rem;
    text-align: center;
}

.ret-ticket-product__name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ret-ticket-product__price {
    color: var(--ret-muted);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.ret-ticket-product__qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ret-ticket-product__qty input {
    width: 50px;
    text-align: center;
    border: 1px solid var(--ret-border);
    border-radius: 4px;
    padding: 0.3rem;
    font-size: 1rem;
}

.ret-add-to-cart {
    background: var(--ret-running);
    color: #fff;
    border: none;
    border-radius: var(--ret-radius);
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s;
}

.ret-add-to-cart:hover {
    background: #1b5e20;
}

.ret-add-to-cart:disabled {
    background: var(--ret-muted);
    cursor: not-allowed;
}

.ret-capacity-notice {
    font-size: 0.85rem;
    color: var(--ret-muted);
    margin-top: 0.5rem;
}

.ret-capacity-notice--low {
    color: #e65100;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
    .ret-calendar__grid {
        gap: 2px;
    }

    .ret-calendar__cell {
        min-height: 52px;
        padding: 4px;
    }

    .ret-calendar__day-label {
        display: none;
    }

    .ret-calendar__day-num {
        font-size: 0.85rem;
    }

    .ret-calendar__day-header {
        font-size: 0.7rem;
    }
}

/* =========================================================
   Slot picker
   ========================================================= */

.ret-section-title {
    margin: 1.25rem 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ret-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ret-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ret-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: #fff;
    border: 2px solid var(--ret-running);
    border-radius: var(--ret-radius);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    text-align: center;
}

.ret-slot:hover:not([disabled]) {
    background: #e8f5e9;
    transform: translateY(-2px);
}

.ret-slot--selected {
    background: var(--ret-running);
    color: #fff;
}

.ret-slot--selected .ret-slot__status {
    color: rgba(255,255,255,0.85);
}

.ret-slot--sold-out {
    border-color: var(--ret-border);
    color: var(--ret-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.ret-slot--low {
    border-color: #e65100;
}

.ret-slot--low .ret-slot__status {
    color: #e65100;
}

.ret-slot__time {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.ret-slot__label {
    font-size: 0.75rem;
    color: var(--ret-muted);
}

.ret-slot--selected .ret-slot__label {
    color: rgba(255,255,255,0.85);
}

.ret-slot__status {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

/* Chosen slot summary bar */
.ret-chosen-slot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: #e8f5e9;
    border: 1px solid var(--ret-running);
    border-radius: var(--ret-radius);
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.ret-back-to-slots {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ret-running);
    font-size: 0.85rem;
    padding: 0;
    text-decoration: underline;
    font-family: inherit;
}

.ret-back-to-slots:hover {
    color: #1b5e20;
}

.ret-loading {
    color: var(--ret-muted);
    font-style: italic;
}

.ret-cancelled-notice {
    color: var(--ret-cancel);
    font-weight: 600;
}

.ret-cancel-reason {
    color: var(--ret-muted);
    font-size: 0.9rem;
}

.ret-notice {
    padding: 0.75rem;
    border-radius: var(--ret-radius);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.ret-notice--error {
    background: #ffebee;
    color: var(--ret-cancel);
    border: 1px solid var(--ret-cancel);
}

/* =========================================================
   Ticket quantity table
   ========================================================= */

.ret-ticket-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 1rem;
}

.ret-ticket-row td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--ret-border);
    vertical-align: middle;
}

.ret-ticket-row__name {
    font-weight: 600;
    width: 45%;
}

.ret-ticket-row__price {
    color: var(--ret-muted);
    width: 25%;
}

.ret-ticket-row__qty {
    width: 30%;
}

/* Qty stepper */
.ret-qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--ret-border);
    border-radius: var(--ret-radius);
    overflow: hidden;
    width: fit-content;
}

.ret-qty-btn {
    background: var(--ret-cell-bg);
    border: none;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.1s;
    flex-shrink: 0;
}

.ret-qty-btn:hover:not(:disabled) {
    background: #e0e0e0;
}

.ret-qty-btn:disabled {
    color: var(--ret-muted);
    cursor: not-allowed;
}

.ret-qty-input {
    width: 40px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--ret-border);
    border-right: 1px solid var(--ret-border);
    height: 32px;
    font-size: 0.95rem;
    -moz-appearance: textfield;
    padding: 0;
}

.ret-qty-input::-webkit-outer-spin-button,
.ret-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* Cart footer */
.ret-cart-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0 0;
    border-top: 2px solid var(--ret-border);
    gap: 1rem;
    flex-wrap: wrap;
}

.ret-cart-total {
    font-size: 1rem;
}

.ret-cart-total__label {
    color: var(--ret-muted);
}

.ret-cart-total__value {
    font-weight: 700;
    font-size: 1.1rem;
    margin-left: 0.25rem;
}

.ret-add-all-to-cart {
    background: var(--ret-running);
    color: #fff;
    border: none;
    border-radius: var(--ret-radius);
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.15s;
}

.ret-add-all-to-cart:hover:not(:disabled) {
    background: #1b5e20;
}

.ret-add-all-to-cart:disabled {
    background: var(--ret-muted);
    cursor: not-allowed;
}

.ret-cart-notice {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--ret-running);
}

.ret-cart-notice a {
    color: var(--ret-running);
    font-weight: 600;
}

.ret-notice--warning {
    background: #fff8e1;
    color: #e65100;
    border: 1px solid #e65100;
}
