/* ============================================
   Kong User Center - Design System
   Style: Simple Black & White
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-deep: #000000;
  --bg-base: #0a0a0a;
  --bg-card: #141414;
  --bg-card-hover: #1a1a1a;
  --bg-input: #1a1a1a;
  --bg-elevated: #1e1e1e;

  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;

  --accent: #ffffff;
  --accent-hover: #e0e0e0;
  --action: #ff4444;
  --action-hover: #cc0000;
  --success: #44ff44;
  --warning: #ffaa00;
  --danger: #ff4444;

  --border: #2a2a2a;
  --border-focus: #ffffff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);

  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --transition: 0.2s ease;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--text-secondary);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

/* --- Layout --- */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #000000;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

.navbar-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.navbar-brand {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tabs {
  display: flex;
  gap: 2px;
}

.nav-tab {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  font-family: var(--font-body);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-tab.active {
  color: #000;
  background: #fff;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-user {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Card --- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.glass-card:hover {
  border-color: #3a3a3a;
}

/* --- Grid Layout --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* --- Stat Cards --- */
.stat-card {
  text-align: center;
  padding: 20px 14px;
}

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: #fff;
  color: #000;
}

.btn-primary:hover:not(:disabled) {
  background: #e0e0e0;
}

.btn-action {
  background: var(--action);
  color: #fff;
}

.btn-action:hover:not(:disabled) {
  background: var(--action-hover);
}

.btn-success {
  background: #22c55e;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

/* --- Inputs --- */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-focus);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

/* --- Auth Page --- */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header .logo {
  font-size: 2rem;
  margin-bottom: 6px;
}

.auth-header h1 {
  font-size: 1.4rem;
  margin-bottom: 2px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* --- Tab Switcher --- */
.tab-switch {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 20px;
}

.tab-switch-btn {
  flex: 1;
  padding: 9px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition);
}

.tab-switch-btn.active {
  background: #fff;
  color: #000;
}

/* --- Content Tabs --- */
.content-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.content-tab {
  padding: 9px 18px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  bottom: -1px;
  border-bottom: 2px solid transparent;
}

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

.content-tab.active {
  color: #fff;
  border-bottom-color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Resource Cards --- */
.resource-card {
  display: flex;
  gap: 14px;
  padding: 14px;
}

.resource-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  overflow: hidden;
}

.resource-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resource-info {
  flex: 1;
  min-width: 0;
}

.resource-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 3px;
  color: #fff;
}

.resource-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.resource-cost {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  background: #2a2a2a;
  color: var(--warning);
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
}

.resource-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

/* --- Version Cards --- */
.version-card {
  padding: 18px;
}

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

.version-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.latest-badge {
  padding: 2px 7px;
  background: #fff;
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 3px;
  text-transform: uppercase;
}

.version-meta {
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.version-meta-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.version-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* --- Badge / Status --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-pending {
  background: #2a2a00;
  color: var(--warning);
}

.badge-approved {
  background: #002a00;
  color: var(--success);
}

.badge-rejected {
  background: #2a0000;
  color: var(--danger);
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success {
  background: #1a1a1a;
  border: 1px solid #22c55e;
  color: #44ff44;
}

.toast-error {
  background: #1a1a1a;
  border: 1px solid #ff4444;
  color: #ff4444;
}

.toast-info {
  background: #1a1a1a;
  border: 1px solid #fff;
  color: #fff;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow);
}

.modal-title {
  font-size: 1.1rem;
  margin-bottom: 14px;
  color: #fff;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.empty-state p {
  font-size: 0.9rem;
}

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #333;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  gap: 10px;
  color: var(--text-secondary);
}

/* --- Section Header --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

/* --- Page Content --- */
.page-content {
  flex: 1;
  padding: 20px 0;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-auto {
    grid-template-columns: 1fr;
  }

  .navbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 0;
    gap: 6px;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .resource-card {
    flex-direction: column;
  }

  .resource-thumb {
    width: 100%;
    height: 100px;
  }

  .resource-actions {
    flex-direction: row;
  }

  .version-meta {
    flex-direction: column;
    gap: 3px;
  }

  .auth-card {
    padding: 20px 16px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }

  .glass-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 1.4rem;
  }
}
