/* Direct Payment Modal Styles - Arabic RTL Support */
.direct-payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    direction: rtl;
    font-family: 'Arial', 'Tahoma', sans-serif;
}

/* Force show PayMob payment buttons on order-pay page */
body.woocommerce-order-pay button[type="submit"],
body.woocommerce-order-pay input[type="submit"],
body.woocommerce-order-pay button[name="woocommerce_pay"],
body.woocommerce-order-pay input[name="woocommerce_pay"],
body.woocommerce-order-pay #place_order {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: auto !important;
    height: auto !important;
    margin: 20px auto !important;
    padding: 15px 30px !important;
    background: #056839 !important;
    color: white !important;
    border: none !important;
    border-radius: 5px !important;
    font-size: 18px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    text-align: center !important;
}

body.woocommerce-order-pay button[type="submit"]:hover,
body.woocommerce-order-pay input[type="submit"]:hover {
    background: #044d2a !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 600px;
    margin: 50px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    padding: 25px 30px 20px;
    border-bottom: 2px solid #f1f1f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #056839, #044d2a);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-modal:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
}

/* Form Styles - RTL Support */
#direct-payment-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    direction: rtl;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    text-align: right;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
    text-align: right;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #fff;
    text-align: right;
    direction: rtl;
}

.form-group input[type="tel"],
.form-group input[type="number"] {
    direction: ltr;
    text-align: left;
}

.selected-amount {
    background: linear-gradient(135deg, #056839, #044d2a);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 18px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(5, 104, 57, 0.3);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #056839;
    box-shadow: 0 0 0 3px rgba(5, 104, 57, 0.15);
    transform: translateY(-1px);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.currency-symbol {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-weight: bold;
    pointer-events: none;
    margin-top: 12px;
}

.form-group:has(input[name="donation_amount"]) input {
    padding-right: 45px;
}

textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-cancel {
    padding: 12px 25px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-primary {
    padding: 12px 30px;
    background: linear-gradient(135deg, #056839, #044d2a);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #044d2a, #033a21) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(5, 104, 57, 0.4) !important;
}

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

.btn-spinner {
    font-size: 14px;
}

/* Direct Payment Section Styles */
.direct-payment-section {
    animation: fadeInUp 0.5s ease-out;
    direction: rtl;
    text-align: right;
}

.donation-amounts {
    margin-bottom: 20px;
}

.amount-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    direction: rtl;
}

.amount-btn {
    padding: 12px 20px;
    border: 2px solid #056839;
    background: white;
    color: #056839;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
    min-width: 80px;
    text-align: center;
}

.amount-btn:hover {
    background: #044d2a;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.amount-btn.active {
    background: #056839;
    color: white;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

#custom-amount {
    padding: 12px 15px;
    border: 2px solid #056839;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    width: 150px;
    direction: ltr; /* Numbers should be LTR */
}

#custom-amount:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

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

#open-direct-payment {
    font-size: 18px;
    padding: 15px 30px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#open-direct-payment:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

/* Notification Styles */
.direct-payment-notification {
    animation: notificationSlideIn 0.3s ease-out;
}

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

/* Body lock when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .modal-content {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    
    .modal-header,
    .modal-body {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .btn-cancel,
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    .direct-payment-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .modal-header h3 {
        font-size: 20px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Loading animation for the spinner */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-spinner::before {
    content: "⟳";
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Extra specific rules to override theme - MUST BE AT END */
#direct-payment-modal .modal-content .btn-primary:hover:not(:disabled),
button.btn-primary:hover:not(:disabled),
.modal-content button.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #044d2a, #033a21) !important;
    color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(5, 104, 57, 0.4) !important;
}

/* Ensure button text stays white */
#direct-payment-modal .btn-primary .btn-text,
.btn-primary .btn-text {
    color: #ffffff !important;
}
