/**
 * Yappy Payment Gateway Styles
 * Custom styles for Yappy payment method
 */

/* Dialog Overlay */
#dialog-yappy {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.yappy-dialog-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
    padding: 25px;
}

.yappy-dialog-content h4 {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.yappy-dialog-content p {
    text-align: center;
    color: #666;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 15px;
}

.yappy-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.yappy-close:hover {
    background: #f0f0f0;
    color: #333;
}

.yappy-payment-field {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    transition: all 0.3s ease;
}

.yappy-payment-field:hover {
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.1);
}

.yappy-payment-field .form-row {
    margin-bottom: 15px;
}

.yappy-payment-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.yappy-payment-field .woocommerce-input-wrapper input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

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

.yappy-payment-field .woocommerce-input-wrapper input.valid {
    border-color: #28a745;
    background-color: #f8fff9;
}

.yappy-payment-field .woocommerce-input-wrapper input.error {
    border-color: #dc3545;
    background-color: #fff8f8;
}

.yappy-instructions {
    background: #e7f3ff;
    border-left: 4px solid #007cba;
    padding: 15px;
    margin-top: 15px;
    border-radius: 0 6px 6px 0;
}

.yappy-instructions p {
    margin: 0;
    color: #005a87;
    font-size: 14px;
    line-height: 1.4;
}

/* Dialog Input Group */
.yappy-input-group {
    margin-bottom: 25px;
}

.yappy-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.yappy-input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

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

.yappy-input-group input.valid {
    border-color: #28a745;
    /* background-color: #f8fff9; */
}

.yappy-input-group input.error {
    border-color: #dc3545;
    background-color: #fff8f8;
}

/* Dialog Button Group */
.yappy-button-group {
    text-align: center;
}

.yappy-button-group .button {
    background: #007cba !important;
    color: white !important;
    border: none !important;
    padding: 12px 30px !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    font-size: 16px !important;
    transition: background-color 0.3s ease !important;
    cursor: pointer !important;
}

.yappy-button-group .button:hover {
    background: #005a87 !important;
}

.yappy-button-group .button:disabled {
    background: #6c757d !important;
    cursor: not-allowed !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .yappy-dialog-content {
        width: 95%;
        max-height: 95vh;
        margin: 20px;
        padding: 20px;
    }
    
    .yappy-dialog-content h4 {
        font-size: 18px;
    }
    
    .yappy-dialog-content p {
        font-size: 14px;
        padding: 0 10px;
    }
    
    .yappy-input-group input {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .yappy-button-group .button {
        width: 100%;
        padding: 15px 20px !important;
    }
}

@media (max-width: 480px) {
    .yappy-dialog-content {
        width: 98%;
        margin: 10px;
        padding: 15px;
    }
    
    .yappy-close {
        top: 10px;
        right: 15px;
    }
}

/* Animation for field appearance */
.yappy-payment-field {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.yappy-payment-field:not([style*="display: none"]) {
    opacity: 1;
    transform: translateY(0);
}

/* Error message styling */
.woocommerce-error,
.modal-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* Success message styling */
.woocommerce-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* Yappy gateway selection styling */
.yappy-gateway-selected {
    background: #f0f8ff !important;
    border-left: 4px solid #007cba !important;
}

.yappy-gateway-selected .payment_method_title {
    color: #007cba !important;
    font-weight: 600 !important;
}

/* Yappy selection notice */
.yappy-selection-notice {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
    animation: slideDown 0.5s ease;
}

.yappy-icon {
    font-size: 18px;
    animation: bounce 2s infinite;
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Phone number input specific styling */
#numero_yappy {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0.5px;
}

#numero_yappy::placeholder {
    color: #999;
    font-style: italic;
}

/* Loading state for Yappy field */
.yappy-payment-field.loading {
    opacity: 0.7;
    pointer-events: none;
}

.yappy-payment-field.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007cba;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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