/* ---- Modern Astroid Admin Panel ---- */

* {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(135deg, #0f0f14 0%, #1a1a2e 100%);
  overflow: hidden;
  width: 100vw;
  min-height: 100vh;
  color: #ffffff;
  touch-action: manipulation; /* Optimiert für Touch-Geräte */
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Left Sidebar ---- */
.left-search {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  background: rgba(16, 18, 27, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.3s ease;
}

/* Mobile Hamburger Button */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 700; /* Higher z-index to stay above mobile menu */
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  width: 48px;
  height: 48px;
  cursor: pointer;
  color: #ffffff;
  font-size: 18px;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(59, 130, 246, 0.3);
  transform: scale(1.05);
}

.mobile-menu-toggle.active {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

.left-search input[type="text"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: #ffffff;
  transition: all 0.2s ease;
}

.left-search input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.left-search input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-match {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.search-match::-webkit-scrollbar {
  width: 4px;
}

.search-match::-webkit-scrollbar-track {
  background: transparent;
}

.search-match::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.match {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.match:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateX(2px);
}

.match:last-child {
  margin-bottom: 0;
}

/* ---- Main Container ---- */
.maincontainer {
  margin-left: 280px;
  padding: 32px;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.maincontainer::-webkit-scrollbar {
  width: 6px;
}

.maincontainer::-webkit-scrollbar-track {
  background: transparent;
}

.maincontainer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* ---- Header ---- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header .logo {
  width: 200px;
}

header .logo img {
  width: 100%;
  height: auto;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

header .logo img:hover {
  opacity: 0.8;
}

nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

nav button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

nav button.add-channel {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-color: #3b82f6;
}

nav button.add-channel:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

nav button.logout {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

nav button.logout:hover {
  background: rgba(239, 68, 68, 0.2);
}

nav button.endpoint_check_summaries:hover {
  background: rgba(255, 255, 255, 0.15);
}

nav button.json-editor-toggle {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #10b981;
}

nav button.json-editor-toggle:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* ---- Channels Grid ---- */
.channels {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 40px;
}

.discord_channels,
.guilded_channels,
.revolt_channels,
.nerimity_channels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.channel {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.channel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.channel:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.channel:hover::before {
  opacity: 1;
}

.channel h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: #ffffff;
}

.channel-name {
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.channel-id {
  display: none;
}

.edit-channel {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 500;
  margin-top: 16px;
}

.edit-channel:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  margin: 0;
}

/* ---- Input Fields ---- */
input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 16px;
  color: #ffffff;
  font-size: 14px;
  transition: all 0.2s ease;
  width: 100%;
}

input:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* ---- Side Panels ---- */
.log-channels {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  width: 400px;
  float: left;
  margin-right: 24px;
}

.log-channels h1 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 24px 0;
  text-align: center;
}

.log-channels p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 500;
  margin: 16px 0 8px 0;
}

.log-channels input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 16px;
}

.log-channels button {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border: none;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  margin-top: 8px;
}

.log-channels button:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-1px);
}

.blacklist,
.allowed-ids-div {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  width: 400px;
  float: left;
  margin-right: 24px;
}

.blacklist h1,
.allowed-ids-div h1 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 24px 0;
  text-align: center;
}

.blacklist-input,
.allowed-ids-input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 16px;
  text-align: center;
}

.blacklisted-words,
.allowed-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.word,
.allowed-id {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.word:hover,
.allowed-id:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.blacklist button,
.allowed-ids-div button {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border: none;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

.blacklist button:hover,
.allowed-ids-div button:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-1px);
}

/* ---- JSON Editor ---- */
.json-editor-div {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  width: 100%;
  clear: both;
}

.json-editor-div h1 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 24px 0;
  text-align: center;
}

.json-editor-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.json-editor-controls button {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border: none;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  min-width: 120px;
}

.json-editor-controls button:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-1px);
}

.json-editor-controls button.format-json {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.json-editor-controls button.format-json:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.json-editor-controls button.validate-json {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.json-editor-controls button.validate-json:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.json-editor-controls button.save-json {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.json-editor-controls button.save-json:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.json-editor-status {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  min-height: 20px;
  transition: all 0.2s ease;
}

.json-editor-status.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.json-editor-status.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.json-editor-status.info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

/* ---- JSON Editor ---- */
.json-editor-div {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  height: max-content;
  margin-bottom: 24px;
  width: 100%;
  clear: both;
}

.json-editor-div h1 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 24px 0;
  text-align: center;
}

.json-editor-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.json-editor-controls button {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border: none;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  min-width: 120px;
}

.json-editor-controls button:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-1px);
}

.json-editor-controls button.format-json {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.json-editor-controls button.format-json:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.json-editor-controls button.validate-json {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.json-editor-controls button.validate-json:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.json-editor-controls button.save-json {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.json-editor-controls button.save-json:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.json-editor-status {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  min-height: 20px;
  transition: all 0.2s ease;
}

.json-editor-status.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.json-editor-status.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.json-editor-status.info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.json-editor-container {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  height: 500px;
}

.json-editor-container:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.json-editor-codemirror {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
}

/* CodeMirror custom styling */
.json-editor-codemirror .CodeMirror {
  background: transparent !important;
  color: #ffffff;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  border-radius: 12px;
}

.json-editor-codemirror .CodeMirror-gutters {
  background: rgba(0, 0, 0, 0.3) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.json-editor-codemirror .CodeMirror-linenumber {
  color: rgba(255, 255, 255, 0.4) !important;
}

.json-editor-codemirror .CodeMirror-cursor {
  border-left: 2px solid #ffffff !important;
}

.json-editor-codemirror .CodeMirror-selected {
  background: rgba(59, 130, 246, 0.3) !important;
}

.json-editor-codemirror .CodeMirror-focused .CodeMirror-selected {
  background: rgba(59, 130, 246, 0.4) !important;
}

/* JSON syntax highlighting colors */
.json-editor-codemirror .cm-string { 
  color: #a3e635 !important; /* Light green for strings */
}

.json-editor-codemirror .cm-number { 
  color: #fbbf24 !important; /* Yellow for numbers */
}

.json-editor-codemirror .cm-atom { 
  color: #f87171 !important; /* Light red for true/false/null */
}

.json-editor-codemirror .cm-property { 
  color: #60a5fa !important; /* Light blue for properties */
}

.json-editor-codemirror .cm-punctuation { 
  color: #d1d5db !important; /* Light gray for brackets, commas */
}

.json-editor-codemirror .cm-bracket { 
  color: #fbbf24 !important; /* Yellow for brackets */
}

/* STRONG permanent JSON error marking - always visible */
.json-editor-codemirror .json-error-permanent,
.json-editor-codemirror .json-error-permanent span,
.json-editor-codemirror span.json-error-permanent {
  background-color: rgba(239, 68, 68, 0.3) !important;
  border-bottom: 3px wavy #ef4444 !important;
  text-decoration: underline wavy #ef4444 !important;
  position: relative !important;
  box-shadow: 0 2px 0 rgba(239, 68, 68, 0.5) !important;
}

.json-editor-codemirror .json-error-permanent:hover {
  background-color: rgba(239, 68, 68, 0.4) !important;
}

/* Line-based error marking - make it very visible */
.json-editor-codemirror .json-line-error {
  background-color: rgba(239, 68, 68, 0.15) !important;
  border-left: 4px solid #ef4444 !important;
}

/* Force underlines on ANY marked text with error styling */
.json-editor-codemirror .CodeMirror-line span[style*="border-bottom"],
.json-editor-codemirror .CodeMirror-line span[style*="ef4444"] {
  border-bottom: 3px wavy #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.25) !important;
  text-decoration: underline wavy #ef4444 !important;
  text-decoration-thickness: 2px !important;
}

/* Direct targeting of CodeMirror content */
.json-editor-codemirror .CodeMirror pre.CodeMirror-line span[style*="background-color: rgba(239, 68, 68"] {
  border-bottom: 3px wavy #ef4444 !important;
  text-decoration: underline wavy #ef4444 !important;
}

/* Enhanced error styling for maximum visibility */
.json-editor-codemirror .cm-error {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.3) !important;
  border-bottom: 3px wavy #ef4444 !important;
  text-decoration: underline wavy #ef4444 !important;
  font-weight: bold !important;
}

/* CodeMirror lint styling for JSON errors (fallback) */
.json-editor-codemirror .CodeMirror-lint-marker-error {
  background-color: #ef4444 !important;
  border-radius: 2px;
}

.json-editor-codemirror .CodeMirror-lint-line-error {
  background: rgba(239, 68, 68, 0.1) !important;
}

.json-editor-codemirror .CodeMirror-lint-mark-error {
  background-image: none !important;
  background-color: rgba(239, 68, 68, 0.3) !important;
  border-bottom: 2px solid #ef4444 !important;
  border-radius: 2px;
}

.json-editor-codemirror .CodeMirror-lint-tooltip {
  background: rgba(30, 30, 30, 0.95) !important;
  border: 1px solid #ef4444 !important;
  border-radius: 6px !important;
  color: #ffffff !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  backdrop-filter: blur(10px) !important;
}

.json-editor-codemirror .CodeMirror-lint-tooltip::before {
  border-top-color: #ef4444 !important;
}

.json-editor-textarea {
  width: 100%;
  height: 400px;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  padding: 16px;
  color: #ffffff;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 300px;
  transition: all 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  position: relative;
  z-index: 1;
  caret-color: #ffffff;
  border-radius: 8px;
}

.json-editor-textarea::-webkit-scrollbar {
  width: 6px;
}

.json-editor-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.json-editor-textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.json-editor-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.json-editor-textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.json-editor-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.json-editor-textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.json-editor-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* JSON Syntax Highlighting Colors (for future reference) */
.json-string {
  color: #a3e635; /* Light green for strings */
}

.json-number {
  color: #fbbf24; /* Yellow for numbers */
}

.json-boolean {
  color: #f87171; /* Light red for booleans */
}

.json-null {
  color: #94a3b8; /* Gray for null */
}

.json-key {
  color: #60a5fa; /* Blue for keys */
}

.json-punctuation {
  color: #e5e7eb; /* Light gray for punctuation */
}

.json-bracket {
  color: #c084fc; /* Purple for brackets */
  font-weight: bold;
}

.json-brace {
  color: #34d399; /* Emerald for braces */
  font-weight: bold;
}

/* ---- Popups and Modals ---- */
.edit-popup,
.add-channel-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 500px);
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(16, 18, 27, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 32px;
  color: #ffffff;
  z-index: 400;
}

.edit-popup h1,
.add-channel-popup h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 24px 0;
  text-align: center;
  color: #ffffff;
}

.edit-popup input,
.add-channel-popup input {
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.edit-popup p,
.add-channel-popup p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 500;
  margin: 16px 0 8px 0;
}

#popup-channel-id,
#popup-platform {
  display: none;
}

#input_desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 4px 0;
}

#_platform {
  font-size: 16px;
  font-weight: 600;
  color: #3b82f6;
  margin: 24px 0 16px 0;
  text-align: center;
  text-transform: capitalize;
}

.filter {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 350;
}

.close,
.save,
.delete {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin: 8px;
}

.close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.save {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
}

.delete {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
}

.close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.save:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-1px);
}

.delete:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
}

/* ---- General Popup ---- */
.popupdiv {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup {
  background: rgba(16, 18, 27, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  color: #ffffff;
}

.popup h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.popup-extras {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.popup-extras button {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

.popup-extras button:hover {
  background: rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
}

.popup-extras input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 16px;
  border-radius: 8px;
  text-align: center;
}

/* ---- Loading Animation ---- */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 450;
}

.loader {
  --background: linear-gradient(135deg, #23C4F8, #275EFE);
  --shadow: rgba(39, 94, 254, 0.28);
  --text: rgba(255, 255, 255, 0.7);
  --page: rgba(255, 255, 255, 0.36);
  --page-fold: rgba(255, 255, 255, 0.52);
  --duration: 3s;
  width: 200px;
  height: 140px;
  position: relative;
}

.loader:before, .loader:after {
  --r: -6deg;
  content: "";
  position: absolute;
  bottom: 8px;
  width: 120px;
  top: 80%;
  box-shadow: 0 16px 12px var(--shadow);
  transform: rotate(var(--r));
}

.loader:before {
  left: 4px;
}

.loader:after {
  --r: 6deg;
  right: 4px;
}

.loader div {
  width: 100%;
  height: 100%;
  border-radius: 13px;
  position: relative;
  z-index: 1;
  perspective: 600px;
  box-shadow: 0 4px 6px var(--shadow);
  background-image: var(--background);
  overflow: hidden;
}

.loader div ul {
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative;
}

.loader div ul li {
  --r: 180deg;
  --o: 0;
  --c: var(--page);
  position: absolute;
  top: 10px;
  left: 10px;
  transform-origin: 100% 50%;
  color: var(--c);
  opacity: var(--o);
  transform: rotateY(var(--r));
  animation: var(--duration) ease infinite;
}

.loader div ul li:nth-child(2) {
  --c: var(--page-fold);
  animation-name: page-2;
}

.loader div ul li:nth-child(3) {
  --c: var(--page-fold);
  animation-name: page-3;
}

.loader div ul li:nth-child(4) {
  --c: var(--page-fold);
  animation-name: page-4;
}

.loader div ul li:nth-child(5) {
  --c: var(--page-fold);
  animation-name: page-5;
}

.loader div ul li svg {
  width: 90px;
  height: 120px;
  display: block;
}

.loader div ul li:first-child {
  --r: 0deg;
  --o: 1;
}

.loader div ul li:last-child {
  --o: 1;
}

.loader span {
  display: block;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 20px;
  text-align: center;
  color: var(--text);
}

@keyframes page-2 {
  0% {
    transform: rotateY(180deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  35%, 100% {
    opacity: 0;
  }
  50%, 100% {
    transform: rotateY(0deg);
  }
}

@keyframes page-3 {
  15% {
    transform: rotateY(180deg);
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
  65%, 100% {
    transform: rotateY(0deg);
  }
}

@keyframes page-4 {
  30% {
    transform: rotateY(180deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  65%, 100% {
    opacity: 0;
  }
  80%, 100% {
    transform: rotateY(0deg);
  }
}

@keyframes page-5 {
  45% {
    transform: rotateY(180deg);
    opacity: 0;
  }
  65% {
    opacity: 1;
  }
  80%, 100% {
    opacity: 0;
  }
  95%, 100% {
    transform: rotateY(0deg);
  }
}

/* ---- Loading Button Animation ---- */
.btn-load {
  width: 45px;
  height: 26px;
  background: linear-gradient(#0000 calc(1*100%/6),#fff 0 calc(3*100%/6),#0000 0),
            linear-gradient(#0000 calc(2*100%/6),#fff 0 calc(4*100%/6),#0000 0),
            linear-gradient(#0000 calc(3*100%/6),#fff 0 calc(5*100%/6),#0000 0);
  background-size: 10px 400%;
  background-repeat: no-repeat;
  animation: matrix 1s infinite linear;
}

@keyframes matrix {
  0% {
    background-position: 0% 100%, 50% 100%, 100% 100%
  }
  100% {
    background-position: 0% 0%, 50% 0%, 100% 0%
  }
}

/* ---- Health Check Summaries ---- */
.healthcheck_summaries_div {
  position: fixed;
  top: 0;
  left: 280px;
  right: 0;
  bottom: 0;
  background: rgba(16, 18, 27, 0.95);
  backdrop-filter: blur(20px);
  color: #ffffff;
  z-index: 450;
  padding: 32px;
  overflow-y: auto;
}

.healthcheck_summaries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* ---- Links ---- */
a {
  color: #60a5fa;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* ---- Responsive Design ---- */
@media screen and (max-width: 1024px) {
  .left-search {
    width: 240px;
  }
  
  .maincontainer {
    margin-left: 240px;
  }
  
  .log-channels,
  .blacklist,
  .allowed-ids-div {
    width: 100%;
    float: none;
    margin-right: 0;
  }
}

/* ---- Mobile Responsive Design ---- */
@media screen and (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .left-search {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 100vw;
    padding: 80px 20px 20px 20px; /* Platz für Hamburger Button */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 650; /* Between hamburger button and overlay */
  }
  
  .left-search.active {
    transform: translateX(0);
  }
  
  /* Overlay when mobile menu is open */
  body:has(.left-search.active) .maincontainer::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    backdrop-filter: blur(4px);
  }
  
  .maincontainer {
    margin-left: 0;
    padding-top: 80px; /* Platz für Hamburger Button */
  }
  
  header {
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    margin-bottom: 20px;
  }
  
  header .logo {
    align-self: center;
  }
  
  nav {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  
  nav button {
    font-size: 14px;
    padding: 12px 20px;
    width: 100%;
    min-height: 48px; /* Touch-freundliche Größe */
  }
  
  .channels {
    gap: 20px;
    padding: 20px;
  }
  
  .discord_channels,
  .guilded_channels,
  .revolt_channels,
  .nerimity_channels {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .channel {
    padding: 16px;
    min-height: 60px; /* Touch-freundliche Größe */
  }
  
  /* JSON Editor mobile optimizations */
  .json-editor-div {
    padding: 20px;
  }
  
  .json-editor-controls {
    flex-direction: column;
    gap: 12px;
  }
  
  .json-editor-controls button {
    width: 100%;
    min-height: 48px;
    font-size: 14px;
  }
  
  .json-editor-container {
    margin-top: 16px;
  }
  
  .CodeMirror {
    font-size: 14px !important;
    min-height: 300px;
  }
  
  /* Popup optimizations */
  .edit-popup,
  .add-channel-popup {
    width: 95vw;
    height: 90vh;
    max-width: none;
    max-height: none;
    padding: 20px;
    overflow-y: auto;
  }
  
  .edit-popup input,
  .add-channel-popup input {
    font-size: 16px; /* Verhindert Zoom auf iOS */
    min-height: 48px;
    padding: 12px 16px;
  }
  
  .edit-popup button,
  .add-channel-popup button {
    min-height: 48px;
    font-size: 16px;
    margin: 8px 4px;
  }
  
  /* Loading screen mobile */
  .loading {
    padding: 20px;
  }
  
  .loader {
    transform: scale(0.8);
  }
  
  /* Blacklist and allowed IDs mobile */
  .blacklist,
  .allowed-ids-div {
    padding: 20px;
  }
  
  .blacklist-input,
  .allowed-ids-input {
    font-size: 16px;
    min-height: 48px;
    padding: 12px 16px;
    margin-bottom: 12px;
  }
  
  .blacklist-save,
  .allowed-ids-save {
    min-height: 48px;
    font-size: 16px;
    width: 100%;
  }
  
  /* Health check mobile */
  .healthcheck_summaries_div {
    padding: 20px;
  }
  
  .healthcheck_summaries {
    gap: 12px;
  }
  
  /* Log channels mobile */
  .log-channels {
    padding: 20px;
  }
  
  .log-channels input {
    font-size: 16px;
    min-height: 48px;
    padding: 12px 16px;
    width: 100%;
  }
  
  .log-save {
    min-height: 48px;
    font-size: 16px;
    width: 100%;
    margin-top: 16px;
  }
}

/* ---- Tablet Responsive Design ---- */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .left-search {
    width: 240px;
  }
  
  .maincontainer {
    margin-left: 240px;
  }
  
  nav button {
    font-size: 13px;
    padding: 10px 16px;
  }
  
  .discord_channels,
  .guilded_channels,
  .revolt_channels,
  .nerimity_channels {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .json-editor-controls {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .json-editor-controls button {
    flex: 1;
    min-width: 150px;
  }
}

/* ---- Small Mobile Devices (< 480px) ---- */
@media screen and (max-width: 480px) {
  .left-search {
    padding: 80px 16px 16px 16px;
  }
  
  .maincontainer {
    padding-top: 80px;
  }
  
  header {
    padding: 16px;
  }
  
  .channels {
    padding: 16px;
  }
  
  .json-editor-div {
    padding: 16px;
  }
  
  .edit-popup,
  .add-channel-popup {
    padding: 16px;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  
  .CodeMirror {
    font-size: 13px !important;
  }
}
