/* Modern CSS Reset & Design Tokens */
:root {
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.3);

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);

  --emerald: #10b981;
  --purple: #a855f7;
  --blue: #3b82f6;
  --amber: #f59e0b;
  --rose: #f43f5e;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "Fira Code", monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --glass-backdrop: blur(12px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: rgba(13, 17, 28, 0.95);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-left: 8px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--border-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text h2 span {
  color: var(--primary);
}

.version-tag {
  font-size: 11px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-glow);
  color: #ffffff;
  border: 1px solid var(--border-highlight);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
}

.author-badge {
  display: flex;
  flex-direction: column;
  color: var(--text-dim);
}

.author-badge strong {
  color: var(--text-main);
  font-size: 12px;
}

.license-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
}

.footer-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.github-link:hover {
  color: var(--primary);
}

/* Main Content */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 32px 40px;
  max-width: 1400px;
}

/* Top Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-title p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald);
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

/* Tab Management */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

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

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-icon.purple {
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple);
}
.stat-icon.emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
}
.stat-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}
.stat-icon.amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2px 0;
}

.stat-trend {
  font-size: 11px;
  color: var(--text-dim);
}

/* Cards & Layout Grid */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.card-body {
  padding: 24px;
}

.p-0 {
  padding: 0 !important;
}
.mt-4 {
  margin-top: 16px;
}
.mt-6 {
  margin-top: 24px;
}
.mb-6 {
  margin-bottom: 24px;
}
.hidden {
  display: none !important;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-field,
.textarea-field {
  width: 100%;
  background: rgba(9, 13, 22, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.input-field:focus,
.textarea-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-field.readonly {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: not-allowed;
}

.textarea-field {
  font-family: var(--font-mono);
  font-size: 13px;
  resize: vertical;
}

.input-inline {
  width: 220px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-emerald {
  background: var(--emerald);
  color: #ffffff;
}

.btn-emerald:hover {
  background: #059669;
}

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

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-block {
  width: 100%;
}

/* Server Info List */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.info-key {
  color: var(--text-muted);
}

.info-val {
  font-weight: 600;
}

.author-link {
  color: var(--primary);
  text-decoration: none;
}

.author-link:hover {
  text-decoration: underline;
}

.social-links {
  display: flex;
  gap: 8px;
}

.social-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.social-badge.medium {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.social-badge.medium:hover {
  background: rgba(16, 185, 129, 0.3);
}

.social-badge.linkedin {
  background: rgba(10, 102, 194, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.social-badge.linkedin:hover {
  background: rgba(10, 102, 194, 0.3);
}

.social-badge.github {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.social-badge.github:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Debug Log Stream */
.log-stream {
  background: #060911;
  height: 480px;
  overflow-y: auto;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-entry {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  line-height: 1.4;
}

.log-entry.system {
  border-left: 3px solid var(--blue);
}
.log-entry.event {
  border-left: 3px solid var(--emerald);
}
.log-entry.error {
  border-left: 3px solid var(--rose);
}

.log-time {
  color: var(--text-dim);
  font-size: 11px;
}

.log-msg {
  color: var(--text-main);
  word-break: break-all;
}

/* Code Snippets & Tables */
.code-block {
  background: #05080e;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.snippet-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.snippet-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
}

.snippet-tab.active {
  background: var(--primary-glow);
  color: var(--primary);
}

.snippet-content {
  display: none;
}

.snippet-content.active {
  display: block;
}

/* User Badge in Header */
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.user-badge .method-badge {
  background: var(--primary-glow);
  color: var(--primary);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-badge .btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
}

.user-badge .btn-icon:hover {
  color: var(--rose);
  background: rgba(244, 63, 94, 0.1);
}

/* Modal Overlay & Login Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 6, 12, 0.88);
  backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  box-shadow:
    var(--shadow-lg),
    0 0 40px var(--primary-glow);
  border-radius: 18px;
  padding: 32px;
  animation: modalPop 0.3s ease-out;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--border-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-header h2 span {
  color: var(--primary);
}

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

.cf-one-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 12px;
}

.cf-one-banner .cf-icon {
  font-size: 18px;
}

.cf-one-banner .cf-text {
  display: flex;
  flex-direction: column;
  color: var(--text-muted);
}

.cf-one-banner .cf-text strong {
  color: var(--emerald);
  margin-bottom: 2px;
}

.login-error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--rose);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 16px;
  text-align: center;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 14px;
}

/* Toast Notification Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

.toast.toast-out {
  opacity: 0;
  transform: translateX(100%);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.success {
  border-left: 4px solid var(--emerald);
}
.toast.error {
  border-left: 4px solid var(--rose);
}
.toast.info {
  border-left: 4px solid var(--primary);
}

.toast-icon {
  font-size: 16px;
}
.toast-body {
  flex: 1;
  font-size: 13px;
  color: var(--text-main);
}
.toast-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.toast-close:hover {
  color: var(--text-main);
}

/* GitHub Pages Demo Notice Banner */
.demo-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(225, 29, 72, 0.12) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 16px 24px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.demo-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #f59e0b 0%, #e11d48 100%);
}

.demo-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.demo-banner-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: #fbbf24;
}

.demo-banner-title .alert-icon {
  font-size: 20px;
}

.demo-lang-switcher {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.demo-banner-body {
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.6;
}

.demo-banner-body p {
  margin-bottom: 8px;
}

.demo-banner-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.demo-step-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
}

.demo-step-item strong {
  color: #f59e0b;
  display: block;
  margin-bottom: 2px;
}

.demo-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.btn-cf-deploy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f6821f 0%, #faad3f 100%);
  color: #000000;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(246, 130, 31, 0.35);
  transition: all 0.2s ease;
}

.btn-cf-deploy:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(246, 130, 31, 0.5);
}

.btn-cf-deploy img {
  height: 18px;
}

