/* ==========================================================================
   Estilos para Formulario de Checkout Chapapp - Diseño Moderno
   ========================================================================== */

/* Container principal */
.chapapp-checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Progress Steps */
.chapapp-progress-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 200px;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    z-index: 2;
    position: relative;
}

.step-item.active .step-number {
    background-color: #007cba;
    color: white;
    box-shadow: 0 0 0 4px rgba(0, 124, 186, 0.2);
}

.step-item.completed .step-number {
    background-color: #46b450;
    color: white;
}

.step-item:not(.active):not(.completed) .step-number {
    background-color: #e1e5e9;
    color: #6c757d;
}

.step-label {
    font-size: 14px;
    color: #6c757d;
    text-align: center;
    font-weight: 500;
}

.step-item.active .step-label {
    color: #007cba;
    font-weight: 600;
}

/* Connector line */
.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -50%;
    width: 100%;
    height: 2px;
    background-color: #e1e5e9;
    z-index: 1;
}

.step-item.completed:not(:last-child)::after {
    background-color: #46b450;
}

/* Main form layout */
.chapapp-checkout-form {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
    align-items: start;
}

/* Left column - Form */
.chapapp-form-section {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e1e5e9;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f8f9fa;
}

/* Form groups */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.form-label.required::after {
    content: ' *';
    color: #dc2626;
}

/* Input styling */
.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background-color: white;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

/* Document type selection */
.document-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.document-type-option {
    padding: 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: white;
}

.document-type-option:hover {
    border-color: #007cba;
    background-color: #f8fafc;
}

.document-type-option.selected {
    border-color: #007cba;
    background-color: #eff6ff;
}

.document-type-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.document-type-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.document-type-subtitle {
    font-size: 12px;
    color: #6b7280;
}

/* Row layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row.three-cols {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Right column - Order summary */
.chapapp-order-summary {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e1e5e9;
    position: sticky;
    top: 20px;
}

.summary-title {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
}

.summary-title::before {
    content: '🛒';
    margin-right: 8px;
}

.product-count {
    background: #007cba;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
}

/* Product item */
.summary-product {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
}

.summary-product:last-of-type {
    border-bottom: none;
}

.product-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: #f8f9fa;
    margin-right: 12px;
    object-fit: cover;
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 14px;
}

.product-sku {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.product-quantity {
    font-size: 12px;
    color: #6b7280;
}

.product-price {
    font-weight: 600;
    color: #2c3e50;
    text-align: right;
}

/* Summary totals */
.summary-totals {
    border-top: 2px solid #f1f5f9;
    padding-top: 16px;
    margin-top: 16px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.total-row:last-child {
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.total-label {
    font-size: 14px;
    color: #6b7280;
}

.total-value {
    font-weight: 500;
    color: #2c3e50;
}

.final-total {
    font-size: 18px;
    font-weight: 700;
    color: #dc2626;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #6b7280;
    border: 1px solid #e1e5e9;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-full {
    width: 100%;
    margin-top: 20px;
}

/* Error states */
.form-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

.error-message {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
}

/* Loading states */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e1e5e9;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Multi-Product Checkout Styles */
.chapapp-multi-product-checkout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Enhanced Product Cards */
.product-assignment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.product-card {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    border-color: #007cba;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.1);
}

.product-card.current {
    border-color: #007cba;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}

.product-card.completed {
    border-color: #46b450;
    background: linear-gradient(135deg, #f0fff0 0%, #f8fafc 100%);
}

.product-card.completed::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: #46b450;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Product Info */
.product-info-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.product-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 16px;
    background: #f8f9fa;
}

.product-details h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 4px 0;
}

.product-meta {
    font-size: 12px;
    color: #6b7280;
}

/* User Assignment Status */
.user-assignment-status {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.assigned-user {
    background: #f0f9ff;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #007cba;
}

.assigned-user-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 2px;
}

.assigned-user-details {
    font-size: 12px;
    color: #6b7280;
}

/* Progress Indicators */
.checkout-progress-header {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 32px;
    text-align: center;
}

.progress-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-top: 16px;
}

.progress-stat {
    text-align: center;
}

.progress-stat-number {
    font-size: 24px;
    font-weight: bold;
    display: block;
}

.progress-stat-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Product Progress Bar */
.product-progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e5e9;
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.product-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #46b450 0%, #38a169 100%);
    transition: width 0.5s ease;
    border-radius: 4px;
}

/* Current Product Form */
.current-product-form {
    background: white;
    border: 2px solid #007cba;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.current-product-title {
    color: #007cba;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.current-product-title::before {
    content: '👤';
    margin-right: 8px;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.current {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.completed {
    background: #dcfce7;
    color: #166534;
}

/* Verification Summary */
.verification-summary {
    background: #f8fffe;
    border: 1px solid #10b981;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.verification-item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.verification-product-info {
    flex: 1;
    margin-left: 16px;
}

.verification-user-info {
    margin-left: 76px;
    padding: 8px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-top: 8px;
}

/* Navigation Buttons */
.checkout-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid #f1f5f9;
}

.checkout-navigation .btn-back {
    background: #f8f9fa;
    color: #6b7280;
    border: 1px solid #e1e5e9;
}

.checkout-navigation .btn-next {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    min-width: 200px;
}

/* Alert Messages */
.checkout-alert {
    margin: 20px 0;
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
}

.checkout-alert.success {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.checkout-alert.warning {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

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

/* Responsive for Multi-Product */
@media (max-width: 968px) {
    .chapapp-checkout-form {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chapapp-order-summary {
        position: static;
        order: -1;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-row.three-cols {
        grid-template-columns: 1fr;
    }
    
    .document-type-selector {
        grid-template-columns: 1fr;
    }
    
    .product-assignment-grid {
        grid-template-columns: 1fr;
    }
    
    .progress-stats {
        flex-direction: column;
        gap: 16px;
    }
    
    .checkout-navigation {
        flex-direction: column;
        gap: 12px;
    }
    
    .checkout-navigation .btn-next {
        width: 100%;
        order: -1;
    }
}

@media (max-width: 640px) {
    .chapapp-checkout-container {
        padding: 12px;
    }
    
    .chapapp-form-section,
    .chapapp-order-summary {
        padding: 20px;
        border-radius: 8px;
    }
    
    .chapapp-progress-steps {
        margin-bottom: 24px;
        overflow-x: auto;
        padding-bottom: 8px;
    }
    
    .step-item {
        min-width: 120px;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .step-label {
        font-size: 12px;
    }
}