/* ===== DOMAINS Admin Panel CSS ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #d97706;
  --text: #1e293b;
  --text2: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
}

html { font-size: 15px; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Login Page ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.login-card {
  background: var(--card);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

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

.login-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.login-header p {
  color: var(--text2);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group label .hint {
  font-weight: 400;
  color: var(--text2);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s;
  background: #fafbfc;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

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

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none !important;
}

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

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

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(0.9); }

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

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: var(--success);
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--primary);
}

/* ===== Layout ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: #1e293b;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-header .role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
}

.role-badge.admin { background: var(--primary); }
.role-badge.editor { background: var(--success); }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  transition: all 0.2s;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: white;
  background: rgba(255,255,255,0.1);
}

.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .user-name {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 24px 32px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== Domain Cards ===== */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.domain-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  transition: all 0.2s;
}

.domain-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.domain-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-all;
}

.domain-card .domain-meta {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 14px;
}

.domain-card .domain-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Editor ===== */
.editor-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.editor-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.editor-section-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text2);
}

.editor-section-header .toggle-icon {
  transition: transform 0.2s;
  color: var(--text2);
}

.editor-section-header.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.editor-section-body {
  padding: 20px;
}

.editor-section-body.collapsed {
  display: none;
}

/* ===== Slides Editor ===== */
.slide-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.slide-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
}

.slide-card-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.slide-card-del {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}
.slide-card-del:hover {
  background: var(--danger);
  color: white;
}

.slide-card-body {
  display: flex;
  gap: 14px;
  padding: 12px;
  align-items: flex-start;
}

.slide-card-preview {
  width: 100px;
  height: 66px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--border);
  flex-shrink: 0;
}

.slide-card-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.slide-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slide-field-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  width: 52px;
  flex-shrink: 0;
}

.slide-field-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font);
  background: white;
}

.slide-field-input:read-only {
  background: #f1f5f9;
  color: var(--text2);
}

.slide-field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ===== Color Picker ===== */
.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-field input[type="color"] {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  cursor: pointer;
  background: white;
}

.color-field input[type="text"] { width: 130px; }

/* ===== Config Box ===== */
.config-output {
  position: relative;
  background: #1e293b;
  border-radius: var(--radius);
  margin-top: 12px;
  overflow: hidden;
}

.config-output pre {
  padding: 20px;
  color: #e2e8f0;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

.config-output .copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
}

.config-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}

.config-tab {
  padding: 10px 20px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.2s;
}

.config-tab:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.config-tab:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.config-tab + .config-tab { border-left: none; }

.config-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ===== Image Gallery ===== */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.image-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.image-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.image-item .image-name {
  padding: 6px 8px;
  font-size: 0.75rem;
  color: var(--text2);
  word-break: break-all;
}

.image-item .image-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(220,38,38,0.8);
  color: white;
  cursor: pointer;
  font-size: 0.7rem;
  display: none;
  align-items: center;
  justify-content: center;
}

.image-item:hover .image-delete { display: flex; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--text2);
  transition: all 0.2s;
  cursor: pointer;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(37,99,235,0.03);
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-backdrop.show .modal { transform: translateY(0); }

.modal h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

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

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 2000;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ===== Users Table ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  background: #f8fafc;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.data-table tr:last-child td { border-bottom: none; }

/* ===== Commands Box ===== */
.commands-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

.commands-box h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 10px;
}

.command-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.command-line code {
  flex: 1;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.82rem;
  background: white;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text);
}

/* ===== Rich Text Editor ===== */
.richtext-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.rt-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
}

.rt-toolbar button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1.2;
}
.rt-toolbar button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.rt-toolbar select {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.82rem;
  background: white;
  cursor: pointer;
}

.rt-editor {
  min-height: 120px;
  padding: 12px;
  background: white;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.6;
}
.rt-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.rt-editor h2, .rt-editor h3, .rt-editor h4, .rt-editor h5, .rt-editor h6 {
  margin: 0.5em 0 0.3em;
}
.rt-editor p { margin: 0 0 0.5em; }
.rt-editor a { color: var(--primary); text-decoration: underline; }

/* ===== Inline Upload ===== */
.inline-upload {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inline-upload-preview {
  width: 80px;
  height: 50px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.inline-upload-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.inline-upload-controls input[type="text"] {
  flex: 1;
  background: #f8fafc;
  cursor: default;
}

.inline-upload-btn {
  white-space: nowrap;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.inline-upload-btn:hover {
  background: var(--bg);
  color: var(--text);
}

/* ===== Mobile Header ===== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #1e293b;
  color: white;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  z-index: 110;
}

.mobile-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.hamburger {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
}
.hamburger:hover { background: rgba(255,255,255,0.12); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 120;
}
.sidebar-overlay.show { display: block; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  /* Hamburger-Header sichtbar */
  .mobile-header { display: flex; }

  /* Sidebar slide-in */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 130;
  }
  .sidebar.open { transform: translateX(0); }

  /* Main Content unter dem Mobile-Header */
  .main-content { margin-left: 0; padding: 72px 16px 24px; }

  /* Grids */
  .domain-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  /* Page Header */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .actions { width: 100%; }

  /* Slide Cards */
  .slide-card-body { flex-direction: column; }
  .slide-card-preview { width: 100%; height: auto; max-height: 120px; }

  /* Inline Upload */
  .inline-upload { flex-direction: column; align-items: flex-start; }
  .inline-upload-preview { width: 60px; height: 40px; }

  /* Data Table scrollbar */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .data-table td, .data-table th { white-space: nowrap; }

  /* Modal */
  .modal { max-width: calc(100vw - 32px); padding: 20px; }
  .modal-backdrop { padding: 16px; }

  /* Toast */
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }

  /* Rich Text Toolbar */
  .rt-toolbar { flex-wrap: wrap; }

  /* Config Tabs */
  .config-tabs { overflow-x: auto; white-space: nowrap; }

  /* Login Card */
  .login-card { padding: 28px 20px; margin: 16px; }

  /* Deploy-Pfade Zeile */
  .deploy-path-row { flex-direction: column !important; }
}
