/**
 * Checkout Styles
 * Design coerente con e-commerce e responsive
 */

/* Progress Bar */
.step-indicator {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.step-indicator.active .step-number {
    background-color: #DC2626;
    color: white;
    border-color: #DC2626;
}

.step-indicator.completed .step-number {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}

.step-indicator.completed .step-number::after {
    content: '✓';
    font-size: 1.25rem;
}

.step-label {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    text-align: center;
}

.step-indicator.active .step-label {
    color: #DC2626;
    font-weight: 600;
}

.step-indicator.completed .step-label {
    color: #10b981;
}

.step-line {
    flex: 1;
    height: 2px;
    background-color: #e5e7eb;
    margin: 0 1rem;
    margin-top: -20px;
    transition: background-color 0.3s ease;
}

.step-indicator.completed ~ .step-line {
    background-color: #10b981;
}

/* Sticky Summary */
#checkout-summary {
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
}

#checkout-summary::-webkit-scrollbar {
    width: 6px;
}

#checkout-summary::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#checkout-summary::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#checkout-summary::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Form Styles */
.checkout-form {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

html.dark .form-label,
.dark .form-label {
    color: #d1d5db;
}

.form-label .required {
    color: #DC2626;
    margin-left: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.dark .form-input {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.form-input:focus {
    outline: none;
    border-color: #DC2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-input.error {
    border-color: #DC2626;
}

.form-error {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #DC2626;
}

/* Button Styles */
.btn-primary {
    background-color: #DC2626;
    color: white;
    padding: 1.25rem 2.5rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background-color: #b91c1c;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: white;
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid #d1d5db;
    cursor: pointer;
    width: auto;
    min-width: fit-content;
}

.btn-secondary:hover {
    background-color: #f9fafb;
}

.dark .btn-secondary {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark .btn-secondary:hover {
    background-color: #4b5563;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

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

.dark .alert-error {
    background-color: #7f1d1d;
    border-color: #991b1b;
    color: #fecaca;
}

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

.dark .alert-success {
    background-color: #064e3b;
    border-color: #065f46;
    color: #a7f3d0;
}

.alert-info {
    background-color: #dbeafe;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.dark .alert-info {
    background-color: #1e3a8a;
    border-color: #1e40af;
    color: #bfdbfe;
}

/* Product Summary */
.product-summary-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.dark .product-summary-item {
    border-bottom-color: #4b5563;
}

.product-summary-item:last-child {
    border-bottom: none;
}

/* Tab Styles */
.tab-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #DC2626;
    background-color: rgba(220, 38, 38, 0.05);
}

.tab-btn.active {
    color: #DC2626;
    border-bottom-color: #DC2626;
    font-weight: 600;
}

.dark .tab-btn {
    color: #9ca3af;
}

.dark .tab-btn:hover {
    color: #DC2626;
    background-color: rgba(220, 38, 38, 0.1);
}

.dark .tab-btn.active {
    color: #DC2626;
}

.tab-content {
    display: none;
}

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

.product-summary-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.product-summary-details {
    flex: 1;
}

.product-summary-name {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.product-summary-quantity {
    font-size: 0.75rem;
    color: #6b7280;
}

.product-summary-price {
    font-weight: 600;
    font-size: 0.875rem;
}

/* Address Card */
.address-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .address-card {
    border-color: #4b5563;
}

.address-card:hover {
    border-color: #DC2626;
}

.address-card.selected {
    border-color: #DC2626;
    background-color: #fef2f2;
}

.dark .address-card.selected {
    background-color: #7f1d1d;
}

/* Shipping Method Card */
.shipping-method-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark .shipping-method-card {
    border-color: #4b5563;
}

.shipping-method-card:hover {
    border-color: #DC2626;
}

.shipping-method-card.selected {
    border-color: #DC2626;
    background-color: #fef2f2;
}

.dark .shipping-method-card.selected {
    background-color: #7f1d1d;
}

/* Payment Method Card */
.payment-method-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .payment-method-card {
    border-color: #4b5563;
}

.payment-method-card:hover {
    border-color: #DC2626;
}

.payment-method-card.selected {
    border-color: #DC2626;
    background-color: #fef2f2;
}

.dark .payment-method-card.selected {
    background-color: #7f1d1d;
}

/* Responsive */
@media (max-width: 1024px) {
    #checkout-summary {
        position: static;
        margin-top: 2rem;
    }
    
    .step-indicator {
        flex-direction: row;
    }
    
    .step-label {
        margin-top: 0;
        margin-left: 0.5rem;
    }
}

@media (max-width: 640px) {
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .step-label {
        font-size: 0.75rem;
    }
    
    /* Progress Bar scrollabile su mobile */
    .step-indicator {
        flex-shrink: 0;
    }
    
    .step-line {
        flex-shrink: 0;
        min-width: 20px;
    }
}

/* Nascondi scrollbar ma mantieni scroll */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Riepilogo Mobile Compatto */
#mobile-summary-compact {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dark #mobile-summary-compact {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Assicura che il contenuto principale non vada sotto il riepilogo mobile */
@media (max-width: 767px) {
    main.container {
        padding-top: 0;
    }
    
    /* Aggiungi padding top al container degli step per compensare il riepilogo mobile */
    #checkout-steps-container {
        margin-top: 0;
    }
}

