:root {
  --ui: #0b1f39;
  --muted: #6b7c93;
  --bg: #f8fafc;
  --panel: #ffffff;
  --primary: #537895;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --border: #e2e8f0;
  --hover: #f1f5f9;
  --success: #10b981;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ui);
}

/* Header */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ui);
}

.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.copy-btn {
  border: 1px solid var(--border);
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
}

.copy-btn:hover {
  background: #45677d;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-btn:disabled {
  background: var(--muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.copy-btn.ready {
  background: var(--success);
}

.copy-btn.copied {
  background: var(--success);
  animation: pulse 0.3s;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 0;
  min-height: calc(100vh - 60px);
  position: relative;
}

/* Categories Panel - Resizable */
.categories-panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 60px);
  position: relative;
  resize: horizontal;
  min-width: 280px;
  max-width: 600px;
}

.categories-panel h3 {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  margin: 0.25rem 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.category-item:hover {
  background: var(--hover);
}

.category-item.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.category-item.active .category-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.category-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.category-count {
  background: var(--bg);
  color: var(--muted);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

/* Content Area */
.content-area {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

/* Tabs */
.tabs {
  display: inline-flex;
  gap: 0.5rem;
  background: var(--bg);
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--ui);
  background: var(--hover);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(83, 120, 149, 0.4);
}

.tab-content {
  display: none;
}

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

.sections-header {
  margin-bottom: 2rem;
}

.sections-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ui);
}

.sections-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Sections Grid */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.loading, .no-sections {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

/* Section Card */
.section-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
  cursor: pointer;
  overflow: hidden;
}

.section-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.section-card.selected {
  border-color: var(--primary);
  border-width: 2px;
  background: #f0f7ff;
  box-shadow: 0 4px 12px rgba(83, 120, 149, 0.2);
}

.section-card.imported-section {
  border-left: 3px solid var(--success);
}

/* Section Preview Image */
.section-preview-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.section-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.section-card-header {
  margin-bottom: 1rem;
  padding: 1.5rem 1.5rem 0.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.section-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ui);
  flex: 1;
}

.imported-badge {
  background: var(--success);
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.section-card-body {
  flex: 1;
  margin-bottom: 1rem;
  padding: 0 1.5rem;
}

.section-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.section-card-footer {
  margin-top: auto;
  padding: 0 1.5rem 1.5rem 1.5rem;
  display: flex;
  gap: 0.5rem;
}

.select-section-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.select-section-btn:hover {
  background: #45677d;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section-card.selected .select-section-btn {
  background: var(--success);
}

.delete-section-btn {
  padding: 0.6rem 1rem;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
}

.delete-section-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Admin Toggle */
.admin-toggle-section {
  margin-top: 1rem;
}

.admin-toggle-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ui);
  transition: all 0.2s;
}

.admin-toggle-btn:hover {
  background: var(--hover);
  border-color: var(--primary);
}

.toggle-icon {
  font-size: 0.7rem;
  transition: transform 0.2s;
  color: var(--muted);
}

.admin-toggle-btn.active .toggle-icon {
  transform: rotate(180deg);
}

/* Import Section */
.import-section {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.import-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
  background: var(--bg);
}

.import-category-select {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.9rem;
}

.import-btn {
  width: 100%;
  padding: 0.6rem 1.2rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  margin-top: 0.75rem;
  text-align: center;
}

.import-btn:hover {
  background: #45677d;
  transform: translateY(-1px);
}

.import-image-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.85rem;
}

.import-image-preview {
  position: relative;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-height: 150px;
}

.import-image-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.remove-image-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s;
}

.remove-image-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.import-status {
  display: none;
  margin-top: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.import-status.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.import-status.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.import-heading {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.import-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.75rem 0;
}

.import-field-group {
  margin-top: 0.75rem;
}

.import-field-group label,
.import-field-grid label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.import-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.import-name-input {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.9rem;
}

.import-result {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.import-result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.import-result-header > div:first-child {
  flex: 1;
  min-width: 200px;
}

.import-result-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.import-result-filename {
  font-size: 0.8rem;
  color: var(--muted);
}

.import-result-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.import-action-btn {
  padding: 0.5rem 0.75rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.import-action-btn:hover {
  background: #45677d;
  transform: translateY(-1px);
}

.import-result-textarea {
  width: 100%;
  min-height: 220px;
  border: none;
  border-top: 1px solid var(--border);
  padding: 1rem;
  font-family: "Monaco", "Courier New", monospace;
  font-size: 0.85rem;
  background: #0f172a;
  color: #e2e8f0;
  resize: vertical;
}

.import-result-textarea:focus {
  outline: none;
}

/* Responsive */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  
  .categories-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 400px;
    overflow-y: auto;
  }
  
  .categories-panel h3 {
    margin-bottom: 0.5rem;
  }
  
  .category-item {
    padding: 0.5rem 0.75rem;
  }
  
  .content-area {
    padding: 1.5rem;
  }
  
  .sections-grid {
    grid-template-columns: 1fr;
  }
  
  .section-preview-image {
    height: 150px;
  }

  .import-field-grid {
    grid-template-columns: 1fr;
  }
}

/* Icon Search Section */
.icon-search-toggle-section {
  margin-top: 1rem;
}

.icon-search-toggle-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ui);
  transition: all 0.2s;
}

.icon-search-toggle-btn:hover {
  background: var(--hover);
  border-color: var(--primary);
}

.icon-search-toggle-btn.active .toggle-icon {
  transform: rotate(180deg);
}

.icon-search-section {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.icon-search-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.75rem 0;
}

.icon-search-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.icon-search-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.icon-tab-header h2 {
  margin: 0 0 0.5rem 0;
}

.icon-tab-header p {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.icon-strip-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.icon-strip-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.icon-search-input {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.icon-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(83, 120, 149, 0.1);
}

.icon-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  padding: 0.25rem;
}

.icon-search-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.icon-search-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-search-item:hover {
  background: var(--hover);
  border-color: var(--primary);
  transform: translateX(2px);
}

.icon-search-item.copied {
  background: #d1fae5;
  border-color: var(--success);
}

.icon-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.4rem;
  color: var(--primary);
  flex-shrink: 0;
}

.icon-search-info {
  text-align: center;
}

.icon-search-name {
  display: none; /* Namen im UI verstecken – nur Symbol zeigen */
}

.icon-search-terms {
  display: none; /* Zusätzliche Suchbegriffe nicht anzeigen */
}

.icon-search-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.icon-search-copy-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.icon-search-copy-btn.copied {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.icon-search-copy-btn i {
  font-size: 0.75rem;
}

/* Scrollbar styling for icon results */
.icon-search-results::-webkit-scrollbar {
  width: 6px;
}

.icon-search-results::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 3px;
}

.icon-search-results::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 3px;
}

.icon-search-results::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}
