/* User Billing Page Styles */

.billing-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.billing-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.billing-tab:hover {
    color: var(--text);
}

.billing-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.billing-list {
    min-height: 200px;
}

/* Reusing admin-table class but ensuring it fits user area context */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    text-align: left;
    padding: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.success {
    background: rgba(46, 187, 79, 0.15);
    color: #2ebb4f;
}

.status-badge.active {
    background: rgba(46, 187, 79, 0.15);
    color: #2ebb4f;
}

.status-badge.pending {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.status-badge.failed,
.status-badge.rejected,
.status-badge.expired,
.status-badge.cancelled {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
}

.id-link {
    color: inherit;
    text-decoration: none;
    font-family: monospace;
    cursor: pointer;
    transition: color 0.2s;
}

.id-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Plans Grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.plan-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    transition: transform 0.2s, box-shadow 0.2s;
}

.plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.plan-current {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb, 46, 187, 79), 0.05);
    border-width: 2px;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.plan-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.plan-price-container {
    text-align: right;
}

.plan-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.plan-duration {
    font-size: 12px;
    color: var(--text-secondary);
}

.plan-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex-grow: 1;
}

.plan-limits {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    font-size: 13px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.plan-limits li {
    margin-bottom: 6px;
    padding-left: 20px;
    position: relative;
}

.plan-limits li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4caf50;
}

.promo-section {
    background: rgba(15, 23, 42, 0.03);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.promo-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.promo-input-group {
    display: flex;
    gap: 10px;
}

.promo-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.promo-apply-btn {
    padding: 8px 16px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.promo-message {
    font-size: 13px;
    margin-top: 8px;
}

.promo-success {
    color: #2ebb4f;
}

.promo-error {
    color: #f44336;
}

.center-loader {
    display: flex;
    justify-content: center;
    padding: 40px;
}

/* === MODAL STYLES REFINED === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-window {
    background: var(--surface);
    width: 600px;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal-window {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(var(--surface-rgb), 0.98);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--surface-hover);
}

/* Detail Rows */
.detail-group {
    margin-bottom: 24px;
    background: var(--surface-hover);
    border-radius: 8px;
    padding: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    font-weight: 600;
    text-align: right;
}

.section-title {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
}