:root {
  --bg-dark: #090a0f;
  --bg-card: rgba(18, 20, 30, 0.75);
  --bg-card-hover: rgba(26, 29, 44, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(59, 130, 246, 0.3);
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.4);
  
  --accent: #10b981;
  --accent-hover: #059669;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

/* =========================================================
   NAVIGATION BAR
========================================================= */
.top-nav {
  background: rgba(13, 15, 24, 0.85);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.75rem 1.5rem;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  font-size: 1.6rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 6px 10px;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* =========================================================
   BUTTONS & INPUTS
========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.input-field, .select-field {
  width: 100%;
  background: rgba(10, 12, 18, 0.8);
  border: 1px solid var(--border-color);
  color: white;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

.input-field:focus, .select-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  background: rgba(10, 12, 18, 0.95);
}

.mono-text {
  font-family: var(--font-mono);
}

/* =========================================================
   CONTAINER & LAYOUT
========================================================= */
.main-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.card-header {
  margin-bottom: 1.25rem;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
}

.card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* =========================================================
   DOMAIN SWITCHER BAR
========================================================= */
.domain-bar-card {
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--primary);
}

.domain-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.domain-info-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.domain-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: white;
}

.domain-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 260px;
}

.domain-select {
  font-weight: 600;
  color: #60a5fa;
  background: rgba(10, 12, 18, 0.95);
}

.domain-stats-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-primary {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

/* =========================================================
   STATS GRID
========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.bg-blue { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); }
.bg-purple { background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.3); }
.bg-green { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

.stat-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
}

.stat-val code {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #60a5fa;
}

/* =========================================================
   LINK GENERATOR
========================================================= */
.generator-box {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 1rem;
  align-items: flex-end;
}

.gen-input-group label, .gen-result-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.copy-box {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .generator-box {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   TABLE & CHANNELS LIST
========================================================= */
.table-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 20px;
  color: var(--text-muted);
}

.search-wrap {
  position: relative;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.5;
}

.search-input {
  width: 100%;
  background: rgba(10, 12, 18, 0.6);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.8rem 0.5rem 2.2rem;
  border-radius: 8px;
  color: white;
  font-size: 0.88rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  background: rgba(10, 12, 18, 0.9);
}

.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

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

.data-table th {
  background: rgba(10, 12, 18, 0.7);
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.id-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  display: inline-block;
}

.channel-name-cell {
  font-weight: 600;
  color: white;
}

.platform-tag {
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.link-copy-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.action-btns {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* =========================================================
   CODE SNIPPET GUIDE
========================================================= */
.code-block-wrap {
  position: relative;
  background: rgba(7, 9, 15, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  overflow-x: auto;
}

.code-block-wrap pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.6;
}

.copy-snippet-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* =========================================================
   MODAL
========================================================= */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  background: rgba(15, 17, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalIn 0.25s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: white;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.form-hint code {
  color: #60a5fa;
  font-family: var(--font-mono);
}

.id-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.prefix-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.col-half {
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* =========================================================
   TOAST
========================================================= */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(16, 185, 129, 0.95);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 200;
  animation: toastIn 0.3s ease;
}

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