/**
 * Stylesheet for WooCommerce Installment & Cheque Management Frontend UI
 * RTL-ready, mobile responsive, cleanly structured.
 *
 * @package WC_Custom_Payment_Gateways
 * @version 2.2.0
 */

.wc-installments-wrapper {
    margin: 20px 0;
    font-family: inherit;
    color: #1e293b;
    direction: rtl;
    text-align: right;
}

.wc-installments-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.wc-installments-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px 0;
}

.wc-installments-subtitle {
    font-size: 0.92rem;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

/* Single Order Installment Card */
.wc-installment-order-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 30px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.wc-installment-order-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.wc-installment-order-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.wc-installment-meta-primary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.order-badge {
    background: #0f172a;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 6px;
}

.order-date {
    color: #64748b;
    font-size: 0.85rem;
}

.order-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}

.order-status.badge-on-hold {
    background: #fef3c7;
    color: #92400e;
}

.order-status.badge-processing {
    background: #e0e7ff;
    color: #3730a3;
}

.order-status.badge-completed {
    background: #dcfce7;
    color: #166534;
}

.wc-installment-meta-finance {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.finance-item {
    font-size: 0.88rem;
    color: #475569;
}

.finance-item .label {
    margin-left: 4px;
}

.finance-item .val {
    font-weight: 700;
    color: #0f172a;
}

.finance-item.highlight {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 4px 10px;
    border-radius: 6px;
}

.finance-item.highlight .val {
    color: #15803d;
}

/* Grid Table */
.wc-installment-table-container {
    overflow-x: auto;
    padding: 4px;
}

.wc-installment-grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    text-align: right;
}

.wc-installment-grid-table th {
    background: #f1f5f9;
    color: #334155;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 1px solid #cbd5e1;
    white-space: nowrap;
}

.wc-installment-grid-table td {
    padding: 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 0.88rem;
}

.wc-installment-row:nth-child(even) {
    background: #fcfcfd;
}

.wc-installment-row:hover {
    background: #f8fafc;
}

.badge-num {
    background: #e2e8f0;
    color: #334155;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.wc-sayad-input {
    width: 100%;
    max-width: 220px;
    font-family: monospace, inherit;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    transition: all 0.2s;
}

.wc-sayad-input:focus {
    border-color: #0284c7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.hint {
    display: block;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 3px;
}

.wc-bank-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #ffffff;
}

.wc-cheque-file-input {
    font-size: 0.8rem;
    max-width: 200px;
}

.button.wc-view-cheque-btn {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 0.78rem;
    padding: 4px 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.button.wc-view-cheque-btn:hover {
    background: #e2e8f0;
}

/* Status Pills */
.status-pill {
    font-size: 0.76rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 9999px;
    display: inline-block;
    white-space: nowrap;
}

.status-pill.verified {
    background: #dcfce7;
    color: #15803d;
}

.status-pill.pending {
    background: #fef3c7;
    color: #b45309;
}

.status-pill.rejected {
    background: #fee2e2;
    color: #b91c1c;
}

/* Form Actions */
.wc-installment-form-actions {
    padding: 16px 20px;
    background: #fafafa;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.wc-installment-submit-btn {
    background: #059669 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    padding: 10px 22px !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-size: 0.92rem !important;
}

.wc-installment-submit-btn:hover {
    background: #047857 !important;
}

.wc-installment-submit-btn:active {
    transform: translateY(1px);
}

.wc-installment-submit-btn:disabled {
    background: #9ca3af !important;
    cursor: not-allowed;
}

/* Alerts */
.wc-installment-alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
}

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

/* Cheque Modal */
.wc-cheque-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.wc-cheque-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
}

.wc-cheque-modal-dialog {
    position: relative;
    z-index: 2;
    background: #ffffff;
    border-radius: 12px;
    max-width: 680px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.wc-cheque-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.wc-cheque-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
}

.wc-cheque-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
}

.wc-cheque-modal-close:hover {
    color: #0f172a;
}

.wc-cheque-modal-body {
    padding: 20px;
    text-align: center;
    background: #0f172a;
}

@media (max-width: 768px) {
    .wc-installment-order-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .wc-installment-grid-table th,
    .wc-installment-grid-table td {
        padding: 8px 10px;
    }
}
