/* Sarea Wallet Frontend Styles */

/* ===== Basic Styles ===== */

.sarea-wallet-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
    max-width: 400px;
    min-width: 320px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f9f0 100%);
}

.toast.error {
    border-color: #f44336;
    background: linear-gradient(135deg, #fdf2f2 0%, #fef8f8 100%);
}

.toast.warning {
    border-color: #ff9800;
    background: linear-gradient(135deg, #fff8e1 0%, #fffbf0 100%);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.toast.success .toast-icon {
    background: #4caf50;
}

.toast.error .toast-icon {
    background: #f44336;
}

.toast.warning .toast-icon {
    background: #ff9800;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
    font-size: 14px;
}

.toast-message {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: #666;
}

/* Header Wallet Balance */
.sarea-wallet-header-balance {
    display: inline-flex;
    align-items: center;
    margin: 0 10px;
    padding: 8px 15px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    vertical-align: middle;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sarea-wallet-header-balance:hover {
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.sarea-wallet-header-balance .wallet-icon {
    margin-left: 8px;
    font-size: 16px;
}

/* My Account Wallet Page */
.sarea-wallet-account-page {
    max-width: 100%;
}

.wallet-balance-section {
    /*background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);*/
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: center;
}

.wallet-balance-section h2 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.current-balance {
    font-size: 1.8em;
    font-weight: bold;
}

.balance-label {
    color: #6c757d;
    margin-left: 10px;
}

.balance-amount {
    color: #0073aa;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Wallet Actions Section */
.wallet-actions-section {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.wallet-actions-section h3 {
    color: #495057;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.wallet-actions-section .description {
    color: #6c757d;
    margin-bottom: 25px;
    line-height: 1.6;
    text-align: right;
}

/* Charge Request Form */
.charge-request-form {
    max-width: 600px;
}

.charge-request-form .sarea-wallet-form-row {
    margin-bottom: 20px;
}

.charge-request-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.charge-request-form input[type="number"],
.charge-request-form select,
.charge-request-form input[type="text"],
.charge-request-form textarea {
    width: 100% !important;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.charge-request-form input:focus,
.charge-request-form select:focus,
.charge-request-form textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.charge-request-form small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 14px;
}

.charge-request-form .button {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.charge-request-form .button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Transactions Section */
.wallet-transactions-section {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 25px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.wallet-transactions-section h3 {
    color: #495057;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.no-transactions {
    text-align: center;
    color: #6c757d;
    padding: 40px;
    font-style: italic;
}

/* Transactions Table */
.transactions-table-wrapper {
    overflow-x: auto !important;
    margin-top: 20px;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 20px;
    display: block;
}

.transactions-table {
    min-width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: max-content;
}

.transactions-table thead {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: white;
}

.transactions-table th,
.transactions-table td {
    padding: 15px 12px;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    border-bottom: 1px solid #dee2e6;
    max-width: 400px;
}

.transactions-table th {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 14px;
}

.transactions-table tbody tr:hover {
    background: #f8f9fa;
}

.transactions-table .voucher-number {
    font-weight: bold;
    color: #0073aa;
    font-family: monospace;
}

/* Transaction Type Badges */
.type-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-badge.type-credit {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.type-badge.type-debit {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Amount Styling */
.amount.credit {
    color: #198754;
    font-weight: bold;
}

.amount.debit {
    color: #dc3545;
    font-weight: bold;
}

.balance-after {
    font-weight: 600;
    color: #495057;
}

.transaction-date {
    color: #6c757d;
    font-size: 14px;
}

.description {
    color: #6c757d;
    font-size: 14px;
    text-align: right;
}

/* Payment Gateway Styles */
.sarea-wallet-payment-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 2px solid #dee2e6;
}

.wallet-balance-info {
    margin-top: 15px;
}

.wallet-balance-info p {
    margin: 12px 0;
    font-size: 16px;
}

.wallet-sufficient {
    color: #198754;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.wallet-insufficient {
    color: #dc3545;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.wallet-balance-info .dashicons {
    font-size: 18px;
    line-height: 1;
    vertical-align: middle;
    margin-left: 8px;
}

/* Order Details Wallet Info */
.wallet-payment-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.wallet-payment-info h2 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.wallet-payment-info .woocommerce-table {
    margin: 0;
}

.wallet-payment-info .woocommerce-table th {
    background: #e9ecef;
    font-weight: 600;
}

/* Loading States */
.form-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.form-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 50%;
    width: 24px;
    height: 24px;
    margin: -12px -12px 0 0;
    border: 3px solid #dee2e6;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: wallet-spin 1s linear infinite;
}

@keyframes wallet-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success/Error Messages */
.wallet-message {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 600;
}

.wallet-message.success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.wallet-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== ENHANCED ACCORDION AND FORM STYLES ===== */
:root {
    --primary-color: #000;
    --primary-light: #e3f2fd;
    --primary-dark: #004a7c;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --text-primary: #2c3e50;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sarea-wallet-accordion-enhanced {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Tab Container */
.wallet-tab-container {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.wallet-tab-container:last-child {
    border-bottom: none;
}

/* Tab Header */
.wallet-tab-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    cursor: pointer;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: none;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.wallet-tab-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(0, 113, 171, 0.1) 100%);
    transition: width 0.4s ease;
    z-index: 1;
}

.wallet-tab-header:hover::before {
    width: 100%;
}

.wallet-tab-header:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.wallet-tab-container.active .wallet-tab-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.wallet-tab-container.active .wallet-tab-header::before {
    display: none;
}

.tab-icon {
    margin-right: 12px;
    display: flex;
    align-items: center;
    z-index: 2;
    position: relative;
}

.wallet-tab-header h3 {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    z-index: 2;
    position: relative;
}

.tab-arrow {
    margin-left: 12px;
    transition: transform 0.3s ease;
    z-index: 2;
    position: relative;
}

.wallet-tab-container.active .tab-arrow {
    transform: rotate(180deg);
}

.wallet-tab-container.active h3 {
    color: white;
}

/* Tab Content */
.wallet-tab-content {
    padding: 0;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    position: relative;
}

.wallet-tab-container.active .wallet-tab-content {
    padding: 32px;
    opacity: 1;
    max-height: 2000px;
}

/* إصلاح مشكلة الانحناء في التاب الثاني */
#sarea-content-history {
    overflow: visible;
}

#sarea-content-history .transactions-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    margin: 0;
}

/* Progress Indicator */
.progress-container {
    margin-bottom: 32px;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-light) 0%, white 100%);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    position: relative;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 8px;
    transition: var(--transition);
    position: relative;
    z-index: 2;
}

.step.active .step-circle {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(0, 113, 171, 0.2);
}

.step.completed .step-circle {
    background: var(--success-color);
    color: white;
}

.step span {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}

.step.active span {
    color: var(--primary-color);
    font-weight: 600;
}

.progress-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 2px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Form Styles */
.charge-request-form-enhanced {
    position: relative;
}

.wallet-step-enhanced {
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.step-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
}

.sarea-wallet-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.sarea-wallet-form-group {
    margin-bottom: 24px;
}

.form-label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.label-text {
    margin-right: 4px;
}

.required {
    color: var(--error-color);
    font-weight: bold;
}

.select-wrapper,
.input-wrapper {
    position: relative;
}

.select-wrapper select,
.input-wrapper input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
}

.select-wrapper select:focus,
.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 113, 171, 0.1);
}

.select-wrapper select:hover,
.input-wrapper input:hover {
    border-color: var(--primary-color);
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.method-description {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(0, 113, 171, 0.05) 100%);
    border-radius: 8px;
    border: 1px solid rgba(0, 113, 171, 0.2);
    display: none;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.conversion-result {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f9f0 100%);
    border-radius: 8px;
    border: 1px solid #4caf50;
    color: #2e7d32;
    font-weight: 600;
    text-align: center;
    animation: fadeInUp 0.3s ease-out;
}

/* Enhanced Button Styles */
.step-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    gap: 16px;
}

.btn-prev,
.btn-next,
.btn-submit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-next,
.btn-submit {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    margin-left: auto;
}

.btn-prev {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-prev:hover,
.btn-next:hover,
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-submit {
    background: linear-gradient(135deg, var(--success-color) 0%, #388e3c 100%);
}

.btn-prev:active,
.btn-next:active,
.btn-submit:active {
    transform: translateY(0);
}

/* Enhanced Transaction Styles */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-secondary);
}

.empty-icon {
    margin-bottom: 16px;
    color: var(--border-color);
}

.empty-state h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 18px;
}

.transactions-wrapper {
    animation: slideInUp 0.4s ease-out;
}

.transactions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.transactions-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
}

.transactions-count {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.transactions-table-enhanced {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.transactions-table-enhanced thead {
    background: linear-gradient(135deg, var(--bg-light) 0%, #f1f5f9 100%);
}

.transactions-table-enhanced th {
    padding: 16px 12px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 14px;
}

.transactions-table-enhanced td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    vertical-align: middle;
}

.transaction-row {
    transition: var(--transition);
}

.transaction-row:hover {
    background: var(--bg-light);
    transform: translateX(4px);
}

.voucher-badge {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* ✅ Scoped: نخلي شكل الـ badge المرن خاص بجدول المعاملات المحسن فقط */
.transactions-table-enhanced .type-badge,
.sarea-wallet-unified .transactions-table-enhanced .type-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
}


.type-badge.type-credit {
    background: #e8f5e8;
    color: #2e7d32;
}

.type-badge.type-debit {
    background: #fff3e0;
    color: #f57c00;
}

.amount-value {
    font-weight: 600;
}

.amount.credit {
    color: var(--success-color);
}

.amount.debit {
    color: var(--warning-color);
}

.balance-value {
    font-weight: 600;
    color: var(--primary-color);
}

.date-value {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Field Error Styles */
.field-error {
    display: none;
    margin-top: 6px;
    color: var(--error-color);
    font-size: 14px;
    font-weight: 500;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1) !important;
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* =====================================================
   ===== NEW UNIFIED LAYOUT STYLES - التصميم الموحد =====
   ===================================================== */

/* Compact Balance Header */
.sarea-wallet-unified .wallet-balance-compact {
    background: linear-gradient(135deg, #000 0%, #004a7c 100%);
    color: white;
    padding: 5px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 113, 171, 0.25);

}

.sarea-wallet-unified .wallet-balance-compact .balance-title {
    font-size: 18px;
    font-weight: 800;
    font-family: Cairo;
    opacity: 0.9;
}

.sarea-wallet-unified .wallet-balance-compact .balance-value {
    font-size: 24px;
    font-weight: 800;
    font-family: Cairo;
}

.sarea-wallet-unified .wallet-balance-compact .balance-value,
.sarea-wallet-unified .wallet-balance-compact .balance-value * {
    color: white !important;
}

/* Three Sections Grid */
.sarea-wallet-unified .wallet-three-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 15px !important;
}

.sarea-wallet-unified .wallet-section-box {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.sarea-wallet-unified .wallet-section-full {
    grid-column: 1 / -1;
}

.sarea-wallet-unified .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    font-size: 20px;
    font-weight: 600;
    /*color: #1e293b;*/
    color:#000 !important;
    font-family: Cairo;
}

.sarea-wallet-unified .section-title svg {
    color: #000;
    flex-shrink: 0;
}

.sarea-wallet-unified .section-title .tx-badge {
    margin-right: auto;
    color: #000;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.sarea-wallet-unified .section-body {
    padding: 16px;
}

/* Compact Form Styles */
.sarea-wallet-unified .recharge-form-compact,
.sarea-wallet-unified .compact-transfer-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sarea-wallet-unified .form-field-compact {
    position: relative;
}

.sarea-wallet-unified .form-field-compact select,
.sarea-wallet-unified .form-field-compact input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: white;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.sarea-wallet-unified .form-field-compact select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 32px;
    cursor: pointer;
}

.sarea-wallet-unified .form-field-compact select:focus,
.sarea-wallet-unified .form-field-compact input:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 113, 171, 0.1);
}

.sarea-wallet-unified .form-field-compact input::placeholder {
    color: #94a3b8;
}

/* Method Description Compact */
.sarea-wallet-unified .method-desc-compact {
    display: none;
    margin-top: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f7ff 100%);
    border-radius: 6px;
    font-size: 12px;
    color: #005a87;
    line-height: 1.5;
    border: 1px solid #b3d9f2;
}

/* Conversion Compact */
.sarea-wallet-unified .conversion-compact {
    display: none;
    margin-top: 6px;
    padding: 8px 12px;
    background: #dcfce7;
    border-radius: 6px;
    font-size: 16px;
    color: #166534;
    text-align: center;
    font-weight: 600;
    border: 1px solid #86efac;
}

/* Compact Buttons */
.sarea-wallet-unified .btn-recharge,
.sarea-wallet-unified .btn-transfer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.sarea-wallet-unified .btn-recharge {
    background: linear-gradient(135deg, #000 0%, #005a87 100%);
}

.sarea-wallet-unified .btn-recharge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.sarea-wallet-unified .btn-transfer {
    background: linear-gradient(135deg, #000 0%, #005a87 100%);
}

.sarea-wallet-unified .btn-transfer:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 113, 171, 0.3);
}

.sarea-wallet-unified .btn-recharge:disabled,
.sarea-wallet-unified .btn-transfer:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Transfer Message */
.sarea-wallet-unified .transfer-msg {
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
    margin-top: 8px;
    display: none;
}

.sarea-wallet-unified .transfer-msg:not(:empty) {
    display: block;
}

.sarea-wallet-unified .transfer-msg.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.sarea-wallet-unified .transfer-msg.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.sarea-wallet-unified .no-transfer-msg {
    text-align: center;
    color: #64748b;
    font-size: 13px;
    padding: 20px 0;
    margin: 0;
}

/* Spinner Small */
.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Field Error in Unified */
.sarea-wallet-unified .field-error {
    display: none;
    margin-top: 4px;
    font-size: 12px;
    color: #ef4444;
    font-weight: 500;
}

/* Empty State Compact */
.sarea-wallet-unified .empty-state {
    padding: 40px 20px;
}

.sarea-wallet-unified .empty-state svg {
    opacity: 0.4;
}

.sarea-wallet-unified .empty-state h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.sarea-wallet-unified .empty-state p {
    font-size: 13px;
}


/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
    .sarea-wallet-header-balance {
        font-size: 12px;
        padding: 6px 12px;
        margin: 0 5px;
    }

    .sarea-wallet-header-balance .wallet-icon {
        margin-left: 6px;
        font-size: 14px;
    }

    .current-balance {
        font-size: 1.5em;
    }

    .transactions-table-wrapper {
        /*margin: 0 -25px;*/
    }

    .transactions-table th,
    .transactions-table td {
        padding: 12px 8px;
        font-size: 14px;
    }

    .wallet-balance-section,
    .wallet-actions-section,
    .wallet-transactions-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .sarea-wallet-form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .wallet-tab-content {
        padding: 20px 16px;
    }

    .progress-container {
        padding: 16px;
    }

    .step span {
        font-size: 10px;
    }

    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .transactions-table-enhanced {
        font-size: 12px;
    }

    .transactions-table-enhanced th,
    .transactions-table-enhanced td {
        padding: 8px 6px;
    }

    .step-actions {
        flex-direction: column;
    }

    .btn-prev {
        order: 2;
    }

    .btn-next,
    .btn-submit {
        order: 1;
        margin-left: 0;
    }

    .toast-container {
        left: 20px;
        right: 20px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    /* Unified Layout Mobile */
    .sarea-wallet-unified .wallet-three-sections {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sarea-wallet-unified .wallet-balance-compact {
        padding: 14px 16px;
        flex-direction: column;
        text-align: center;
        gap: 4px;
    }

    .sarea-wallet-unified .wallet-balance-compact .balance-value {
        font-size: 22px;
    }

    .sarea-wallet-unified .section-body {
        padding: 14px;
    }

    .sarea-wallet-unified .form-field-compact select,
    .sarea-wallet-unified .form-field-compact input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .sarea-wallet-unified .btn-recharge,
    .sarea-wallet-unified .btn-transfer {
        padding: 11px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .type-badge {
        padding: 3px 8px;
        font-size: 11px;
    }

    .charge-request-form .button {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }

    .sarea-wallet-unified .section-title {
        font-size: 16px;
        padding: 12px 14px;
    }
}

/* RTL Support */
body.rtl .sarea-wallet-header-balance .wallet-icon {
    margin-right: 8px;
    margin-left: 0;
}

body.rtl .balance-label {
    margin-right: 10px;
    margin-left: 0;
}

body.rtl .wallet-balance-info .dashicons {
    margin-right: 8px;
    margin-left: 0;
}

body.rtl .transactions-table th,
body.rtl .transactions-table td {
    text-align: right;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .sarea-wallet-header-balance {
        background: #000;
        border: 2px solid #fff;
    }

    .wallet-balance-section,
    .wallet-actions-section,
    .wallet-transactions-section {
        border: 2px solid #000;
    }

    .type-badge {
        border: 2px solid #000;
    }
}

/* Print Styles */
@media print {
    .sarea-wallet-header-balance,
    .charge-request-form,
    .wallet-actions-section {
        display: none;
    }

    .transactions-table {
        border: 1px solid #000;
    }

    .transactions-table th,
    .transactions-table td {
        border: 1px solid #000;
        color: #000;
        background: #fff;
    }

    .wallet-balance-section {
        border: 2px solid #000;
        background: #fff !important;
    }

    .toast-container {
        display: none;
    }

    .sarea-wallet-unified #section-recharge,
    .sarea-wallet-unified #section-transfer {
        display: none !important;
    }
}



/* توسيع جدول سجل المعاملات + عمود الوصف */
#sarea-content-history .transactions-table-enhanced,
.sarea-wallet-unified .transactions-table-enhanced {
    min-width: 800px;
}

#sarea-content-history .transactions-table-enhanced th:nth-child(6),
#sarea-content-history .transactions-table-enhanced td:nth-child(6),
.sarea-wallet-unified .transactions-table-enhanced th:nth-child(6),
.sarea-wallet-unified .transactions-table-enhanced td:nth-child(6) {
    width: 25%;
    min-width: 180px;
    white-space: normal;
}

#sarea-content-history .transactions-table-enhanced th,
#sarea-content-history .transactions-table-enhanced td,
.sarea-wallet-unified .transactions-table-enhanced th,
.sarea-wallet-unified .transactions-table-enhanced td {
    max-width: none;
}


@media (max-width: 768px){
    #sarea-content-history .transactions-table-wrapper,
    .sarea-wallet-unified .transactions-table-wrapper {
        overflow-x: auto;
    }

    #sarea-content-history .transactions-table-enhanced,
    .sarea-wallet-unified .transactions-table-enhanced {
        width: 100% !important;
        min-width: 600px;
        table-layout: fixed;
    }

    #sarea-content-history .transactions-table-enhanced th,
    #sarea-content-history .transactions-table-enhanced td,
    .sarea-wallet-unified .transactions-table-enhanced th,
    .sarea-wallet-unified .transactions-table-enhanced td {
        padding: 10px 6px;
        font-size: 12px;
        white-space: normal;
        word-break: break-word;
        max-width: none;
    }
}


/* =========================================================
   ✅ SAREA WALLET CSS SCOPE PATCH
   - يحصر التأثيرات العامة داخل صفحة المحفظة فقط
   - يمنع تعارضات الثيم/ووكومرس خارج المحفظة
   ========================================================= */

/* 1) بديل آمن لـ * { box-sizing: border-box } لكن Scoped */
.sarea-wallet-account-page *,
.sarea-wallet-unified * {
    box-sizing: border-box;
}

/* 2) بديل آمن لـ body { direction: rtl } لكن Scoped */
.sarea-wallet-account-page,
.sarea-wallet-unified {
    direction: rtl;
    line-height: 1.6;
    font-family: Cairo, Tahoma, Geneva, Verdana, sans-serif;
}

/* 3) خلفية الصفحة الخاصة بالمحفظة فقط (بدل body background) */
.sarea-wallet-account-page,
.sarea-wallet-unified {

}

/* =========================================================
   ✅ Fix: إزالة فراغ Elementor أعلى صفحة المحفظة على الموبايل فقط
   - السبب: Elementor يضيف margin-top:50px للعنصر 79db6ca5
   - التأثير: فراغ كبير فوق عنوان/رصيد المحفظة
   ========================================================= */

@media (max-width: 768px) {

    /* ✅ حصر التعديل داخل صفحة الحساب (WooCommerce Account) */
    body.woocommerce-account .elementor-element.elementor-element-79db6ca5 {
        margin-top: 0 !important;
        margin-bottom: 12px !important; /* نخلي نزول بسيط */
    }

    /* احتياط: أحياناً يكون العنصر داخل post-4391 حسب لقطة الشاشة */
    body.woocommerce-account .post-4391 .elementor-element.elementor-element-79db6ca5 {
        margin-top: 0 !important;
        margin-bottom: 12px !important;
    }
}

/* =========================================
   ✅ زر عرض كافة المعاملات / آخر 3 معاملات
   ========================================= */
.sarea-wallet-unified .section-title .tx-toggle-link{
    margin-right: 10px;
    font-size: 12px;
    font-weight: 600;
    color:#000;
    background: #e3f2fd;
    border: 1px solid #b3d9f2;
    padding: 4px 10px;
    border-radius: 999px;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.sarea-wallet-unified .section-title .tx-toggle-link:hover{
    background: #d9eefc;
    text-decoration: none;
}

/* =========================================================
   ✅ MOBILE FULL-WIDTH OPTIMIZATION
   - تصميم مثل تطبيقات الموبايل
   - البطاقات تمتد من الحافة للحافة مع هوامش بسيطة جداً
   ========================================================= */

@media (max-width: 600px) {

    /* ✅ إزالة padding/margin من حاويات WooCommerce الخارجية */
    .woocommerce-account .woocommerce-MyAccount-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .woocommerce-account .woocommerce-MyAccount-content > * {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* ✅ إزالة padding من Elementor containers */
    .woocommerce-account .elementor-widget-container {
        padding: 0 !important;
    }

    .woocommerce-account .e-con-inner,
    .woocommerce-account .elementor-element {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* ✅ إزالة padding من الحاوية الرئيسية */
    .sarea-wallet-account-page.sarea-wallet-unified {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* ✅ شريط الرصيد - ممتد بالكامل مع هوامش صغيرة */
    .sarea-wallet-unified .wallet-balance-compact {
        margin-right: 6px !important;
        margin-left: 6px !important;
        margin-top: 0px !important;
        border-radius: 8px !important;
        padding: 12px 16px !important;
    }

    /* ✅ شبكة البطاقات - هوامش صغيرة جداً */
    .sarea-wallet-unified .wallet-three-sections {
        gap: 6px !important;
        padding: 0 6px !important;
    }

    /* ✅ البطاقات - ممتدة للحواف تقريباً */
    .sarea-wallet-unified .wallet-section-box {
        border-radius: 6px !important;
        margin-right: 0px !important;
        margin-left: 0px !important;
        margin-top: 0px !important;
        margin-bottom: 15px !important;
        border-left: solid #D3D3D3 1px !important;
        border-right: solid #D3D3D3 1px !important;
        border: solid #000 2px;
        
    }

    /* ✅ عنوان القسم - padding أقل */
    .sarea-wallet-unified .section-title {
        padding: 10px 12px !important;
        font-size: 15px !important;
    }

    /* ✅ محتوى القسم - padding أقل للحقول تمتد أكثر */
    .sarea-wallet-unified .section-body {
        padding: 10px !important;
    }

    /* ✅ الفورم - بدون gap كبير */
    .sarea-wallet-unified .recharge-form-compact,
    .sarea-wallet-unified .compact-transfer-form {
        gap: 8px !important;
    }

    /* ✅ حقول الإدخال - padding داخلي أقل */
    .sarea-wallet-unified .form-field-compact select,
    .sarea-wallet-unified .form-field-compact input {
        padding: 10px 12px !important;
        border-radius: 6px !important;
        font-size: 15px !important;
        border-width: 1px !important;
    }

    /* ✅ الأزرار - ممتدة بالكامل */
    .sarea-wallet-unified .btn-recharge,
    .sarea-wallet-unified .btn-transfer {
        padding: 12px 16px !important;
        border-radius: 6px !important;
        font-size: 15px !important;
    }

    /* ✅ جدول المعاملات - بدون padding إضافي */
    .sarea-wallet-unified .transactions-table-wrapper {
        /*margin: 0 -10px !important;*/
        padding: 0 !important;
        margin-bottom: 0 !important;
        margin-top: 0 !important;
    }

    .sarea-wallet-unified .transactions-table-enhanced {
        border-radius: 0 !important;
        margin-bottom: 0 !important;
        margin-top: 0 !important;
    }

    .sarea-wallet-unified .transactions-table-enhanced th,
    .sarea-wallet-unified .transactions-table-enhanced td {
        padding: 8px 6px !important;
        font-size: 11px !important;
    }

    /* ✅ زر عرض المعاملات */
    .sarea-wallet-unified .section-title .tx-toggle-link {
        font-size: 10px !important;
        padding: 3px 8px !important;
    }

    .sarea-wallet-unified .section-title .tx-badge {
        font-size: 10px !important;
        padding: 2px 6px !important;
    }

    /* ✅ رسالة التحويل */
    .sarea-wallet-unified .transfer-msg {
        font-size: 12px !important;
        padding: 8px 10px !important;
    }

    /* ✅ وصف وسيلة الدفع */
    .sarea-wallet-unified .method-desc-compact {
        padding: 8px 10px !important;
        font-size: 11px !important;
        margin-top: 6px !important;
    }

    /* ✅ نتيجة التحويل */
    .sarea-wallet-unified .conversion-compact {
        padding: 6px 10px !important;
        font-size: 14px !important;
    }
}

/* ✅ شاشات أصغر جداً (iPhone SE, etc) */
@media (max-width: 380px) {

    /* ✅ إزالة كل الهوامش من الحاويات الخارجية */
    .woocommerce-account .woocommerce-MyAccount-content,
    .woocommerce-account .elementor-widget-container,
    .woocommerce-account .e-con-inner {
        padding: 0 !important;
        margin: 0 !important;
    }

    .sarea-wallet-unified .wallet-balance-compact {
        margin: 4px !important;
        padding: 10px 12px !important;
        border-radius: 6px !important;
    }

    .sarea-wallet-unified .wallet-balance-compact .balance-title {
        font-size: 14px !important;
    }

    .sarea-wallet-unified .wallet-balance-compact .balance-value {
        font-size: 20px !important;
    }

    .sarea-wallet-unified .wallet-three-sections {
        gap: 4px !important;
        padding: 0 4px !important;
    }

    .sarea-wallet-unified .wallet-section-box {
        border-radius: 4px !important;
    }

    .sarea-wallet-unified .section-title {
        padding: 8px 10px !important;
        font-size: 14px !important;
    }

    .sarea-wallet-unified .section-body {
        padding: 8px !important;
    }

    .sarea-wallet-unified .form-field-compact select,
    .sarea-wallet-unified .form-field-compact input {
        padding: 9px 10px !important;
        font-size: 14px !important;
    }

    .sarea-wallet-unified .btn-recharge,
    .sarea-wallet-unified .btn-transfer {
        padding: 10px 14px !important;
        font-size: 14px !important;
    }
}
