/**
 * Hoja de Pedido WooCommerce - Enhanced Styles with Real-Time Validation
 * @version 1.5.1 - FIXED: No green backgrounds and simplified radios
 */

/* === CONTENEDOR PRINCIPAL === */
.advanced-order-form-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: inherit;
    line-height: 1.4;
    font-size: 14px;
}

/* === CABECERA === */
.advanced-order-form-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background-color: #e1e1e1;
    color: black;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(52, 73, 94, 0.3);
}

.advanced-order-form-header h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.advanced-order-form-header p {
    font-size: 1rem;
    margin: 0;
    opacity: 0.9;
}

/* === SECCIONES DEL FORMULARIO === */
.form-section {
    background: #ffffff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #22b3a8;
    transition: box-shadow 0.3s ease;
}

.form-section:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.form-section h3 {
    font-size: 1.2rem;
    color: #333;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #22b3a8;
    text-align: center;
    font-weight: 600;
}

/* === SIMPLIFIED RADIO STYLES === */
.simple-radio-group {
    display: flex;
    gap: 30px;
    margin-top: 10px;
}

.simple-radio-option {
    display: flex;
    align-items: center;
    font-weight: normal !important;
    cursor: pointer;
    font-size: 1rem;
}

.simple-radio-option input[type="radio"] {
    margin-right: 8px;
    transform: scale(1.1);
    accent-color: #22b3a8;
}

.simple-radio-option span {
    color: #333;
    font-weight: 500;
}

/* === EVENT FIELDS SECTION === */
#event-fields {
    border: 2px solid #20c997;
    border-radius: 8px;
    background: linear-gradient(135deg, #e7f7e7, #f0f8f0);
    margin: 20px 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

#event-fields .form-section {
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
}

#event-fields h3 {
    background: linear-gradient(135deg, #20c997, #17a085);
    color: white;
    margin: 0 0 20px 0;
    padding: 15px 20px;
    border-radius: 0;
    text-align: left;
    border-bottom: none;
}

#event-fields h3::before {
    content: "🎉 ";
    margin-right: 8px;
}

/* === GRUPOS DE FORMULARIO === */
.form-group {
    margin-bottom: 15px;
    position: relative;
}

.client-address-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr;
    gap: 15px;
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #444;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
    background-color: #fafafa;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #22b3a8;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(34, 179, 168, 0.1);
    transform: translateY(-1px);
}

/* === VALIDACIÓN VISUAL === */
.form-group input.valid,
.form-group select.valid {
    border-color: #28a745 !important;
    background-color: #f8fff9 !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
}

.form-group input.error,
.form-group select.error {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
    animation: shake 0.5s ease-in-out;
}

.form-group.has-error label {
    color: #dc3545;
}

.error-message,
.success-message {
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
    font-weight: 500;
    padding: 5px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.error-message::before {
    content: "⚠️ ";
    margin-right: 4px;
}

.success-message {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.success-message::before {
    content: "✅ ";
    margin-right: 4px;
}

/* Animación de error */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* === VALIDATION SUMMARY === */
.validation-summary {
    background: linear-gradient(135deg, #f8d7da, #f1aeb5);
    border: 2px solid #dc3545;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
    animation: slideInDown 0.3s ease-out;
}

.validation-summary h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.validation-summary ul {
    margin: 0;
    padding-left: 20px;
}

.validation-summary li {
    margin: 8px 0;
    font-weight: 500;
}

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

/* === SELECT PERSONALIZADO === */
.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group select:focus {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2322b3a8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
}

.form-group select.valid {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2328a745' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
}

.form-group select.error {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23dc3545' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
}

/* === FILAS DE PRODUCTOS === */
.product-row {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) 80px 100px 100px auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    background: linear-gradient(135deg, #f8f9fa, #f1f3f4);
    border-radius: 6px;
    margin-bottom: 3px;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.product-row:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
}

/* === CAMPOS ESPECÍFICOS === */
.quantity-input {
    text-align: center !important;
    font-weight: 600;
    color: #2c3e50;
}

.unit-price, 
.row-total {
    text-align: right !important;
    font-weight: 600;
    background-color: #f8f9fa !important;
    color: #2c3e50;
}

.product-select {
    font-size: 0.9rem !important;
}

/* === BOTONES === */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease; 
    text-decoration: none;
    display: inline-block;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover::before {
    left: -100%;
}

.btn-primary {
    background-color: #1a8a82;
    color: white;
    box-shadow: 0 4px 15px rgba(34, 179, 168, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(34, 179, 168, 0.4);
    background-color: #146b66;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    background: linear-gradient(135deg, #218838, #17a085);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c0392b);
    color: white;
    padding: 8px 12px;
    font-size: 0.8rem;
    min-width: 40px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    background: linear-gradient(135deg, #c82333, #a93226);
    transform: translateY(-1px);
}

.btn-large {
    font-size: 1.1rem;
    padding: 15px 30px;
    font-weight: 700;
}

/* === RESUMEN DEL PEDIDO === */
.order-summary {
    background-color: #e1e1e1;
    color: black;
    padding: 10px;
    border-radius: 8px;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(52, 73, 94, 0.3);
    transition: all 0.3s ease;
}

.order-summary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 73, 94, 0.4);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 1.1rem;
}

.total-row {
    font-size: 1.3rem;
    font-weight: bold;
    border-top: 2px solid #22b3a8;
    padding-top: 12px;
    margin-top: 10px;
}

/* === FORMULARIO === */
.form-submit {
    text-align: center;
    margin: 30px 0;
}

/* === ESTADOS DEL FORMULARIO === */
.form-loading {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    margin: 20px 0;
    border: 2px dashed #22b3a8;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #22b3a8;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.form-message {
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideInDown 0.3s ease-out;
}

.form-message h4 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.form-message.success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 2px solid #28a745;
    color: #155724;
}

.form-message.error {
    background: linear-gradient(135deg, #f8d7da, #f1aeb5);
    border: 2px solid #dc3545;
    color: #721c24;
}

/* === ANIMACIONES === */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* === CONFIRMACIÓN DE PEDIDO - FIXED: NO GREEN BACKGROUNDS === */
.advanced-order-confirmation-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: inherit;
    animation: fadeIn 0.5s ease-in;
}

.confirmation-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #ffffff; /* FIXED: White background */
    color: #007cba; /* FIXED: Blue text instead of white */
    border: 2px solid #007cba;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.confirmation-header h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    font-weight: 600;
    color: #007cba; /* FIXED: Blue text */
}

.confirmation-header p {
    font-size: 1.1rem;
    margin: 0;
    color: #333; /* FIXED: Dark text for readability */
}

.confirmation-content {
    background: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #007cba; /* FIXED: Blue border instead of green */
    font-family: Arial, sans-serif;
}

.confirmation-content h3 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.confirmation-content p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

.order-details-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid #ddd;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.order-details-table th {
    background: #ffffff; /* FIXED: White background */
    color: #333; /* FIXED: Dark text */
    border: 2px solid #007cba; /* FIXED: Blue border */
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.order-details-table th:nth-child(2),
.order-details-table th:nth-child(3),
.order-details-table th:nth-child(4) {
    text-align: center;
}

.order-details-table th:nth-child(3),
.order-details-table th:nth-child(4) {
    text-align: right;
}

.order-details-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.order-details-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.order-details-table tr:hover {
    background-color: #f0f8ff;
    transition: background-color 0.2s ease;
}

.order-total {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    text-align: right;
    margin: 20px 0;
    padding: 15px;
    background: #ffffff; /* FIXED: White background */
    border: 2px solid #007cba; /* FIXED: Blue border */
    border-radius: 8px;
}

.order-notes {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    padding: 15px;
    border-left: 4px solid #007cba; /* FIXED: Blue border */
    margin: 20px 0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.confirmation-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* === NOTIFICACIONES TEMPORALES === */
.temp-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.3);
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
    max-width: 350px;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .advanced-order-form-container {
        margin: 0 15px;
    }

    .client-address-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .simple-radio-group {
        flex-direction: column;
        gap: 15px;
    }

    .products-header {
        display: none !important;
    }
    
    .product-row {
        display: flex !important;
        flex-wrap: wrap;
        padding: 12px;
        text-align: left;
        gap: 8px;
    }
    
    /* FILA 1: Producto (70%) y Cantidad (25%) */
    .product-row .form-group:nth-child(1) {
        flex: 0 0 68%;  /* Producto ocupa 68% */
        margin-bottom: 8px;
    }
    
    .product-row .form-group:nth-child(2) {
        flex: 0 0 28%;  /* Cantidad ocupa 28% */
        margin-bottom: 8px;
    }
    
    /* FILA 2: Precio (30%), Total (30%), Acción (30%) */
    .product-row .form-group:nth-child(3) {
        flex: 0 0 30%;  /* Precio */
    }
    
    .product-row .form-group:nth-child(4) {
        flex: 0 0 30%;  /* Total */
    }
    
    .product-row .form-group:nth-child(5) {
        flex: 0 0 30%;  /* Acción */
        text-align: center;
    }
    
    /* Labels compactos */
    .product-row .form-group::before {
        display: block;
        font-weight: 600;
        margin-bottom: 4px;
        color: #444;
        font-size: 0.8rem;
    }
    
    .product-row .form-group:nth-child(1)::before { content: "Producto:"; }
    .product-row .form-group:nth-child(2)::before { content: "Cant:"; }
    .product-row .form-group:nth-child(3)::before { content: "Precio:"; }
    .product-row .form-group:nth-child(4)::before { content: "Total:"; }
    .product-row .form-group:nth-child(5)::before { content: ""; }

    /* Resto del CSS responsive */
    .form-section {
        padding: 15px;
    }
    
    .advanced-order-form-header {
        padding: 15px;
    }
    
    .advanced-order-form-header h2 {
        font-size: 1.5rem;
    }
    
    .btn-large {
        width: 100%;
        padding: 12px;
    }

    .confirmation-actions .btn {
        width: 100%;
        margin: 5px 0 !important;
    }

    .temp-notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .validation-summary {
        padding: 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .advanced-order-form-header h2 {
        font-size: 1.3rem;
    }
    
    .form-section h3 {
        font-size: 1.1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px 10px;
    }

    .order-details-table {
        font-size: 0.8rem;
    }
    
    .order-details-table th,
    .order-details-table td {
        padding: 8px 5px;
    }
}

/* Event dates grid for responsive */
.event-dates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .event-dates-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* === MEJORAS DE ACCESIBILIDAD === */
.btn:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 3px solid #22b3a8;
    outline-offset: 2px;
}

/* === ESTADOS DE HOVER MEJORADOS === */
.product-row:focus-within {
    box-shadow: 0 0 0 3px rgba(34, 179, 168, 0.2);
    border-color: #22b3a8;
}

/* === OPTIMIZACIÓN DE IMPRESIÓN === */
@media print {
    .btn, .form-loading, .form-message, .validation-summary, .temp-notification {
        display: none !important;
    }
    
    .advanced-order-form-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .form-section {
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    .confirmation-actions {
        display: none !important;
    }
    
    .advanced-order-confirmation-container {
        box-shadow: none;
    }
    
    .confirmation-header {
        background: #f8f9fa !important;
        color: #000 !important;
        border: 1px solid #000;
    }
    
    .confirmation-content {
        border: 1px solid #000;
    }
}

/* === FOCUS IMPROVEMENTS === */
.form-group input:focus + .error-message,
.form-group input:focus + .success-message {
    display: block;
}

.form-group input.valid + .error-message {
    display: none;
}

.form-group input.error + .success-message {
    display: none;
}

/* === LOADING STATES === */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    color: white;
}

/* === SMOOTH TRANSITIONS === */
* {
    transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group {
    transition: all 0.3s ease;
}

.form-group:focus-within {
    transform: translateY(-1px);
}

/* === CUSTOM SCROLLBAR === */
.form-section::-webkit-scrollbar {
    width: 8px;
}

.form-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.form-section::-webkit-scrollbar-thumb {
    background: #22b3a8;
    border-radius: 4px;
}

.form-section::-webkit-scrollbar-thumb:hover {
    background: #1a8a82;
}