/**
 * GTG Biglietti - Frontend Styles
 * Uses CSS variables from bushi-shop theme.
 */

/* === Booking Form Container === */
.gtg-booking-form {
    max-width: 600px;
    margin: 0 auto var(--spacing-lg, 2rem);
}

/* === Step Layout === */
.gtg-booking-step {
    background: var(--color-white, #fff);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: var(--radius-md, 8px);
    padding: var(--spacing-md, 1.5rem);
    margin-bottom: var(--spacing-md, 1.5rem);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
}

.gtg-step-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 var(--spacing-sm, 1rem);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text, #333);
}

.gtg-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bushi-green, #368931);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* === Calendar === */
.gtg-calendar-widget {
    user-select: none;
}

.gtg-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm, 1rem);
}

.gtg-cal-month-year {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--bushi-brown, #5b4534);
}

.gtg-cal-nav {
    background: none;
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: var(--radius-sm, 4px);
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--color-text, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast, 0.15s ease), border-color var(--transition-fast, 0.15s ease);
}

.gtg-cal-nav:hover:not(:disabled) {
    background: var(--color-bg, #f8f9fa);
    border-color: var(--bushi-green, #368931);
}

.gtg-cal-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gtg-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.gtg-cal-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted, #999);
    padding: 4px 0;
    text-transform: uppercase;
}

.gtg-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.gtg-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s ease);
    background: transparent;
    padding: 0;
    min-width: 0;
}

.gtg-cal-day-empty {
    cursor: default;
}

.gtg-cal-day-loading {
    background: var(--color-bg, #f8f9fa);
    color: var(--color-text-muted, #999);
    cursor: wait;
}

.gtg-cal-day-available {
    background: #e8f5e9;
    color: var(--bushi-green-dark, #2a6b26);
    border-color: #c8e6c9;
}

.gtg-cal-day-available:hover {
    background: #c8e6c9;
    border-color: var(--bushi-green, #368931);
}

.gtg-cal-day-limited {
    background: #fff3e0;
    color: #e65100;
    border-color: #ffe0b2;
}

.gtg-cal-day-limited:hover {
    background: #ffe0b2;
    border-color: #ff9800;
}

.gtg-cal-day-full {
    background: #ffebee;
    color: #c62828;
    cursor: not-allowed;
    text-decoration: line-through;
}

.gtg-cal-day-closed {
    background: var(--color-bg-alt, #f0f2f5);
    color: var(--color-text-muted, #999);
    cursor: not-allowed;
}

.gtg-cal-day-selected {
    background: var(--bushi-green, #368931) !important;
    color: #fff !important;
    border-color: var(--bushi-green-dark, #2a6b26) !important;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(54, 137, 49, 0.3);
}

/* Calendar Legend */
.gtg-calendar-legend {
    display: flex;
    gap: var(--spacing-sm, 1rem);
    justify-content: center;
    margin-top: var(--spacing-sm, 1rem);
    flex-wrap: wrap;
}

.gtg-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--color-text-light, #666);
}

.gtg-legend-item::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.gtg-legend-available::before {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
}

.gtg-legend-limited::before {
    background: #fff3e0;
    border: 1px solid #ffe0b2;
}

.gtg-legend-full::before {
    background: #ffebee;
    border: 1px solid #ffcdd2;
}

/* === Selected Date Display === */
.gtg-selected-date {
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--bushi-green, #368931);
    margin-bottom: var(--spacing-sm, 1rem);
    padding: 8px;
    background: #e8f5e9;
    border-radius: var(--radius-sm, 4px);
}

/* === Slot Picker === */
.gtg-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--spacing-xs, 0.5rem);
}

.gtg-slot-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--spacing-sm, 1rem) var(--spacing-xs, 0.5rem);
    border: 2px solid var(--color-border, #e0e0e0);
    border-radius: var(--radius-md, 8px);
    background: var(--color-white, #fff);
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s ease);
    text-align: center;
    width: 100%;
}

.gtg-slot-card:hover:not([disabled]) {
    border-color: var(--bushi-green, #368931);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
}

.gtg-slot-selected {
    border-color: var(--bushi-green, #368931) !important;
    background: #e8f5e9 !important;
    box-shadow: 0 0 0 3px rgba(54, 137, 49, 0.15) !important;
}

.gtg-slot-soldout {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-bg-alt, #f0f2f5);
}

.gtg-slot-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text, #333);
}

.gtg-slot-remaining {
    font-size: 0.8rem;
    color: var(--color-text-light, #666);
}

.gtg-slot-soldout-label {
    font-size: 0.8rem;
    color: var(--wc-sale, #c0392b);
    font-weight: 600;
}

.gtg-slot-price {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--bushi-green, #368931);
}

.gtg-slots-loading,
.gtg-slots-empty,
.gtg-slots-error {
    text-align: center;
    padding: var(--spacing-md, 1.5rem);
    color: var(--color-text-light, #666);
}

.gtg-slots-error {
    color: var(--wc-sale, #c0392b);
}

/* === Quantity Control === */
.gtg-quantity-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm, 1rem);
    flex-wrap: wrap;
}

.gtg-quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
}

.gtg-qty-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--color-bg, #f8f9fa);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text, #333);
    transition: background var(--transition-fast, 0.15s ease);
}

.gtg-qty-btn:hover {
    background: var(--color-bg-alt, #f0f2f5);
}

.gtg-qty-input {
    width: 60px;
    height: 44px;
    border: none;
    border-left: 1px solid var(--color-border, #e0e0e0);
    border-right: 1px solid var(--color-border, #e0e0e0);
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    background: #fff;
    -moz-appearance: textfield;
}

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

.gtg-slot-remaining {
    font-size: 0.85rem;
    color: var(--color-text-light, #666);
}

/* === Price Summary === */
.gtg-price-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--spacing-sm, 1rem);
    padding: var(--spacing-sm, 1rem);
    background: var(--color-bg, #f8f9fa);
    border-radius: var(--radius-sm, 4px);
    border: 1px solid var(--color-border-light, #eee);
}

.gtg-price-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text, #333);
}

.gtg-price-value {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--bushi-green, #368931);
}

/* === Submit Button === */
.gtg-booking-submit {
    margin-top: var(--spacing-sm, 1rem);
}

.gtg-submit-btn {
    width: 100%;
    padding: 14px 24px !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    background: var(--bushi-green, #368931) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--radius-md, 8px) !important;
    cursor: pointer;
    transition: background var(--transition-fast, 0.15s ease), transform var(--transition-fast, 0.15s ease) !important;
    text-transform: none !important;
}

.gtg-submit-btn:hover {
    background: var(--bushi-green-dark, #2a6b26) !important;
    transform: translateY(-1px);
}

.gtg-submit-btn:active {
    transform: translateY(0);
}

/* === Calendar Loading State === */
.gtg-calendar-loading {
    text-align: center;
    padding: var(--spacing-xl, 3rem);
    color: var(--color-text-muted, #999);
}

/* === Responsive === */
@media (max-width: 768px) {
    .gtg-booking-form {
        max-width: 100%;
    }

    .gtg-booking-step {
        padding: var(--spacing-sm, 1rem);
    }

    .gtg-slots-grid {
        grid-template-columns: 1fr 1fr;
    }

    .gtg-quantity-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .gtg-quantity-control {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .gtg-slots-grid {
        grid-template-columns: 1fr;
    }

    .gtg-cal-day {
        font-size: 0.8rem;
    }

    .gtg-calendar-legend {
        font-size: 0.75rem;
    }
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
    .gtg-cal-day,
    .gtg-slot-card,
    .gtg-qty-btn,
    .gtg-submit-btn,
    .gtg-cal-nav {
        transition: none !important;
    }
}

.gtg-cal-day:focus-visible,
.gtg-slot-card:focus-visible,
.gtg-qty-btn:focus-visible,
.gtg-submit-btn:focus-visible,
.gtg-cal-nav:focus-visible {
    outline: 2px solid var(--bushi-green, #368931);
    outline-offset: 2px;
}
