/* =============================================================
   Iris Settings — Aligned Design Language (Light Mode)
   ============================================================= */

@view-transition {
  navigation: auto;
}

:root {
  /* Aligned Design Tokens */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8F9FA;
  --bg-tertiary: #F1F3F4;
  --bg-hover: #EEEEF0;

  --text-primary: #0D0D0D;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  --text-subtle: #9CA3AF;

  --accent: #9147FF; /* Twitch Purple */
  --accent-hover: #772CE8;
  --accent-light: rgba(145, 71, 255, 0.1);
  --accent-border: rgba(145, 71, 255, 0.25);

  --border: #E5E7EB;
  --border-strong: #D1D5DB;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.10);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Iris-specific overrides mapped to design system variables */
  --bg-dark: var(--bg-primary);
  --bg-panel: var(--bg-secondary);
  --bg-card: var(--bg-primary);
  --glass-bg: var(--bg-secondary);
  --glass-border: var(--border);
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --text-light: var(--text-primary);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* =============================================================
   NAVIGATION
   ============================================================= */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  text-decoration: none;
}

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

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition);
}
.nav-avatar:hover {
  border-color: var(--border-strong);
}

/* Sub-Navigation for Iris Settings */
.sub-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.sub-nav-inner {
  display: flex;
  align-items: center;
  height: 48px;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

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

.sub-nav .tab-btn {
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}

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

.sub-nav .tab-btn.active {
  background: var(--accent-light);
  color: var(--accent);
}

/* User dropdown menu */
#kn-user-dropdown {
  position: relative;
}
#kn-user-menu {
  position: absolute;
  right: 0;
  top: 120%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 180px;
  display: none;
  overflow: hidden;
  z-index: 200;
}
#kn-user-menu.active {
  display: block;
}
.kn-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--bg-secondary);
  transition: background var(--transition);
  background: none;
  border: none;
  cursor: pointer;
}
.kn-menu-item:hover { background: var(--bg-hover); }
.kn-menu-item.logout { color: #DC2626; }
.kn-menu-item.logout:hover { background: #FEF2F2; }

/* =============================================================
   MAIN CONTENT
   ============================================================= */
#main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Cards */
.settings-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.settings-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.settings-card h2 i { color: var(--accent); }

.settings-card .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.settings-card.danger {
  border-color: rgba(220, 38, 38, 0.2);
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--danger-bg) 100%);
}

.settings-card.danger h2 i { color: var(--danger); }

/* Channel list / Mod list / Danger item */
.channel-item, .mod-item, .danger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  transition: border-color var(--transition);
}

.channel-item:hover, .mod-item:hover {
  border-color: var(--border-strong);
}

.channel-info, .mod-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.channel-avatar, .mod-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.mod-item .mod-avatar {
  width: 36px;
  height: 36px;
  font-size: 0.95rem;
}

.channel-details .name, .mod-name {
  font-weight: 600;
  font-size: 0.975rem;
  color: var(--text-primary);
}

.channel-details .meta, .mod-role {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.token-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* Inputs */
input[type="text"] {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
  transition: all var(--transition);
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Invite form & role selector */
.invite-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
}

.role-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.role-option {
  flex: 1;
  min-width: 140px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-option:hover { border-color: var(--border-strong); }

.role-option input[type="radio"] { display: none; }

.role-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.role-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.role-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons inside list items */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
}

.btn-primary {
  background-color: var(--accent);
  color: white;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-light);
}

.btn-cyan {
  background-color: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.btn-cyan:hover {
  background-color: rgba(145, 71, 255, 0.2);
}

.btn-danger {
  background-color: #FEF2F2;
  color: #DC2626;
  border: 1px solid rgba(220, 38, 38, 0.15);
}
.btn-danger:hover {
  background-color: #FEE2E2;
}

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

.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; }

/* Select inside list items */
select.btn {
  appearance: none;
  padding-right: 28px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Toast styling matching the dashboard toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  min-width: 260px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  animation: slideInRight 0.3s ease;
}

.toast.success { border-left-color: #10B981; }
.toast.error { border-left-color: #EF4444; }

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }

/* Responsive */
@media (max-width: 768px) {
  #main { padding: 20px; }
  .role-selector { flex-direction: column; }
  .channel-item { flex-direction: column; align-items: flex-start; gap: 12px; }
  .danger-item { flex-direction: column; align-items: flex-start; gap: 16px; }
}
