/**
 * Redsys Frontend Styles
 * 
 * @package Payment_Gateway_Redsys
 * @since 1.0.0
 */

/* Reset and base styles */
.redsys-payment-form,
.redsys-payment-container,
.redsys-success-container,
.redsys-error-container {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
}

.redsys-payment-form *,
.redsys-payment-container *,
.redsys-success-container *,
.redsys-error-container * {
    box-sizing: inherit;
}

/* Payment Container */
.redsys-payment-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Order ID Display */
.redsys-order-id-display {
    background: #0073aa;
    color: white;
    padding: 16px 24px;
    text-align: center;
    border-bottom: 1px solid #005a87;
}

.redsys-order-id-display h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.redsys-order-id-display .order-id-value {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 2px;
}

/* Payment Summary */
.redsys-payment-summary {
    margin: 20px 20px 30px 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.redsys-payment-summary h3 {
    margin: 0 0 15px 0;
    color: #0073aa;
    font-size: 1.2em;
    font-weight: 600;
}

.payment-details {
    margin: 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e1e5e9;
}

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

.detail-row .label {
    font-weight: 500;
    color: #555;
}

.detail-row .value {
    font-weight: 600;
    color: #333;
}

.detail-row .value.amount {
    font-size: 1.1em;
    color: #0073aa;
}

/* Payment Form */
.redsys-payment-form {
    margin: 0;
}

.form-actions {
    text-align: center;
    margin: 20px;
    padding-bottom: 10px;
}

.redsys-pay-button,
.redsys-confirm-button,
.btn {
    display: inline-block;
    padding: 12px 30px;
    background: #0073aa;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 150px;
}

.redsys-pay-button:hover,
.redsys-confirm-button:hover,
.btn:hover {
    background: #005a87;
    color: #ffffff;
    text-decoration: none;
}

.redsys-pay-button:disabled,
.redsys-confirm-button:disabled,
.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-primary {
    background: #0073aa;
}

.btn-secondary {
    background: #6c757d;
    margin-left: 10px;
}

.btn-secondary:hover {
    background: #5a6268;
}

.security-notice {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.security-notice .icon-lock::before {
    content: "🔒";
    margin-right: 5px;
}

/* Success Container */
.redsys-success-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.success-header {
    margin-bottom: 30px;
    padding: 30px 20px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
}

.success-header .icon-check-circle::before {
    content: "✅";
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.success-header h2 {
    margin: 0 0 10px 0;
    color: #155724;
    font-size: 1.8em;
}

.success-header p {
    margin: 0;
    font-size: 1.1em;
}

/* Error Container */
.redsys-error-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.error-header {
    margin-bottom: 30px;
    padding: 30px 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
}

.error-header .icon-warning-circle::before {
    content: "⚠️";
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.error-header h2 {
    margin: 0 0 10px 0;
    color: #721c24;
    font-size: 1.8em;
}

.error-header p {
    margin: 0;
    font-size: 1.1em;
}

/* Transaction Details */
.transaction-details {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    text-align: left;
}

.transaction-details h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.2em;
    text-align: center;
}

.status-completed {
    color: #28a745;
    font-weight: 600;
}

.status-failed {
    color: #dc3545;
    font-weight: 600;
}

/* Receipt Actions */
.receipt-actions,
.retry-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Error Messages */
.redsys-errors,
.redsys-error {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
}

.redsys-errors h3 {
    margin: 0 0 15px 0;
    color: #721c24;
}

.error-list {
    margin: 0 0 15px 0;
    padding-left: 20px;
}

.error-list li {
    margin-bottom: 5px;
}

.error-message {
    margin: 0 0 15px 0;
    font-weight: 500;
}

/* Loading States */
.redsys-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.redsys-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: redsys-spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .redsys-payment-container,
    .redsys-success-container,
    .redsys-error-container {
        margin: 10px;
        padding: 15px;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .detail-row .value {
        font-size: 1.1em;
    }
    
    .receipt-actions,
    .retry-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
        margin: 5px 0;
    }
    
    .success-header,
    .error-header {
        padding: 20px 15px;
    }
    
    .transaction-details {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .redsys-payment-summary {
        padding: 15px;
    }
    
    .success-header h2,
    .error-header h2 {
        font-size: 1.5em;
    }
    
    .success-header .icon-check-circle::before,
    .error-header .icon-warning-circle::before {
        font-size: 36px;
    }
}

/* Print Styles */
@media print {
    .redsys-payment-form,
    .receipt-actions,
    .retry-actions {
        display: none !important;
    }
    
    .redsys-success-container,
    .redsys-error-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .success-header,
    .error-header {
        background: none !important;
        border: 1px solid #ccc !important;
        color: #000 !important;
    }
    
    .transaction-details {
        background: none !important;
        border: 1px solid #ccc;
    }
}