/**
 * Billing System Styles for Ad Fluence Plans
 */

/* Billing Section Styles */
.adf-plan-billing-section {
    margin: 15px 0;
}

/* Flexible Billing Toggle */
.adf-flexible-billing-toggle {
    display: flex;
    justify-content: center;
    margin: 15px 0;
    background: #f5f5f5;
    border-radius: 25px;
    padding: 4px;
    width: 200px;
    margin: 15px auto;
}

.adf-flexible-billing-toggle button {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 12px;
}

.adf-flexible-billing-toggle button.active {
    background: #FF189A;
    color: white;
}

.adf-flexible-billing-toggle button:hover {
    background: #e6178a;
    color: white;
}

/* Current Price Display */
.adf-current-price {
    font-size: 24px;
    font-weight: bold;
    color: #FF189A;
    text-align: center;
    margin: 10px 0;
}

/* Billing Info */
.adf-billing-info {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.adf-billing-info .savings {
    color: #00a32a;
    font-weight: bold;
    font-size: 11px;
}

/* User Balance Info */
.adf-user-balance-info {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

.adf-user-balance {
    font-weight: bold;
    color: #FF189A;
}

/* Purchase Button */
.adf-purchase-plan-btn {
    background: #FF189A !important;
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 10px;
}

.adf-purchase-plan-btn:hover {
    background: #e6178a !important;
    transform: translateY(-2px);
}

.adf-purchase-plan-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed;
    transform: none;
}

/* User Dashboard Styles */
.adf-user-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.adf-dashboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.adf-dashboard-header h1 {
    color: #333;
    margin-bottom: 10px;
}

.adf-dashboard-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .adf-dashboard-sections {
        grid-template-columns: 1fr;
    }
}

/* Balance Section */
.adf-balance-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
}

.adf-balance-section h2 {
    color: #333;
    margin-bottom: 15px;
}

.adf-current-balance {
    font-size: 36px;
    font-weight: bold;
    color: #FF189A;
    margin: 20px 0;
}

.adf-add-funds-btn {
    background: #00a32a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.adf-add-funds-btn:hover {
    background: #008a24;
}

/* Subscriptions Section */
.adf-subscriptions-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
}

.adf-subscriptions-section h2 {
    color: #333;
    margin-bottom: 20px;
}

.subscription-item {
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fafafa;
}

.subscription-item h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.subscription-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.subscription-price {
    font-weight: bold;
    color: #FF189A;
}

.subscription-type {
    font-size: 12px;
    color: #666;
    text-transform: capitalize;
}

.next-billing {
    font-size: 12px;
    color: #666;
}

.adf-cancel-subscription-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.adf-cancel-subscription-btn:hover {
    background: #c82333;
}

/* Payment History Section */
.adf-payment-history {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    grid-column: 1 / -1;
}

.adf-payment-history h2 {
    color: #333;
    margin-bottom: 20px;
}

.payment-history-table {
    width: 100%;
    border-collapse: collapse;
}

.payment-history-table th,
.payment-history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.payment-history-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.payment-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.payment-status.completed {
    background: #d4edda;
    color: #155724;
}

.payment-status.pending {
    background: #fff3cd;
    color: #856404;
}

.payment-status.failed {
    background: #f8d7da;
    color: #721c24;
}

/* No Data Messages */
.no-subscriptions,
.no-payments {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .adf-user-dashboard {
        padding: 15px;
    }
    
    .subscription-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .payment-history-table {
        font-size: 14px;
    }
    
    .payment-history-table th,
    .payment-history-table td {
        padding: 8px;
    }
}

/* Plan Card Updates for Billing */
.adf-plan-card[data-billing-type="flexible"] .adf-plan-card-price {
    border: 2px solid #FF189A;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    background: linear-gradient(135deg, #fff 0%, #fef7fc 100%);
}

.adf-plan-card[data-billing-type="monthly"] .adf-current-price::after {
    content: "/month";
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.adf-plan-card[data-billing-type="annual"] .adf-current-price::after {
    content: "/year";
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #FF189A;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.adf-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
    font-weight: 500;
}

.adf-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.adf-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.adf-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Admin Billing Type Configuration Styles */
.billing-option {
    transition: all 0.3s ease;
}

.billing-description {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
    border-left: 4px solid #007cba;
    font-weight: 500;
}

#plan_billing_type {
    background: #fff;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    min-width: 200px;
}

.billing-option th {
    padding-left: 20px;
    position: relative;
}

.billing-option th:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #007cba;
    font-weight: bold;
}

.one-time-option th:before { content: "💳"; }
.monthly-option th:before { content: "🔄"; }
.annual-option th:before { content: "📅"; }

.billing-option input[type="number"] {
    border-left: 3px solid #007cba;
}

.one-time-option input[type="number"] { border-left-color: #10ac84; }
.monthly-option input[type="number"] { border-left-color: #3742fa; }
.annual-option input[type="number"] { border-left-color: #ff6348; }