/**
 * Estilos públicos para el formulario TPV Redsys
 * Basado en el diseño de la captura proporcionada
 */

/* Contenedor principal */
.tpv-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border: none;
    border-radius: 0px;
    box-shadow: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Título del formulario */
.tpv-form-title {
    margin: 0 0 30px 0;
    padding: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: center;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

/* Formulario */
.tpv-payment-form {
    margin: 0;
}

/* Grupos de campos */
.tpv-form-group {
    margin-bottom: 25px;
    position: relative;
}

.tpv-form-group:last-of-type {
    margin-bottom: 30px;
}

/* Etiquetas */
.tpv-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    line-height: 1.4;
}

.tpv-required {
    color: #e74c3c;
    font-weight: 600;
}

/* Inputs */
.tpv-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
}

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

.tpv-input:invalid {
    border-color: #e74c3c;
}

.tpv-input::placeholder {
    color: #999;
    opacity: 1;
}

/* Grupo de input con sufijo */
.tpv-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.tpv-input-group .tpv-input {
    padding-right: 50px;
}

.tpv-input-suffix {
    position: absolute;
    right: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    pointer-events: none;
}

/* Textarea */
.tpv-textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
}

/* Texto de ayuda */
.tpv-help-text {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #666;
    line-height: 1.3;
}

/* Contador de caracteres */
.tpv-char-count {
    font-weight: 500;
    color: #007cba;
}

/* Checkbox de privacidad */
.tpv-privacy-notice {
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.tpv-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.tpv-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tpv-checkbox-text {
    flex: 1;
    color: #555;
}

.tpv-checkbox-text a {
    color: #007cba;
    text-decoration: underline;
}

.tpv-checkbox-text a:hover {
    color: #005a87;
}

/* Honeypot */
.tpv-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* Mensajes de error */
.tpv-error-message {
    display: none;
    margin-top: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #e74c3c;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    line-height: 1.3;
}

.tpv-error-message.show {
    display: block;
}

.tpv-form-group.has-error .tpv-input {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Errores generales */
.tpv-general-errors {
    margin-top: 20px;
    padding: 15px;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
}

.tpv-general-errors ul {
    margin: 0;
    padding-left: 20px;
}

.tpv-general-errors li {
    margin-bottom: 5px;
}

/* Acciones del formulario */
.tpv-form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Botones */
.tpv-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    line-height: 1.2;
    font-family: inherit;
}

.tpv-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3);
}

.tpv-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Botón secundario */
.tpv-button-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
}

.tpv-button-secondary:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #343a40;
}

/* Botón primario */
.tpv-button-primary {
    background: #007cba;
    color: #ffffff;
    border: 2px solid #007cba;
}

.tpv-button-primary:hover:not(:disabled) {
    background: #005a87;
    border-color: #005a87;
}

.tpv-button-primary:disabled {
    background: #6c757d;
    border-color: #6c757d;
}

/* Estados del botón de envío */
.tpv-button-loading {
    display: none;
}

.tpv-button.loading .tpv-button-text {
    display: none;
}

.tpv-button.loading .tpv-button-loading {
    display: inline;
}

.tpv-button.loading {
    opacity: 0.8;
    cursor: wait;
}

/* Información de seguridad */
.tpv-security-info {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.tpv-security-text {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    color: #666;
    line-height: 1.3;
}

.tpv-security-icon {
    margin-right: 6px;
    font-size: 14px;
}

/* Páginas de retorno */
.tpv-return-page {
    max-width: 600px;
    margin: 40px auto;
    padding: 40px 30px;
    text-align: center;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tpv-return-page h1 {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: 600;
}

.tpv-return-page p {
    margin: 0 0 30px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.tpv-success {
    border-top: 4px solid #28a745;
}

.tpv-success h1 {
    color: #28a745;
}

.tpv-error {
    border-top: 4px solid #dc3545;
}

.tpv-error h1 {
    color: #dc3545;
}

/* Errores del plugin */
.tpv-error {
    padding: 15px 20px;
    margin: 20px 0;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    font-size: 14px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .tpv-form-container {
        margin: 20px;
        padding: 20px;
    }
    
    .tpv-form-title {
        font-size: 20px;
    }
    
    .tpv-input {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    .tpv-form-actions {
        flex-direction: column;
    }
    
    .tpv-button {
        width: 100%;
    }
    
    .tpv-return-page {
        margin: 20px;
        padding: 30px 20px;
    }
    
    .tpv-return-page h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .tpv-form-container {
        margin: 10px;
        padding: 15px;
    }
    
    .tpv-input {
        padding: 10px 14px;
        font-size: 16px;
    }
    
    .tpv-button {
        padding: 12px 24px;
        font-size: 15px;
    }
}

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

.tpv-error-message.show {
    animation: fadeIn 0.3s ease-out;
}

/* Modo alto contraste */
@media (prefers-contrast: high) {
    .tpv-input {
        border-width: 3px;
    }
    
    .tpv-button {
        border-width: 3px;
    }
}