/**
 * M-PESA Payment Gateway Styles - Version 3.0.0
 * Enhanced UI with better UX, alerts, and animations
 */

/* Main Container */
.mpesa-payment-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Header */
.mpesa-payment-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8f5e8;
}

.mpesa-logo-img {
    height: 60px;
    margin-bottom: 15px;
}

.mpesa-title {
    color: #00a651;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.mpesa-subtitle {
    color: #666;
    font-size: 16px;
    margin: 0;
    line-height: 1.5;
}

/* Payment Info Banner (replaces order summary) */
.mpesa-payment-info {
    background: linear-gradient(135deg, #00a651, #00c965);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.payment-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 20px;
}

.payment-amount,
.payment-order {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.amount-label,
.order-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.amount-value,
.order-value {
    font-size: 24px;
    font-weight: 700;
}

/* Alert/Status Messages */
.payment-status {
    margin: 20px 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    border-radius: 8px;
}

.payment-status.show {
    opacity: 1;
    transform: translateY(0);
}

.status-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 8px;
    position: relative;
    border-left: 4px solid;
}

.payment-status.success .status-content {
    background-color: #f0f9ff;
    border-left-color: #00a651;
    color: #0f766e;
}

.payment-status.error .status-content {
    background-color: #fef2f2;
    border-left-color: #dc2626;
    color: #dc2626;
}

.payment-status.warning .status-content {
    background-color: #fffbeb;
    border-left-color: #f59e0b;
    color: #92400e;
}

.payment-status.info .status-content {
    background-color: #eff6ff;
    border-left-color: #3b82f6;
    color: #1e40af;
}

.status-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.status-text {
    flex: 1;
}

.status-message {
    font-size: 15px;
    line-height: 1.5;
}

.status-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    margin-left: 10px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.status-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Payment Methods */
.mpesa-payment-methods {
    margin-bottom: 25px;
}

.mpesa-payment-methods h3 {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.payment-method-option {
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    margin-bottom: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.payment-method-option:hover {
    border-color: #00a651;
    background: #f8fff8;
}

.payment-method-option.selected {
    border-color: #00a651;
    background: #f0f9ff;
}

.method-radio {
    display: flex;
    align-items: flex-start;
}

.method-radio input[type="radio"] {
    display: none;
}

.method-radio label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    width: 100%;
}

/* Custom Radio Button Icon - Fixed for all devices */
.radio-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    max-width: 22px;
    max-height: 22px;
    border: 2px solid #ccc;
    border-radius: 50%;
    margin-right: 15px;
    margin-top: 2px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-sizing: border-box;
    background-color: white;
}

.method-radio input:checked+label .radio-icon {
    border-color: #00a651;
    background: #00a651;
}

.method-radio input:checked+label .radio-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    transform: translate(-50%, -50%);
}

.method-info {
    flex: 1;
    min-width: 0;
}

.method-info h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.method-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Payment Forms */
.payment-form {
    display: none;
    background: #f9f9f9;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e5e5e5;
}

.payment-form.active {
    display: block;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 16px;
}

/* Fixed Phone Input Styling */
.phone-input-wrapper {
    width: 100%;
}

.phone-input-container {
    display: flex;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease;
    max-width: 100%;
}

.phone-input-container:focus-within {
    border-color: #00a651;
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

.phone-prefix {
    background: #f5f5f5;
    padding: 12px 15px;
    border-right: 1px solid #ddd;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

#phone-number {
    flex: 1;
    border: none;
    padding: 12px 15px;
    font-size: 16px;
    outline: none;
    background: white;
    min-width: 0;
    /* Prevent overflow */
}

#phone-number.valid {
    background-color: #f0f9ff;
}

#phone-number.error {
    background-color: #fef2f2;
}

/* Transaction Code Input */
#transaction-code {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: white;
}

#transaction-code:focus {
    border-color: #00a651;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

/* Input Help Text */
.input-help {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    margin-bottom: 0;
}

/* Manual Payment Instructions */
.manual-instructions {
    margin-bottom: 20px;
}

.manual-instructions h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.payment-steps {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 0;
    border: 1px solid #e5e5e5;
}

.payment-steps li {
    margin-bottom: 10px;
    font-size: 15px;
    line-height: 1.4;
    color: #333;
}

.payment-steps li:last-child {
    margin-bottom: 0;
}

/* Buttons */
.mpesa-button {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mpesa-button.primary {
    background: linear-gradient(135deg, #00a651, #00c965);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 166, 81, 0.3);
    border-radius: 12px;
}

.mpesa-button.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 166, 81, 0.4);
}

.mpesa-button.secondary {
    background: #f5f5f5;
    color: #666;
    border: 2px solid #ddd;
}

.mpesa-button.secondary:hover:not(:disabled) {
    background: #e5e5e5;
    color: #333;
}

.mpesa-button:disabled,
.mpesa-button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    pointer-events: none;
    background-color: #ccc !important;
    color: #666 !important;
    border-color: #ccc !important;
}

.payment-form.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.payment-method-option input:disabled+label {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.payment-method-option input:disabled+label .method-info {
    opacity: 0.6;
}

/* Button Loading State */
.mpesa-button.loading .button-text {
    opacity: 0;
}

.button-loader {
    display: none;
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.mpesa-button.loading .button-loader {
    display: block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Actions */
.mpesa-actions {
    margin: 25px 0;
}

/* Footer */
.mpesa-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e8f5e8;
}

.powered-by {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.footer-link {
    color: #00a651;
    text-decoration: none;
    font-weight: 600;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mpesa-payment-container {
        margin: 10px;
        padding: 15px;
    }

    .mpesa-title {
        font-size: 24px;
    }

    .payment-details {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .payment-method-option {
        padding: 15px;
    }

    .payment-form {
        padding: 20px;
    }
}

/* Loading Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* Loader Animation */
.loader {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FF3D00;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.loader:before,
.loader:after {
    content: "";
    position: absolute;
    border-radius: 50%;
    inset: 0;
    background: #fff;
    transform: rotate(0deg) translate(18px);
    animation: rotate 1s ease infinite;
}

.loader:after {
    animation-delay: 0.5s
}

@keyframes rotate {
    100% {
        transform: rotate(360deg) translate(18px)
    }
}