/* User Center Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; color: #333; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Auth Section */
.auth-section { max-width: 400px; margin: 60px auto; background: #fff; border-radius: 12px; padding: 30px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
.auth-tabs { display: flex; margin-bottom: 24px; border-bottom: 2px solid #eee; }
.tab-btn { flex: 1; padding: 12px; border: none; background: none; cursor: pointer; font-size: 16px; color: #666; transition: all 0.3s; }
.tab-btn.active { color: #4a90d9; border-bottom: 2px solid #4a90d9; margin-bottom: -2px; }
.auth-panel { display: none; }
.auth-panel.active { display: block; }
.auth-panel h2 { margin-bottom: 20px; text-align: center; color: #333; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #555; }
.form-group input { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border 0.3s; }
.form-group input:focus { outline: none; border-color: #4a90d9; }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }

/* Buttons */
.btn { padding: 10px 24px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; transition: all 0.3s; }
.btn-primary { background: #4a90d9; color: #fff; }
.btn-primary:hover { background: #357abd; }
.btn-small { padding: 6px 14px; font-size: 12px; background: #f0f0f0; color: #666; }
.btn-small:hover { background: #e0e0e0; }

/* User Section */
.user-section { background: #fff; border-radius: 12px; min-height: 600px; }
.user-nav { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid #eee; }
.nav-brand { font-size: 20px; font-weight: bold; }
.nav-home-link { color: #4a90d9; text-decoration: none; }
.nav-home-link:hover { color: #357abd; }
.nav-links { flex: 1; display: flex; justify-content: center; }
.nav-link { color: #666; text-decoration: none; font-size: 14px; padding: 6px 12px; border-radius: 6px; transition: all 0.2s; }
.nav-link:hover { color: #4a90d9; background: #f0f7ff; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.empty-hint { color: #888; text-align: center; padding: 40px 20px; font-size: 15px; }
.credits-badge { background: #fff3cd; color: #856404; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; }

.user-content { display: flex; min-height: 500px; }
.sidebar { width: 200px; border-right: 1px solid #eee; padding: 20px 0; }
.menu { list-style: none; }
.menu-item { padding: 12px 24px; cursor: pointer; transition: all 0.3s; color: #555; }
.menu-item:hover { background: #f8f9fa; color: #4a90d9; }
.menu-item.active { background: #e3f2fd; color: #4a90d9; border-right: 3px solid #4a90d9; }

.main-content { flex: 1; padding: 24px; }
.page { display: none; }
.page.active { display: block; }
.page h2 { margin-bottom: 20px; color: #333; }

/* Profile */
.profile-card, .password-card { background: #f8f9fa; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.password-card h3 { margin-bottom: 16px; color: #555; }
.info-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; }
.info-row:last-child { border-bottom: none; }
.info-row label { width: 100px; color: #666; font-size: 14px; }
.info-row span, .info-row input { flex: 1; }
.credits-text { color: #e67e22; font-weight: bold; font-size: 18px; }

/* Quota Summary */
.quota-summary-card {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
  gap: 32px;
  flex-wrap: wrap;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.quota-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  padding-right: 32px;
  border-right: 1px solid #e2e8f0;
}
.quota-big-number {
  font-size: 40px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -1px;
}
.quota-big-label {
  font-size: 13px;
  color: #64748b;
  margin-top: 6px;
  font-weight: 500;
}
.quota-details {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quota-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.qd-icon {
  color: #94a3b8;
  display: inline-flex;
}
.qd-label {
  color: #64748b;
  min-width: 60px;
}
.qd-value {
  color: #0f172a;
  font-weight: 600;
  margin-left: auto;
}
.quota-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.quota-progress-track {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.quota-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.quota-progress-bar.warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.quota-progress-bar.urgent { background: linear-gradient(90deg, #ef4444, #f87171); }
.quota-progress-text {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}
.quota-action {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99,102,241,0.25);
  transition: all 0.2s;
}
.quota-action:hover {
  transform: translateY(-50%) scale(1.03);
  box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}
@media (max-width: 640px) {
  .quota-main { border-right: none; border-bottom: 1px solid #e2e8f0; padding-right: 0; padding-bottom: 20px; width: 100%; }
  .quota-action { position: static; transform: none; margin-top: 12px; align-self: flex-end; }
}

/* Plans */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.plan-card {
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 18px;
    padding: 0;
    text-align: center;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.plan-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.08);
    border-color: #d5d5d5;
}
.plan-card.hot {
    border-color: #ff6b6b;
    box-shadow: 0 4px 20px rgba(255,107,107,0.12);
}
.plan-card.hot:hover {
    box-shadow: 0 16px 40px rgba(255,107,107,0.2);
}
.plan-card.gold { border-color: #f5d76e; }
.plan-card.gold:hover { border-color: #e8c84d; }
.plan-card.silver { border-color: #c8cdd0; }
.plan-card.silver:hover { border-color: #a5abaf; }
.plan-card.bronze { border-color: #e8a87c; }
.plan-card.bronze:hover { border-color: #d4956a; }

.plan-badge-recommended {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
    padding: 5px 12px;
    border-radius: 0 0 0 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.plan-header { padding: 24px 16px 8px; }
.plan-name {
    font-size: 15px;
    font-weight: 700;
    color: #222;
    letter-spacing: 0.3px;
}
.plan-tagline {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.plan-credits-wrap {
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    padding: 24px 16px;
    border-top: 1px solid #f2f2f2;
    border-bottom: 1px solid #f2f2f2;
}
.plan-credits {
    font-size: 44px;
    font-weight: 800;
    color: #111;
    line-height: 1;
    letter-spacing: -1.5px;
}
.plan-credits-label {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.plan-body {
    padding: 18px 20px;
    flex: 1;
}
.plan-features {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}
.plan-features li {
    padding: 5px 0;
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}
.plan-features li .feat-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #eefaf3;
    color: #27ae60;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.plan-footer {
    padding: 0 20px 24px;
}
.plan-price { margin-bottom: 14px; }
.plan-price-current {
    font-size: 28px;
    font-weight: 800;
    color: #e74c3c;
    letter-spacing: -0.5px;
}
.plan-price-current small {
    font-size: 14px;
    font-weight: 500;
    margin-right: 1px;
}
.plan-price-original {
    font-size: 13px;
    color: #bbb;
    text-decoration: line-through;
    margin-left: 6px;
}
.plan-save-badge {
    display: inline-block;
    background: #fff0f0;
    color: #e74c3c;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 6px;
    letter-spacing: 0.3px;
}

.plan-btn {
    width: 100%;
    padding: 12px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}
.plan-btn:hover {
    background: #333;
    transform: scale(1.02);
}
.plan-card.hot .plan-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    box-shadow: 0 4px 12px rgba(255,107,107,0.3);
}
.plan-card.hot .plan-btn:hover {
    background: linear-gradient(135deg, #ee5a5a, #dd4a4a);
    box-shadow: 0 6px 16px rgba(255,107,107,0.4);
}

/* Old class aliases for backward compat */
.plan-icon { display: none; }
.plan-desc { display: none; }
.plan-meta { display: none; }

/* Tables */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; }
.data-table th { background: #f8f9fa; font-weight: 600; color: #555; }
.data-table tr:hover { background: #f8f9fa; }
.status-paid { color: #27ae60; }
.status-pending { color: #f39c12; }
.status-failed { color: #e74c3c; }

/* Modal */
.modal { 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: 1000; }
.modal-content { background: #fff; border-radius: 12px; padding: 30px; width: 90%; max-width: 400px; position: relative; }
.close-btn { position: absolute; top: 16px; right: 20px; font-size: 24px; cursor: pointer; color: #999; }
.close-btn:hover { color: #333; }
.pay-methods { margin: 16px 0; }
.pay-methods label { display: block; padding: 10px; margin-bottom: 8px; border: 1px solid #ddd; border-radius: 8px; cursor: pointer; }
.pay-methods label:hover { border-color: #4a90d9; }
.pay-methods input { margin-right: 8px; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 24px; border-radius: 8px; color: #fff; z-index: 2000; animation: slideIn 0.3s ease; }
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* API Key page */
.apikey-card {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 24px;
    margin-top: 16px;
}
.apikey-card .hint {
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
}
.apikey-display {
    background: #fff;
    border: 1px dashed #ddd;
    border-radius: 8px;
    padding: 16px;
    font-family: monospace;
    font-size: 16px;
    margin-bottom: 16px;
    word-break: break-all;
}
.apikey-display .masked {
    color: #888;
    letter-spacing: 2px;
}
.apikey-actions {
    display: flex;
    gap: 12px;
}
.apikey-plaintext {
    background: #f0f7ff;
    border: 1px solid #4a90d9;
    border-radius: 8px;
    padding: 16px;
    font-family: monospace;
    font-size: 18px;
    color: #4a90d9;
    margin: 16px 0;
    word-break: break-all;
    user-select: all;
}
#apikey-modal .warning {
    color: #e74c3c;
    font-weight: bold;
    margin: 8px 0;
}

/* API Key management form & table */
.apikey-form {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.apikey-form .form-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.apikey-form .form-row .form-input {
    flex: 1;
    min-width: 160px;
}
.apikey-form .hint {
    color: #888;
    font-size: 13px;
    margin-top: 10px;
}
.btn-danger-sm {
    padding: 6px 14px;
    font-size: 12px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.btn-danger-sm:hover {
    background: #c0392b;
}
.btn-secondary-sm {
    padding: 6px 14px;
    font-size: 12px;
    background: #95a5a6;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.btn-secondary-sm:hover {
    background: #7f8c8d;
}
.quota-unlimited {
    color: #27ae60;
    font-weight: 500;
}
.quota-limited {
    color: #e67e22;
    font-weight: 500;
}
.badge-default {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    background: #e2e8f0;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}