/**
 * Frontend styles for Biglietti Rossini Art Site
 */

/* Reset and base styles */
.bras-biglietti-container {
    font-family: 'Manrope', Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.bras-biglietti-container *,
.bras-biglietti-container *::before,
.bras-biglietti-container *::after {
    box-sizing: inherit;
}

/* Header with tabs and cart */
.bras-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.bras-tabs {
    display: flex;
    gap: 10px;
}

.bras-tab-button {
    background: transparent;
    border: none;
    border-bottom: 1px solid #000000;
    padding: 10px 20px;
    border-radius: 0px;
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #000000;
    display: flex;
    align-items: center;
    gap: 8px;
    outline: none;
}

.bras-tab-button:hover {
    background: transparent;
    border-bottom: 1px solid #000000;
}

.bras-tab-button.active {
    background: transparent;
    border-bottom: 2px solid #000000;
    color: #000000;
}

.bras-tab-button i {
    font-size: 16px;
}

/* Cart icon */
.bras-cart-icon {
    position: relative;
    background: #000000;
    color: #ffffff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
}

.bras-cart-icon:hover {
    background: #333333;
    transform: scale(1.05);
}

.bras-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
}

.bras-cart-shake {
    animation: shake 0.6s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Tab content */
.bras-tab-content {
    display: none;
}

.bras-tab-content.active {
    display: block;
}

/* Ticket rows */
.bras-ticket-row {
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.bras-ticket-row:last-child {
    border-bottom: none;
}

.bras-ticket-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
}

.bras-ticket-left {
    flex: 1;
    max-width: 70%;
}

.bras-ticket-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 30%;
    justify-content: flex-end;
    align-self: center;
}

.bras-ticket-header {
    margin-bottom: 8px;
}

.bras-ticket-name {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    margin: 0;
    flex: 1;
}

.bras-ticket-price {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
}

.bras-ticket-description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.bras-ticket-description p {
    margin: 0 0 8px 0;
}

.bras-ticket-description p:last-child {
    margin-bottom: 0;
}

.bras-ticket-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Quantity selector */
.bras-quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.bras-qty-decrease,
.bras-qty-increase {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    transition: background-color 0.2s ease;
}

.bras-qty-decrease:hover,
.bras-qty-increase:hover {
    background: #e9ecef;
}

.bras-qty-decrease:active,
.bras-qty-increase:active {
    background: #dee2e6;
}

.bras-qty-decrease {
    border-right: 1px solid #e0e0e0;
}

.bras-qty-increase {
    border-left: 1px solid #e0e0e0;
}

.bras-qty-display {
    min-width: 40px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    background: #fff;
    padding: 8px 12px;
    line-height: 1;
}

/* Buttons */
.bras-btn {
    font-family: 'Manrope', Arial, sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 14px;
    padding: 10px 20px;
    border-radius: 35px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    min-width: 100px;
}

.bras-btn-primary {
    background: #000000;
    color: #ffffff;
}

.bras-btn-primary:hover {
    background: #333333;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.bras-btn-primary:active {
    transform: translateY(0);
}

.bras-btn-secondary {
    background: #ffffff;
    color: #333;
    border: 1px solid #e0e0e0;
}

.bras-btn-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.bras-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Pulse animation for successful add */
.bras-btn-success {
    animation: pulse-green 0.6s ease-in-out;
}

@keyframes pulse-green {
    0% { background: #000000; }
    50% { background: #4CAF50; }
    100% { background: #000000; }
}

/* Event specific styles */
.bras-evento-row {
    position: relative;
}

.bras-evento-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.bras-evento-image {
    flex-shrink: 0;
}

.bras-evento-thumb {
    width: 120px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e0e0e0;
}

.bras-evento-info {
    flex: 1;
}

.bras-evento-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.bras-evento-datetime {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    font-size: 14px;
}

.bras-evento-datetime i {
    color: #999;
}

.bras-evento-availability {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.bras-evento-availability i {
    color: #999;
}

.bras-availability-text {
    font-weight: 500;
}

.bras-availability-available {
    color: #4CAF50;
}

.bras-availability-limited {
    color: #FF9800;
}

.bras-availability-critical {
    color: #F44336;
}

.bras-availability-sold-out {
    color: #999;
}

/* Sold out overlay */
.bras-sold-out-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
}

.bras-sold-out-text {
    background: #F44336;
    color: white;
    padding: 10px 20px;
    border-radius: 35px;
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Past events */
.bras-past-event {
    opacity: 0.5;
    pointer-events: none;
}

/* Unavailable tickets */
.bras-ticket-unavailable {
    opacity: 0.6;
}

.bras-unavailable-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
}

/* Empty states */
.bras-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.bras-empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ccc;
}

.bras-empty-state p {
    font-size: 16px;
    margin: 0;
}

/* Footer */
.bras-footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 30px;
}

.bras-powered-by {
    color: #999;
    font-size: 12px;
}

/* Modals */
.bras-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.bras-modal-content {
    background-color: #ffffff;
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bras-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.bras-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.bras-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.bras-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.bras-modal-body {
    padding: 20px;
}

.bras-modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-radius: 0 0 12px 12px;
}

/* Cart modal specific styles */
.bras-cart-list {
    max-height: 400px;
    overflow-y: auto;
}

.bras-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.bras-cart-item:last-child {
    border-bottom: none;
}

.bras-cart-item-info {
    flex: 1;
}

.bras-cart-item-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #000;
}

.bras-cart-item-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.bras-cart-item-actions {
    margin-left: 15px;
}

.bras-cart-remove {
    background: #F44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bras-cart-remove:hover {
    background: #D32F2F;
    transform: scale(1.05);
}

.bras-cart-total {
    padding: 15px 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 10px;
}

.bras-cart-total-line {
    text-align: right;
    font-size: 18px;
    color: #000;
}

.bras-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

/* Famiglia modal */
.bras-famiglia-selector {
    margin: 20px 0;
}

.bras-famiglia-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.bras-famiglia-selector select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

/* Loading overlay */
.bras-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200000;
}

.bras-loading-spinner {
    text-align: center;
    color: #333;
}

.bras-loading-spinner i {
    font-size: 32px;
    margin-bottom: 10px;
    animation: spin 1s linear infinite;
}

.bras-loading-spinner p {
    margin: 0;
    font-size: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast notifications */
.bras-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 150000;
}

.bras-toast {
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.bras-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.bras-toast-success {
    background: #4CAF50;
}

.bras-toast-error {
    background: #F44336;
}

.bras-toast i {
    font-size: 16px;
}

/* Responsive design */
@media (max-width: 768px) {
    .bras-biglietti-container {
        padding: 15px;
    }
    
    .bras-header {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .bras-tabs {
        justify-content: center;
    }
    
    .bras-tab-button {
        flex: 1;
        justify-content: center;
    }
    
    .bras-cart-icon {
        align-self: center;
    }
    
    .bras-ticket-content {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .bras-ticket-right {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
    }
    
    .bras-ticket-price {
        text-align: left;
    }
    
    .bras-evento-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .bras-evento-thumb {
        width: 100%;
        height: 200px;
    }
    
    .bras-evento-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .bras-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .bras-modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .bras-toast {
        min-width: 250px;
    }
    
    .bras-toast-container {
        right: 10px;
        left: 10px;
    }
}

@media (max-width: 480px) {
    .bras-biglietti-container {
        padding: 10px;
    }
    
    .bras-tabs {
        flex-direction: column;
        gap: 10px;
    }
    
    .bras-tab-button {
        padding: 15px 20px;
    }
    
    .bras-ticket-name {
        font-size: 18px;
    }
    
    .bras-ticket-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .bras-quantity-controls {
        justify-content: center;
    }
    
    .bras-modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        height: 100%;
    }
    
    .bras-modal-header {
        border-radius: 0;
    }
    
    .bras-modal-footer {
        border-radius: 0;
    }
}

/* Print styles */
@media print {
    .bras-biglietti-container {
        font-size: 12px;
    }
    
    .bras-header,
    .bras-ticket-actions,
    .bras-footer {
        display: none;
    }
    
    .bras-ticket-row {
        border: 1px solid #000;
        margin-bottom: 10px;
        padding: 10px;
    }
    
    .bras-ticket-row:hover {
        background: transparent;
        box-shadow: none;
    }
}

/* Accessibility improvements */
.bras-btn:focus,
.bras-qty-btn:focus,
.bras-cart-icon:focus {
    outline: 2px solid #333333;
    outline-offset: 2px;
}

.bras-tab-button:focus {
    outline: none;
}

.bras-modal:focus {
    outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .bras-ticket-row {
        border: 2px solid #000;
    }
    
    .bras-btn-primary {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }
    
    .bras-btn-secondary {
        background: #fff;
        color: #000;
        border: 2px solid #000;
    }
}