/* ===== GENERAL STYLES ===== */
.dfam-user-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.dfam-login-message {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

/* ===== DASHBOARD HEADER ===== */
.dfam-dashboard-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.dfam-dashboard-header h2 {
    color: #2c3e50;
    font-size: 2.2em;
    margin-bottom: 10px;
    font-weight: 600;
}

.dfam-dashboard-header .dashicons {
    color: #3498db;
    margin-right: 10px;
}

.dfam-welcome {
    color: #6c757d;
    font-size: 1.1em;
    margin: 0;
}

/* ===== SUMMARY CARDS ===== */
.dfam-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.dfam-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dfam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.dfam-card-icon {
    font-size: 2.5em;
    margin-right: 20px;
    color: #3498db;
}

.dfam-card-savings .dfam-card-icon { color: #27ae60; }
.dfam-card-loans .dfam-card-icon { color: #e74c3c; }
.dfam-card-requests .dfam-card-icon { color: #f39c12; }
.dfam-card-approved .dfam-card-icon { color: #9b59b6; }

.dfam-card-content h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 1em;
    font-weight: 600;
}

.dfam-card-amount {
    font-size: 1.8em;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

/* ===== DASHBOARD CONTENT ===== */
.dfam-dashboard-content {
    display: grid;
    gap: 30px;
}

.dfam-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.dfam-section-header {
    background: #f8f9fa;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dfam-section-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 600;
}

.dfam-section-header .dashicons {
    color: #3498db;
    margin-right: 8px;
}

.dfam-section-content {
    padding: 25px;
}

/* ===== TABLES ===== */
.dfam-table-responsive {
    overflow-x: auto;
}

.dfam-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.dfam-table th,
.dfam-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.dfam-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.dfam-table tbody tr:hover {
    background: #f8f9fa;
}

.dfam-amount {
    font-weight: 600;
    color: #27ae60;
    font-size: 1.1em;
}

.dfam-account-number {
    color: #3498db;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 1.1em;
}

/* ===== STATUS BADGES ===== */
.dfam-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dfam-status-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.dfam-status-approved {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.dfam-status-rejected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== BUTTONS ===== */
.dfam-button {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-align: center;
}

.dfam-button-primary {
    background: #3498db;
    color: white;
}

.dfam-button-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.dfam-button-secondary {
    background: #6c757d;
    color: white;
}

.dfam-button-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* ===== SUCCESS AND ERROR MESSAGES ===== */
.dfam-success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.dfam-error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

/* ===== FORM STYLING ===== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-group input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s ease;
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
}

/* ===== EMPTY STATES ===== */
.dfam-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.dfam-empty-state .dashicons {
    font-size: 3em;
    color: #dee2e6;
    margin-bottom: 15px;
}

.dfam-empty-state h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1.2em;
}

.dfam-empty-state p {
    margin: 0 0 20px 0;
    font-size: 1em;
}

/* ===== PLANS AND LOAN PLANS ===== */
.dfam-plans, .dfam-loan-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.plan, .loan-plan {
    background: white;
    padding: 25px;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plan:hover, .loan-plan:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.plan h3, .loan-plan h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.3em;
    margin-bottom: 15px;
}

.plan p, .loan-plan p {
    margin: 8px 0;
    color: #6c757d;
    line-height: 1.5;
}

.plan form, .loan-plan form {
    margin-top: 20px;
}

.plan label, .loan-plan label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: #495057;
}

.plan input[type="number"], .loan-plan input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s ease;
}

.plan input[type="number"]:focus, .loan-plan input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
}

.plan input[type="submit"], .loan-plan input[type="submit"] {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    width: 100%;
    transition: all 0.2s ease;
}

.plan input[type="submit"]:hover, .loan-plan input[type="submit"]:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .dfam-user-dashboard {
        padding: 15px;
    }

    .dfam-dashboard-header h2 {
        font-size: 1.8em;
    }

    .dfam-summary-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .dfam-card {
        padding: 20px;
    }

    .dfam-card-icon {
        font-size: 2em;
        margin-right: 15px;
    }

    .dfam-card-amount {
        font-size: 1.5em;
    }

    .dfam-section-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .dfam-plans, .dfam-loan-plans {
        grid-template-columns: 1fr;
    }

    .plan, .loan-plan {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .dfam-dashboard-header h2 {
        font-size: 1.5em;
    }

    .dfam-card {
        flex-direction: column;
        text-align: center;
    }

    .dfam-card-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .dfam-table th,
    .dfam-table td {
        padding: 8px 10px;
        font-size: 0.9em;
    }
}

/* ===== RTL (Right-to-Left) SUPPORT ===== */
[dir="rtl"] .dfam-user-dashboard,
.rtl .dfam-user-dashboard {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .dfam-dashboard-header h2 .dashicons,
.rtl .dfam-dashboard-header h2 .dashicons {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .dfam-card,
.rtl .dfam-card {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .dfam-card-icon,
.rtl .dfam-card-icon {
    margin-right: 0;
    margin-left: 20px;
}

[dir="rtl"] .dfam-section-header,
.rtl .dfam-section-header {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .dfam-section-header h3 .dashicons,
.rtl .dfam-section-header h3 .dashicons {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .dfam-section-header,
.rtl .dfam-section-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .dfam-button,
.rtl .dfam-button {
    direction: rtl;
}

[dir="rtl"] .dfam-table,
.rtl .dfam-table {
    direction: rtl;
}

[dir="rtl"] .dfam-table th,
[dir="rtl"] .dfam-table td,
.rtl .dfam-table th,
.rtl .dfam-table td {
    text-align: right;
}

[dir="rtl"] .plan,
[dir="rtl"] .loan-plan,
.rtl .plan,
.rtl .loan-plan {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .plan form,
[dir="rtl"] .loan-plan form,
.rtl .plan form,
.rtl .loan-plan form {
    direction: rtl;
}

[dir="rtl"] .plan input[type="number"],
[dir="rtl"] .loan-plan input[type="number"],
.rtl .plan input[type="number"],
.rtl .loan-plan input[type="number"] {
    text-align: center;
}

[dir="rtl"] .dfam-empty-state,
.rtl .dfam-empty-state {
    direction: rtl;
    text-align: right;
}

/* ===== PERSIAN FONT SUPPORT ===== */
.dfam-user-dashboard {
    font-family: 'IRANSans', 'Tahoma', 'Arial', sans-serif;
}

[dir="rtl"] .dfam-user-dashboard,
.rtl .dfam-user-dashboard {
    font-family: 'IRANSans', 'Tahoma', 'Arial', sans-serif;
}

/* ===== JALALI CALENDAR SUPPORT ===== */
.dfam-jalali-date {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* ===== ACCOUNT DETAILS AND PAYMENT TRACKING ===== */
.dfam-account-overview {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.dfam-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.dfam-loan-overview {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.dfam-overview-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dfam-overview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.dfam-overview-card.dfam-card-overdue {
    border-color: #dc3545;
    background: linear-gradient(135deg, #fff 0%, #f8d7da 100%);
}

.dfam-overview-card.dfam-card-completed {
    border-color: #28a745;
    background: linear-gradient(135deg, #fff 0%, #d4edda 100%);
}

.dfam-card-icon {
    font-size: 32px;
    color: #6c757d;
    margin-bottom: 10px;
}

.dfam-overview-card.dfam-card-overdue .dfam-card-icon {
    color: #dc3545;
}

.dfam-overview-card.dfam-card-completed .dfam-card-icon {
    color: #28a745;
}

.dfam-card-content h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dfam-card-amount {
    font-size: 28px;
    font-weight: 700;
    color: #212529;
    margin: 10px 0;
}

.dfam-card-description {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
    font-weight: 500;
}

.dfam-overview-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    border: 1px solid #e9ecef;
}

.dfam-overview-card h3 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.dfam-overview-card .dfam-card-amount {
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
}

/* Payment Status Styles */
.dfam-payment-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.9em;
}

.dfam-paid-count {
    color: #27ae60;
    font-weight: bold;
}

.dfam-overdue-count {
    color: #e74c3c;
    font-weight: bold;
}

/* Payment Summary Styles */
.dfam-payment-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #e9ecef;
}

.dfam-summary-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.dfam-stat-item {
    text-align: center;
    min-width: 120px;
}

.dfam-stat-label {
    display: block;
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
    font-weight: 500;
}

.dfam-stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
}

.dfam-stat-value.dfam-overdue {
    color: #e74c3c;
}

/* Account Link Styles */
.dfam-account-link {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease;
}

.dfam-account-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Enhanced Status Styles */
.dfam-status-paid {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.dfam-status-overdue {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* RTL Support for Account Details */
[dir="rtl"] .dfam-account-overview,
.rtl .dfam-account-overview {
    direction: rtl;
}

[dir="rtl"] .dfam-overview-grid,
.rtl .dfam-overview-grid {
    direction: rtl;
}

[dir="rtl"] .dfam-payment-summary,
.rtl .dfam-payment-summary {
    direction: rtl;
}

[dir="rtl"] .dfam-summary-stats,
.rtl .dfam-summary-stats {
    direction: rtl;
}

/* ===== MANUAL PAYMENT FORM STYLES ===== */
.dfam-manual-payment-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    margin-bottom: 30px;
    overflow: hidden;
}

.dfam-manual-payment-form {
    max-width: 600px;
    margin: 0 auto;
}

.dfam-form-row {
    margin-bottom: 20px;
}

.dfam-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.dfam-form-row select,
.dfam-form-row input[type="number"],
.dfam-form-row textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white;
}

.dfam-form-row select:focus,
.dfam-form-row input[type="number"]:focus,
.dfam-form-row textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dfam-form-row textarea {
    resize: vertical;
    min-height: 80px;
}

.dfam-form-row input[type="submit"] {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    width: auto;
    min-width: 150px;
}

.dfam-form-row input[type="submit"]:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.dfam-form-row input[type="submit"]:active {
    transform: translateY(0);
}

/* ===== PAYMENT FORM RESPONSIVE ===== */
@media (max-width: 768px) {
    .dfam-manual-payment-form {
        padding: 0 15px;
    }

    .dfam-form-row input[type="submit"] {
        width: 100%;
    }
}

/* ===== RTL SUPPORT FOR PAYMENT FORM ===== */
[dir="rtl"] .dfam-manual-payment-section,
.rtl .dfam-manual-payment-section {
    direction: rtl;
}

[dir="rtl"] .dfam-form-row,
.rtl .dfam-form-row {
    direction: rtl;
}

/* ===== USER PAYMENT REGISTRATION FORM ===== */
.dfam-user-payment-registration {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    margin-top: 30px;
    overflow: hidden;
}

.dfam-user-payment-registration .dfam-section-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dfam-user-payment-registration .dfam-section-header h3 {
    color: white;
}

.dfam-user-payment-registration .dfam-section-header .dashicons {
    color: white;
}

.dfam-user-payment-form {
    max-width: 600px;
    margin: 0 auto;
}

.dfam-user-payment-form .dfam-form-row {
    margin-bottom: 20px;
}

.dfam-user-payment-form .dfam-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.dfam-payment-type-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dfam-payment-option {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.dfam-payment-option:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.dfam-payment-option input[type="radio"] {
    margin-left: 0;
    margin-right: 10px;
}

.dfam-payment-details {
    color: #27ae60;
    font-weight: bold;
    margin-top: 5px;
    display: block;
}

.dfam-payment-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: #856404;
}

.dfam-payment-notice p {
    margin: 0;
    font-size: 14px;
}

/* RTL Support for User Payment Form */
[dir="rtl"] .dfam-user-payment-registration,
.rtl .dfam-user-payment-registration {
    direction: rtl;
}

[dir="rtl"] .dfam-payment-option input[type="radio"],
.rtl .dfam-payment-option input[type="radio"] {
    margin-left: 10px;
    margin-right: 0;
}

/* ===== MONTHS SELECTOR ===== */
.dfam-months-selector {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.dfam-months-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.dfam-months-selector select {
    width: 100%;
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    font-size: 14px;
}

.dfam-months-selector select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.25);
}

.dfam-payment-preview {
    margin-top: 10px;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    font-size: 14px;
}

.dfam-payment-preview strong {
    color: #fff;
}

/* RTL Support for Months Selector */
[dir="rtl"] .dfam-months-selector,
.rtl .dfam-months-selector {
    direction: rtl;
}

[dir="rtl"] .dfam-months-selector select,
.rtl .dfam-months-selector select {
    text-align: right;
}

[dir="rtl"] .dfam-form-row select,
[dir="rtl"] .dfam-form-row input[type="number"],
[dir="rtl"] .dfam-form-row textarea,
.rtl .dfam-form-row select,
.rtl .dfam-form-row input[type="number"],
.rtl .dfam-form-row textarea {
    text-align: right;
}

/* ===== COLLAPSIBLE USER/ACCOUNT GROUPING ===== */
.dfam-collapsible-container {
    margin: 20px 0;
    max-width: 100%;
    overflow-x: hidden;
}

/* Search Bar Styles */
.dfam-search-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    padding: 20px;
    margin-bottom: 20px;
}

.dfam-search-form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.dfam-search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white;
}

.dfam-search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dfam-search-button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dfam-search-button:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.dfam-clear-search {
    padding: 10px 15px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.dfam-clear-search:hover {
    background: #5a6268;
}

.dfam-collapsible-user,
.dfam-collapsible-account {
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.dfam-collapsible-user.overdue-user {
    border-color: #f5c6cb;
    background: #fdfdfe;
}

.dfam-collapsible-user.overdue-user .dfam-collapsible-header {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
}

.dfam-collapsible-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    border: none;
    width: auto;
    text-align: left;
    font-size: 14px;
}

.dfam-collapsible-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.dfam-collapsible-header.user-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dfam-collapsible-header.account-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.dfam-toggle-icon {
    font-size: 16px;
    font-weight: bold;
    margin-right: 10px;
    transition: transform 0.2s ease;
    display: inline-block;
    width: 16px;
    text-align: center;
}

.dfam-collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
}

.dfam-collapsible-content.user-content {
    background: #fafbfc;
}

.dfam-collapsible-content.account-content {
    background: #ffffff;
    margin: 0 20px 15px 20px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.dfam-user-info {
    flex: 1;
    font-weight: 600;
    color: #2c3e50;
}

.dfam-account-info {
    flex: 1;
    font-weight: 600;
    color: #2c3e50;
}

.dfam-user-summary,
.dfam-account-summary {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.dfam-payment-count,
.dfam-overdue-count,
.dfam-overdue-days,
.dfam-total-amount {
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.dfam-payment-count {
    background: #d4edda;
    color: #155724;
}

.dfam-overdue-count,
.dfam-overdue-days {
    background: #f8d7da;
    color: #721c24;
    animation: gentle-pulse 3s infinite;
}

.dfam-total-amount {
    background: #cce5ff;
    color: #004085;
}

@keyframes gentle-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Expanded state */
.dfam-collapsible-content.expanded {
    max-height: 2000px; /* Adjust based on content */
}

.dfam-toggle-icon.expanded {
    transform: rotate(90deg);
}

/* Payment table inside collapsible content */
.dfam-payment-table {
    margin: 0;
    border: none;
}

.dfam-payment-table th,
.dfam-payment-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
}

.dfam-payment-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 13px;
}

.dfam-payment-table tbody tr:hover {
    background: #f8f9fa;
}

/* Status badges in collapsible tables */
.status-pending {
    background: #fff3cd;
    color: #856404;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.status-overdue {
    background: #f8d7da;
    color: #721c24;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    animation: gentle-pulse 3s infinite;
}

/* RTL Support for Collapsible Interface */
[dir="rtl"] .dfam-collapsible-header,
.rtl .dfam-collapsible-header {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .dfam-toggle-icon,
.rtl .dfam-toggle-icon {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .dfam-user-info,
[dir="rtl"] .dfam-account-info,
.rtl .dfam-user-info,
.rtl .dfam-account-info {
    text-align: right;
}

[dir="rtl"] .dfam-user-summary,
[dir="rtl"] .dfam-account-summary,
.rtl .dfam-user-summary,
.rtl .dfam-account-summary {
    direction: rtl;
}

/* Responsive design for collapsible interface */
@media (max-width: 768px) {
    .dfam-collapsible-container {
        margin: 15px 0;
    }

    .dfam-collapsible-header {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .dfam-user-summary,
    .dfam-account-summary {
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
        flex-wrap: wrap;
    }

    .dfam-collapsible-content.account-content {
        margin: 0 15px 12px 15px;
    }

    .dfam-payment-table {
        font-size: 13px;
    }

    .dfam-payment-table th,
    .dfam-payment-table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* Stack summary items vertically on small screens */
    .dfam-payment-count,
    .dfam-overdue-count,
    .dfam-overdue-days,
    .dfam-total-amount {
        display: block;
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .dfam-collapsible-header {
        padding: 10px 12px;
    }

    .dfam-user-info,
    .dfam-account-info {
        font-size: 14px;
    }

    .dfam-toggle-icon {
        font-size: 14px;
    }

    /* Hide some summary info on very small screens */
    .dfam-user-summary .dfam-payment-count,
    .dfam-account-summary .dfam-payment-count {
        display: none;
    }

    .dfam-payment-table th,
    .dfam-payment-table td {
        padding: 6px 8px;
        font-size: 12px;
    }
}

/* Search form responsive */
@media (max-width: 768px) {
    .dfam-search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .dfam-search-input {
        min-width: auto;
        width: 100%;
    }

    .dfam-search-button,
    .dfam-clear-search {
        width: 100%;
        margin-top: 10px;
    }
}

/* Improve table scrolling on small screens */
.dfam-payment-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dfam-payment-table-responsive table {
    min-width: 600px;
}

/* Better containment for WordPress admin */
.wrap .dfam-collapsible-container {
    max-width: none;
    margin-left: -20px;
    margin-right: -20px;
    width: calc(100% + 40px);
    overflow-x: hidden;
}

.wrap .dfam-collapsible-user,
.wrap .dfam-collapsible-account {
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 783px) {
    .wrap .dfam-collapsible-container {
        margin-left: -10px;
        margin-right: -10px;
        width: calc(100% + 20px);
    }
}

/* Ensure tables don't overflow */
.dfam-payment-table {
    table-layout: fixed;
    width: 100%;
}

.dfam-payment-table th,
.dfam-payment-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Improve search form containment */
.dfam-search-section {
    max-width: 100%;
    overflow: hidden;
}

.dfam-search-form {
    max-width: 100%;
}

/* Better spacing for admin interface */
.admin_page_dfam-payments .wrap {
    margin-right: 20px;
    margin-left: 20px;
}

@media (min-width: 783px) {
    .admin_page_dfam-payments .wrap {
        margin-right: 10px;
        margin-left: 10px;
    }
}

/* ===== IMPROVED LOAN PLANS DESIGN ===== */
.dfam-loan-plans-container {
    margin-top: 20px;
}

.dfam-loan-plans-intro {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.dfam-loan-intro-text {
    font-size: 1.1em;
    margin: 0;
    font-weight: 500;
}

.dfam-loan-plans-grid {
    display: grid;
    gap: 30px;
}

.dfam-saving-loan-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dfam-saving-loan-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.dfam-saving-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.dfam-saving-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.dfam-saving-title {
    font-size: 1.2em;
    color: #2c3e50;
    margin: 0;
    font-weight: 600;
}

.dfam-saving-details {
    display: flex;
    gap: 20px;
    align-items: center;
}

.dfam-account-number,
.dfam-account-balance {
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 500;
}

.dfam-account-number {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.dfam-loan-plans-list {
    padding: 20px;
    display: grid;
    gap: 20px;
}

.dfam-loan-plan-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.dfam-loan-plan-card:hover {
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.dfam-loan-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dfam-loan-plan-title {
    font-size: 1.1em;
    color: #2c3e50;
    margin: 0;
    font-weight: 600;
}

.dfam-loan-plan-amount {
    font-size: 1.3em;
    color: #27ae60;
    font-weight: 700;
}

.dfam-loan-plan-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.dfam-loan-feature {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.dfam-feature-label {
    display: block;
    font-size: 0.8em;
    color: #6c757d;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.dfam-feature-value {
    display: block;
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: 700;
}

.dfam-loan-plan-description {
    margin-bottom: 15px;
}

.dfam-loan-plan-description p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.5;
}

.dfam-loan-plan-actions {
    text-align: center;
}

.dfam-loan-apply-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dfam-loan-apply-btn:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.dfam-loan-apply-btn .dashicons {
    font-size: 1em;
}

.dfam-loan-plan-status {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dfam-loan-plan-status .dashicons {
    font-size: 1.1em;
}

/* ===== RESPONSIVE DESIGN FOR LOAN PLANS ===== */
@media (max-width: 768px) {
    .dfam-saving-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dfam-saving-details {
        width: 100%;
        justify-content: space-between;
    }

    .dfam-loan-plan-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dfam-loan-plan-features {
        grid-template-columns: 1fr;
    }

    .dfam-loan-plans-list {
        padding: 15px;
    }

    .dfam-loan-plan-card {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .dfam-loan-plans-intro {
        padding: 15px;
    }

    .dfam-loan-intro-text {
        font-size: 1em;
    }

    .dfam-saving-header {
        padding: 15px;
    }

    .dfam-saving-title {
        font-size: 1.1em;
    }

    .dfam-saving-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .dfam-loan-feature {
        padding: 8px;
    }

    .dfam-feature-value {
        font-size: 1em;
    }
}

/* ===== RTL SUPPORT FOR LOAN PLANS ===== */
[dir="rtl"] .dfam-saving-info,
.rtl .dfam-saving-info {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .dfam-saving-details,
.rtl .dfam-saving-details {
    direction: rtl;
}

[dir="rtl"] .dfam-loan-plan-header,
.rtl .dfam-loan-plan-header {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .dfam-loan-plan-features,
.rtl .dfam-loan-plan-features {
    direction: rtl;
}

[dir="rtl"] .dfam-loan-plan-actions,
.rtl .dfam-loan-plan-actions {
    direction: rtl;
}

[dir="rtl"] .dfam-loan-apply-btn .dashicons,
.rtl .dfam-loan-apply-btn .dashicons {
    margin-left: 8px;
    margin-right: 0;
}

[dir="rtl"] .dfam-loan-plan-status .dashicons,
.rtl .dfam-loan-plan-status .dashicons {
    margin-left: 8px;
    margin-right: 0;
}

/* ===== LOAN DETAILS AND CARDS ===== */
.dfam-loans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dfam-loan-payment-form {
    max-width: 600px;
    margin: 0 auto;
}

/* ===== PAYMENTS SUMMARY ===== */
.dfam-payments-summary {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.dfam-payments-summary p {
    margin: 0;
    color: #856404;
    font-weight: 600;
}

.dfam-loan-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dfam-loan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.dfam-loan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.dfam-loan-number {
    font-size: 1.2em;
    font-weight: 700;
    color: #2c3e50;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

.dfam-loan-number,
.dfam-account-number {
    font-size: 1.1em;
    font-weight: 700;
    color: #2c3e50;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    display: inline-block;
    margin-top: 5px;
}

.dfam-loan-amount {
    font-size: 1.4em;
    font-weight: 700;
    color: #e74c3c;
}

.dfam-loan-details {
    margin-bottom: 15px;
}

.dfam-loan-detail {
    margin-bottom: 8px;
    color: #6c757d;
    font-size: 0.9em;
}

.dfam-loan-detail strong {
    color: #495057;
}

.dfam-loan-actions {
    text-align: center;
}

.dfam-loan-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.dfam-loan-view-btn:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.dfam-loan-view-btn .dashicons {
    font-size: 1em;
}

/* ===== LOAN OVERVIEW ===== */
.dfam-loan-overview {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.dfam-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.dfam-overview-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    border: 1px solid #e9ecef;
}

.dfam-overview-card h3 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.dfam-overview-card .dfam-card-amount {
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
    margin: 0;
}

/* ===== LOAN PAYMENT BUTTONS ===== */
.dfam-pay-installment {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.2s ease;
}

.dfam-pay-installment:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

.dfam-paid-text {
    color: #27ae60;
    font-weight: 600;
    font-size: 0.9em;
}

/* ===== REQUESTS SUMMARY ===== */
.dfam-requests-summary {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.dfam-requests-summary p {
    margin: 0;
    color: #856404;
    font-weight: 600;
}

/* ===== RESPONSIVE DESIGN FOR LOANS ===== */
@media (max-width: 768px) {
    .dfam-loans-grid {
        grid-template-columns: 1fr;
    }

    .dfam-loan-card {
        padding: 15px;
    }

    .dfam-loan-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dfam-overview-grid {
        grid-template-columns: 1fr;
    }

    .dfam-loan-number {
        font-size: 1.1em;
    }

    .dfam-loan-amount {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .dfam-loan-card {
        padding: 12px;
    }

    .dfam-loan-overview {
        padding: 15px;
    }

    .dfam-overview-card {
        padding: 15px;
    }

    .dfam-loan-view-btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }
}

/* ===== RTL SUPPORT FOR LOANS ===== */
[dir="rtl"] .dfam-loan-header,
.rtl .dfam-loan-header {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .dfam-loan-actions,
.rtl .dfam-loan-actions {
    direction: rtl;
}

[dir="rtl"] .dfam-loan-view-btn .dashicons,
.rtl .dfam-loan-view-btn .dashicons {
    margin-left: 8px;
    margin-right: 0;
}

[dir="rtl"] .dfam-overview-grid,
.rtl .dfam-overview-grid {
    direction: rtl;
}