/* BuddyBoss Profile Installments Styles */
.miwcip-buddyboss-profile-installments {
    max-width: 100%;
    margin: 0;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Header Styles */
.miwcip-installments-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f1f1;
}

.miwcip-installments-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

.miwcip-installments-description {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* Order Container */
.miwcip-installments-container {
    margin-bottom: 30px;
}

/* Table Styles */
.miwcip-installments-table-container {
    overflow-x: auto;
    margin-bottom: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.miwcip-installments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
}

.miwcip-installments-table th,
.miwcip-installments-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #e1e1e1;
}

.miwcip-installments-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

.miwcip-installments-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Order Number Column */
.order-number a {
    color: #007cba;
    text-decoration: none;
    font-weight: 600;
}

.order-number a:hover {
    text-decoration: underline;
}

.order-date {
    color: #666;
    font-size: 12px;
}

/* Installment Row Styles */
.installment-row.status-paid {
    background-color: #f8fff8;
}

.installment-row.status-overdue {
    background-color: #fff8f8;
}

.installment-number {
    font-weight: 600;
    color: #007cba;
}

.installment-amount {
    font-weight: 600;
    color: #333;
}

.overdue-indicator {
    color: #dc3545;
    font-weight: 600;
    font-size: 12px;
}

/* Summary Styles */
.miwcip-installments-summary {
    background: #f8f9fa;
    padding: 20px;
    border-top: 1px solid #e1e1e1;
}

.miwcip-overall-summary {
    background: #e8f5e8;
    padding: 20px;
    margin-top: 30px;
    border-radius: 8px;
    border: 2px solid #c3e6cb;
}

.miwcip-overall-summary h4 {
    margin: 0 0 15px 0;
    color: #155724;
    font-size: 18px;
    font-weight: 600;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e1e1e1;
}

.summary-label {
    font-weight: 500;
    color: #666;
}

.summary-value {
    font-weight: 600;
    font-size: 16px;
}

.summary-value.paid {
    color: #28a745;
}

.summary-value.pending {
    color: #ffc107;
}

/* No Installments Styles */
.miwcip-no-installments {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-installments-icon {
    margin-bottom: 20px;
}

.no-installments-icon .dashicons {
    font-size: 48px;
    color: #ccc;
}

.miwcip-no-installments h4 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #333;
}

.miwcip-no-installments p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Actions */
.miwcip-actions {
    margin-top: 20px;
    text-align: center;
}

.miwcip-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.miwcip-refresh-btn:hover {
    background: #005a87;
}

.miwcip-refresh-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading Overlay */
.miwcip-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.miwcip-spinner {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.miwcip-spinner p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Error Message */
.miwcip-error-message {
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px 0;
    text-align: center;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .miwcip-buddyboss-profile-installments {
        padding: 15px;
    }
    
    .miwcip-order-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .miwcip-installments-table-container {
        padding: 10px;
    }
    
    .miwcip-installments-table {
        font-size: 12px;
    }
    
    .miwcip-installments-table th,
    .miwcip-installments-table td {
        padding: 8px 10px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .summary-item {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
}

/* RTL Support */
[dir="rtl"] .miwcip-buddyboss-profile-installments {
    direction: rtl;
}

[dir="rtl"] .miwcip-installments-table th,
[dir="rtl"] .miwcip-installments-table td {
    text-align: right;
}

[dir="rtl"] .miwcip-order-info strong {
    margin-right: 5px;
    margin-left: 0;
}

/* BuddyBoss Theme Compatibility */
.buddyboss-theme .miwcip-buddyboss-profile-installments {
    background: var(--bb-bg-primary, #fff);
    color: var(--bb-text-primary, #333);
}

.buddyboss-theme .miwcip-order-header {
    background: var(--bb-bg-secondary, #f8f9fa);
}

.buddyboss-theme .status-badge.status-completed,
.buddyboss-theme .status-badge.status-paid {
    background-color: var(--bb-success-bg, #d4edda);
    color: var(--bb-success-text, #155724);
}

.buddyboss-theme .miwcip-refresh-btn {
    background: var(--bb-primary, #007cba);
}

.buddyboss-theme .miwcip-refresh-btn:hover {
    background: var(--bb-primary-hover, #005a87);
}
