/**
 * LRE Ticketing - Frontend Styles
 *
 * @package LRETicketing\FluentCart
 */

/* Widget Container */
.lre-tickets-widget {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.lre-tickets-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.lre-tickets-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.lre-tickets-label {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* Date Selection Grid */
.lre-tickets-dates {
    margin-bottom: 24px;
}

.lre-date-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.lre-date-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.lre-date-option:hover:not(:disabled) {
    border-color: #6366f1;
    background: #f5f3ff;
}

.lre-date-option.selected {
    border-color: #6366f1;
    background: #eef2ff;
}

.lre-date-option:disabled,
.lre-date-option.lre-sold-out {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f3f4f6;
}

.lre-date-day {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lre-date-full {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin: 4px 0;
}

.lre-date-availability {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.lre-date-availability:not(.sold-out):not(.low) {
    background: #d1fae5;
    color: #065f46;
}

.lre-date-availability.low {
    background: #fef3c7;
    color: #92400e;
}

.lre-date-availability.sold-out {
    background: #fee2e2;
    color: #991b1b;
}

/* Variation Selection */
.lre-tickets-variations {
    margin-bottom: 24px;
}

.lre-variation-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lre-variation-option {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lre-variation-option:hover {
    border-color: #6366f1;
    background: #f5f3ff;
}

.lre-variation-option.selected,
.lre-variation-option:has(input:checked) {
    border-color: #6366f1;
    background: #eef2ff;
}

.lre-variation-option.hidden {
    display: none;
}

.lre-variation-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lre-variation-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lre-variation-name {
    font-size: 15px;
    font-weight: 500;
    color: #111827;
}

.lre-variation-price {
    font-size: 16px;
    font-weight: 700;
    color: #6366f1;
}

.lre-variation-check {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    border-radius: 50%;
    margin-left: 12px;
    transition: all 0.2s ease;
}

.lre-variation-option:has(input:checked) .lre-variation-check,
.lre-variation-option.selected .lre-variation-check {
    background: #6366f1;
    color: white;
}

.lre-variation-check svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.lre-variation-option:has(input:checked) .lre-variation-check svg,
.lre-variation-option.selected .lre-variation-check svg {
    opacity: 1;
}

/* Quantity Control */
.lre-tickets-quantity {
    margin-bottom: 24px;
}

.lre-quantity-control {
    display: inline-flex;
    align-items: center;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.lre-qty-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 20px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lre-qty-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.lre-qty-input {
    width: 60px;
    height: 44px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    background: transparent;
    -moz-appearance: textfield;
}

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

/* Action Buttons */
.lre-tickets-action {
    margin-top: 24px;
}

.lre-tickets-buttons {
    display: flex;
    gap: 12px;
}

.lre-add-to-cart-btn,
.lre-buy-now-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Add to Cart (Secondary) */
.lre-add-to-cart-btn.lre-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.lre-add-to-cart-btn.lre-btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.lre-add-to-cart-btn.lre-btn-secondary .lre-btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Buy Now (Primary) */
.lre-buy-now-btn.lre-btn-primary {
    background: #6366f1;
    color: white;
}

.lre-buy-now-btn.lre-btn-primary:hover:not(:disabled) {
    background: #4f46e5;
}

.lre-add-to-cart-btn:disabled,
.lre-buy-now-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lre-btn-loader {
    display: flex;
    align-items: center;
}

.lre-spinner {
    width: 20px;
    height: 20px;
    animation: lre-spin 1s linear infinite;
}

@keyframes lre-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Messages */
.lre-tickets-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.lre-tickets-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.lre-tickets-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.lre-tickets-message.info {
    background: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.lre-tickets-message a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.lre-cart-links {
    margin-top: 8px;
    display: flex;
    gap: 16px;
}

.lre-cart-links a {
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.lre-cart-links .lre-link-cart {
    background: rgba(0,0,0,0.1);
}

.lre-cart-links .lre-link-checkout {
    background: #065f46;
    color: white !important;
}

/* Error/Notice States */
.lre-tickets-error,
.lre-tickets-notice {
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.lre-tickets-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.lre-tickets-notice {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Responsive */
@media (max-width: 480px) {
    .lre-tickets-widget {
        padding: 16px;
    }

    .lre-date-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lre-date-option {
        padding: 12px 8px;
    }

    .lre-variation-option {
        padding: 12px;
    }

    .lre-variation-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .lre-tickets-buttons {
        flex-direction: column;
    }

    .lre-add-to-cart-btn,
    .lre-buy-now-btn {
        width: 100%;
    }

    .lre-cart-links {
        flex-direction: column;
        gap: 8px;
    }
}

/* Single Date Mode */
.lre-tickets-widget.lre-single-date-mode {
    max-width: 500px;
}

.lre-tickets-widget.lre-single-date-mode .lre-tickets-header {
    display: none;
}

.lre-tickets-date-display {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.lre-selected-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.lre-selected-date .lre-date-day {
    font-size: 13px;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lre-selected-date .lre-date-full {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.lre-selected-date .lre-date-availability {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 8px;
}

.lre-selected-date .lre-date-availability:not(.low) {
    background: #d1fae5;
    color: #065f46;
}

.lre-selected-date .lre-date-availability.low {
    background: #fef3c7;
    color: #92400e;
}

/* Sold out state for single date mode */
.lre-tickets-sold-out {
    text-align: center;
    padding: 32px 24px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.lre-tickets-sold-out p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #991b1b;
}
