:root {
  --sidebar-bg:     transparent;
  --sidebar-border: rgba(2, 46, 50, 0.15);
  --canvas-area-bg: #F5F7F6; /* Whitish background */
  --accent:         #87EB6F; /* Highlight text color inside dark cards */
  --accent-dim:     rgba(135, 235, 111, 0.9);
  --text:           #87EB6F; /* All text inside dark boxes is lime */
  --text-dim:       rgba(135, 235, 111, 0.85);
  --text-muted:     rgba(135, 235, 111, 0.6);
  --control-bg:     rgba(135, 235, 111, 0.06); /* subtle transparent overlay */
  --control-border: rgba(135, 235, 111, 0.4);
  --font-ui:        'Inter', sans-serif;
  --font-display:   'Righteous', cursive;
  --sidebar-w:      320px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--canvas-area-bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; height: 100vh; width: 100vw; overflow: hidden; background: var(--canvas-area-bg); }

/* ── Sidebar (Left) ──────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 12px;
}
/* Scrollbar styling - thin, invisible by default, visible on hover */
.sidebar, .canvas-area {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.sidebar:hover, .canvas-area:hover {
  scrollbar-color: rgba(2, 46, 50, 0.25) transparent;
}
.sidebar::-webkit-scrollbar,
.canvas-area::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
.sidebar::-webkit-scrollbar-thumb,
.canvas-area::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 2px;
  transition: background 0.2s ease;
}
.sidebar:hover::-webkit-scrollbar-thumb,
.canvas-area:hover::-webkit-scrollbar-thumb {
  background: rgba(2, 46, 50, 0.25);
}
.sidebar::-webkit-scrollbar-track,
.canvas-area::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-header {
  padding: 24px 20px 12px;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  width: 100%;
}

.logo-title {
  font-family: var(--font-display);
  line-height: 1.25;
  color: #022E32; /* Dark teal text on light background */
  letter-spacing: 0.02em;
}
.sidebar .logo-title {
  font-size: 26px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.info-sidebar .logo-title {
  font-size: 20px;
  white-space: nowrap;
}

/* Floating boxes for sections (playful / modern) */
.control-group {
  background: #022E32; /* Deep dark teal card background */
  border: none;
  border-radius: 16px; /* Playfully rounded */
  padding: 16px 18px;
  margin: 8px 16px;
  flex-shrink: 0;
  color: var(--text);
}

.group-label {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  /* Removed border-left and padding-left */
}

.control-note {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* ── Format buttons ──────────────────────── */

.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.format-btn {
  padding: 9px 10px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
.format-btn:hover  { border-color: var(--accent); color: var(--text); background: rgba(135, 235, 111, 0.12); transform: translateY(-1px); }
.format-btn:active { transform: translateY(0); }
.format-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #022E32; /* dark teal text inside active lime button */
  font-weight: 700;
}
.format-btn.disabled-btn {
  opacity: 0.25 !important;
  filter: grayscale(100%) !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.25) !important;
  text-decoration: line-through;
}

/* ── Checkboxes (Herbs) ──────────────────── */

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: color 0.12s ease;
}
.checkbox-label:hover {
  color: var(--text);
}

.herb-checkbox, .meta-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--control-border);
  background-color: var(--control-bg);
  border-radius: 4px; /* clean modern rounded square */
  display: inline-block;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
  transition: border-color 0.2s, background-color 0.2s;
}
.herb-checkbox:hover, .meta-checkbox:hover {
  border-color: var(--accent);
}

.herb-checkbox::after, .meta-checkbox::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 5px;
  height: 5px;
  background-color: var(--accent);
  border-radius: 50%; /* sleek dot inside square */
  transform: scale(0);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.herb-checkbox:checked, .meta-checkbox:checked {
  border-color: var(--accent);
  background-color: rgba(135, 235, 111, 0.1);
}

.herb-checkbox:checked::after, .meta-checkbox:checked::after {
  transform: scale(1);
}

.meta-checkbox {
  margin-top: 8px;
  flex-shrink: 0;
}

/* ── Sliders ─────────────────────────────── */

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.slider-row:last-child { margin-bottom: 0; }

.slider-label { font-size: 13px; color: var(--text-dim); width: 80px; flex-shrink: 0; }

/* Hidden numeric slider value displays */
.slider-val {
  display: none;
}

input[type="range"] {
  flex: 1; height: 6px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 3px;
  outline: none;
  appearance: none; cursor: pointer;
  transition: border-color 0.12s;
}
input[type="range"]:hover {
  border-color: var(--accent-dim);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.1s ease, background-color 0.1s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: var(--accent-dim);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%; border: none; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.1s ease, background-color 0.1s ease;
}
input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.25);
  background: var(--accent-dim);
}

.disabled-group {
  opacity: 0.25;
  filter: grayscale(80%);
  pointer-events: none !important;
  user-select: none;
  transition: all 0.2s ease;
}

/* ── Buttons ─────────────────────────────── */

.toggle-row { display: flex; }
.toggle-row .btn-secondary { flex: 1; text-align: center; }

.btn-primary, .btn-secondary {
  padding: 9px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid;
  border-radius: 8px;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: #022E32; /* dark teal text */
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent-dim); border-color: var(--accent-dim);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--control-bg); border-color: var(--control-border); color: var(--text-dim); }
.btn-secondary:hover { border-color: var(--accent); color: var(--text); background: rgba(135, 235, 111, 0.12); }
.btn-secondary:active { transform: translateY(0); }
.btn-secondary.on { border-color: var(--accent); color: var(--accent); background: rgba(135, 235, 111, 0.16); }

.actions-group { display: flex; gap: 6px; }
.actions-group .btn-primary,
.actions-group .btn-secondary { flex: 1; text-align: center; }

#bgVideoControls.actions-group .btn-secondary {
  flex: 1;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  font-size: 13px;
  color: #022E32; /* Dark teal text on light background */
  letter-spacing: 0.02em;
  line-height: 1.5;
  margin-top: auto;
  border-top: none;
  opacity: 0.8;
}

/* ── Info Sidebar (Right) ────────────────── */

.info-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-left: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Width doesn't change when collapsing */
}

.info-sidebar .sidebar-header {
  height: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 20px 12px;
  cursor: pointer;
  user-select: none;
}
.info-sidebar .sidebar-header:hover .info-toggle {
  transform: scale(1.1);
}
.info-sidebar.collapsed .sidebar-header:hover .info-toggle {
  transform: rotate(-90deg) scale(1.1);
}

.info-toggle {
  background: none;
  border: none;
  color: #022E32;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s;
  pointer-events: none;
}

/* When collapsed: points right */
.info-sidebar.collapsed .info-toggle {
  transform: rotate(-90deg);
}

.info-fields {
  background: #022E32; /* Deep dark teal card background */
  border: none;
  border-radius: 16px;
  padding: 18px;
  margin: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
  color: var(--text);
  
  /* Vertical folding transitions */
  max-height: 1000px;
  opacity: 1;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding 0.3s ease,
              margin 0.3s ease;
}

/* Light scrollbars inside dark green containers - thin, invisible by default, visible on hover */
.info-fields, .lineup-input {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.info-fields:hover, .lineup-input:hover {
  scrollbar-color: rgba(135, 235, 111, 0.25) transparent;
}
.info-fields::-webkit-scrollbar,
.lineup-input::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
.info-fields::-webkit-scrollbar-thumb,
.lineup-input::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 2px;
  transition: background 0.2s ease;
}
.info-fields:hover::-webkit-scrollbar-thumb,
.lineup-input:hover::-webkit-scrollbar-thumb {
  background: rgba(135, 235, 111, 0.25);
}
.info-fields::-webkit-scrollbar-track,
.lineup-input::-webkit-scrollbar-track {
  background: transparent;
}

.field-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.field-row:last-child { margin-bottom: 0; }
.field-row--tall { align-items: flex-start; }

.field-label {
  font-size: 13px;
  color: var(--text-dim);
  width: 80px;
  flex-shrink: 0;
  padding-top: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.text-input, .select-input, .textarea-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  min-width: 0;
  line-height: 1.4;
  border-radius: 8px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.text-input:focus,
.select-input:focus,
.textarea-input:focus {
  border-color: var(--accent);
  background-color: rgba(135, 235, 111, 0.12);
}

.select-input { appearance: none; cursor: pointer; color: var(--accent); }
/* Custom select dropdown styling overlay inside dark backgrounds */
.select-input option {
  background: #022E32;
  color: #87EB6F;
}
.textarea-input { resize: vertical; min-height: 80px; }
.lineup-input { resize: none; overflow-y: auto; min-height: 120px; }

.info-export-group {
  max-height: 500px;
  opacity: 1;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding 0.3s ease,
              margin 0.3s ease;
  margin-top: auto;
}

/* Collapsed State: sidebar remains standard width, but fields fold vertically */
.info-sidebar.collapsed .info-fields {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  pointer-events: none;
  box-shadow: none;
}

/* ── Canvas area ─────────────────────────── */

.canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas-area-bg);
  overflow: auto;
  padding: 24px;
}

#canvas-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

#canvas-container canvas {
  display: block;
  cursor: crosshair;
  box-shadow:
    0 0 0 1px rgba(2, 46, 50, 0.15),
    0 12px 64px rgba(2, 46, 50, 0.2);
  border-radius: 2px;
}

/* ── Info Grid (Compact Event Info) ─────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 10px;
  width: 100%;
}

.info-grid .field-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.info-grid .field-col.span-2 {
  grid-column: span 2;
}

.info-grid .field-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  width: auto;
  padding-top: 0;
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-grid .text-input,
.info-grid .select-input,
.info-grid .textarea-input {
  padding: 6px 10px;
  font-size: 12px;
  height: 30px;
  border-radius: 6px;
  width: 100%;
}

.info-grid .textarea-input {
  height: auto;
  min-height: 48px;
  resize: none;
}

/* ── Gallery Modal ───────────────────────── */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(2, 46, 50, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: #022E32;
  border: 1px solid rgba(135, 235, 111, 0.25);
  border-radius: 24px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: visible; /* Fixed tooltip clipping: allow tooltips to overflow the modal container */
}

.modal.open .modal-content {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(135, 235, 111, 0.15);
}

.modal-header h2 {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 22px;
  margin: 0;
  letter-spacing: 0.02em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s, transform 0.15s;
}

.modal-close:hover {
  color: var(--accent);
  transform: scale(1.1);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Modal Tabs */
.gallery-tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(135, 235, 111, 0.15);
  padding-bottom: 8px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 14px;
  padding: 6px 4px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.tab-btn.active {
  color: var(--accent);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent);
  border-radius: 2px;
}

.tab-content {
  display: none;
}

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

/* Grid for gallery items inside modal */
.modal-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.modal-gallery-grid .gallery-item,
.modal-gallery-grid .saved-look-item {
  margin: 0;
}

/* ── Sidebar Description & Premium Icon Button Styles ───────────────────── */
.sidebar-description {
  font-size: 13px;
  color: #022E32;
  opacity: 0.85;
  margin: -4px 20px 16px;
  line-height: 1.5;
  font-family: var(--font-ui);
  font-weight: 700;
}

.reset-top-btn {
  background: #022E32;
  border: none;
  color: #F5F7F6;
  padding: 7px;
  cursor: pointer;
  border-radius: 6px;
  line-height: 0;
}

.modal-gallery-grid .gallery-item,
.modal-gallery-grid .saved-look-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(135, 235, 111, 0.15);
  border-radius: 12px;
  overflow: visible; /* Fixed tooltip clipping: allow tooltips to overflow the card container */
  display: flex;
  flex-direction: column;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  margin: 0;
}

.modal-gallery-grid .gallery-item:hover,
.modal-gallery-grid .saved-look-item:hover {
  border-color: rgba(135, 235, 111, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.gallery-thumb,
.saved-look-thumb {
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: rgba(2, 46, 50, 0.4);
  border-bottom: 1px solid rgba(135, 235, 111, 0.1);
  display: block;
  border-top-left-radius: 11px; /* Rounded thumbnail top corners since parent is overflow: visible */
  border-top-right-radius: 11px;
}

.saved-look-actions-left,
.gallery-actions-left {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  display: flex;
  gap: 6px;
}

.saved-look-actions-right,
.gallery-actions-right {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: rgba(2, 46, 50, 0.8);
  border: 1px solid rgba(135, 235, 111, 0.25);
  color: var(--accent);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  position: relative; /* Required for tooltip placement */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.icon-btn:hover {
  background: #022E32;
  border-color: var(--accent);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(135, 235, 111, 0.2);
}

.icon-btn:active {
  transform: translateY(0);
}

/* Custom Tooltips */
.icon-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #022E32;
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(135, 235, 111, 0.25);
  z-index: 100;
}

.icon-btn:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.icon-btn[data-tooltip="Löschen"] {
  background: rgba(255, 99, 99, 0.85);
  border-color: rgba(255, 99, 99, 0.4);
  color: #ffffff;
}

.icon-btn[data-tooltip="Löschen"]:hover {
  background: #ff6363;
  border-color: #ff8888;
  box-shadow: 0 4px 12px rgba(255, 99, 99, 0.35);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.02em;
  font-weight: 500;
}