/* EUI-MVP 10 · Responsive Feinschliff und UI-Polish
   Ziel: keine Audio-/Timeline-Logik ändern, nur Editor-UI robuster machen. */

:root {
  --mw-editor-gap: 0.75rem;
  --mw-editor-radius: 16px;
  --mw-editor-panel-min: 260px;
  --mw-editor-panel-bg: rgba(15, 23, 42, 0.92);
  --mw-editor-panel-border: rgba(148, 163, 184, 0.22);
  --mw-editor-muted: rgba(226, 232, 240, 0.68);
  --mw-editor-soft: rgba(148, 163, 184, 0.12);
  --mw-editor-danger: rgba(248, 113, 113, 0.18);
  --mw-editor-ok: rgba(34, 197, 94, 0.18);
  --mw-editor-warn: rgba(245, 158, 11, 0.18);
}

body[data-page="editor"],
body.mw-editor-page {
  overflow-x: hidden;
}

.mw-editor-shell,
.editor-ui-shell,
.editor-layout-shell {
  min-height: calc(100vh - 120px);
}

.mw-editor-layout,
.editor-layout-grid,
.editor-grid {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr) minmax(260px, 360px);
  grid-template-rows: auto minmax(520px, 1fr) auto;
  gap: var(--mw-editor-gap);
  align-items: stretch;
}

.mw-editor-mode-bar,
.editor-mode-bar,
.editor-session-bar {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.mw-editor-panel,
.editor-panel,
.editor-left-library,
.editor-main-timeline,
.editor-right-inspector,
.editor-bottom-mixer {
  background: var(--mw-editor-panel-bg);
  border: 1px solid var(--mw-editor-panel-border);
  border-radius: var(--mw-editor-radius);
  min-width: 0;
  box-shadow: 0 18px 40px rgba(0,0,0,0.24);
}

.editor-left-library,
.mw-editor-library-panel {
  min-height: 460px;
  max-height: calc(100vh - 210px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-main-timeline,
.mw-editor-timeline-panel {
  min-height: 520px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-right-inspector,
.mw-editor-inspector-panel {
  min-height: 460px;
  max-height: calc(100vh - 210px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-bottom-mixer,
.mw-editor-mixer-panel {
  grid-column: 1 / -1;
  min-height: 170px;
  overflow: hidden;
}

.mw-panel-scroll,
.editor-panel-scroll,
.mw-editor-scroll-area,
.editor-library-scroll,
.editor-inspector-scroll,
.editor-timeline-scroll {
  overflow: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.5) transparent;
}

.mw-panel-scroll::-webkit-scrollbar,
.editor-panel-scroll::-webkit-scrollbar,
.mw-editor-scroll-area::-webkit-scrollbar,
.editor-library-scroll::-webkit-scrollbar,
.editor-inspector-scroll::-webkit-scrollbar,
.editor-timeline-scroll::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.mw-panel-scroll::-webkit-scrollbar-thumb,
.editor-panel-scroll::-webkit-scrollbar-thumb,
.mw-editor-scroll-area::-webkit-scrollbar-thumb,
.editor-library-scroll::-webkit-scrollbar-thumb,
.editor-inspector-scroll::-webkit-scrollbar-thumb,
.editor-timeline-scroll::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.45);
  border-radius: 999px;
}

.mw-editor-panel-header,
.editor-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--mw-editor-panel-border);
}

.mw-editor-panel-title,
.editor-panel-title {
  margin: 0;
  font-size: .92rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.mw-editor-panel-actions,
.editor-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.mw-panel-toggle,
.editor-panel-toggle,
[data-editor-panel-toggle] {
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(15,23,42,.7);
  color: rgba(241,245,249,.92);
  border-radius: 999px;
  padding: .25rem .55rem;
  line-height: 1;
  cursor: pointer;
}

.mw-panel-toggle:hover,
.editor-panel-toggle:hover,
[data-editor-panel-toggle]:hover {
  background: rgba(59,130,246,.22);
}

.mw-editor-collapsed-left .editor-left-library,
.mw-editor-collapsed-left .mw-editor-library-panel,
.editor-ui-collapsed-library .editor-left-library,
.editor-ui-collapsed-library .mw-editor-library-panel {
  display: none !important;
}

.mw-editor-collapsed-right .editor-right-inspector,
.mw-editor-collapsed-right .mw-editor-inspector-panel,
.editor-ui-collapsed-inspector .editor-right-inspector,
.editor-ui-collapsed-inspector .mw-editor-inspector-panel {
  display: none !important;
}

.mw-editor-collapsed-mixer .editor-bottom-mixer,
.mw-editor-collapsed-mixer .mw-editor-mixer-panel,
.editor-ui-collapsed-mixer .editor-bottom-mixer,
.editor-ui-collapsed-mixer .mw-editor-mixer-panel {
  max-height: 54px;
  min-height: 54px;
  overflow: hidden;
}

.mw-editor-collapsed-left .mw-editor-layout,
.mw-editor-collapsed-left .editor-layout-grid,
.mw-editor-collapsed-left .editor-grid,
.editor-ui-collapsed-library .mw-editor-layout,
.editor-ui-collapsed-library .editor-layout-grid,
.editor-ui-collapsed-library .editor-grid {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.mw-editor-collapsed-right .mw-editor-layout,
.mw-editor-collapsed-right .editor-layout-grid,
.mw-editor-collapsed-right .editor-grid,
.editor-ui-collapsed-inspector .mw-editor-layout,
.editor-ui-collapsed-inspector .editor-layout-grid,
.editor-ui-collapsed-inspector .editor-grid {
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}

.mw-editor-collapsed-left.mw-editor-collapsed-right .mw-editor-layout,
.mw-editor-collapsed-left.mw-editor-collapsed-right .editor-layout-grid,
.mw-editor-collapsed-left.mw-editor-collapsed-right .editor-grid,
.editor-ui-collapsed-library.editor-ui-collapsed-inspector .mw-editor-layout,
.editor-ui-collapsed-library.editor-ui-collapsed-inspector .editor-layout-grid,
.editor-ui-collapsed-library.editor-ui-collapsed-inspector .editor-grid {
  grid-template-columns: minmax(0, 1fr);
}

.mw-editor-empty,
.mw-editor-loading,
.mw-editor-error,
.editor-empty-state,
.editor-loading-state,
.editor-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 140px;
  padding: 1rem;
  text-align: center;
  color: var(--mw-editor-muted);
  border: 1px dashed rgba(148,163,184,.28);
  border-radius: 14px;
  background: rgba(15,23,42,.32);
}

.mw-editor-error,
.editor-error-state {
  color: #fecaca;
  background: var(--mw-editor-danger);
}

.mw-editor-loading::before,
.editor-loading-state::before {
  content: "";
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid rgba(148,163,184,.35);
  border-top-color: rgba(96,165,250,.95);
  border-radius: 999px;
  animation: mw-editor-spin .75s linear infinite;
}

@keyframes mw-editor-spin { to { transform: rotate(360deg); } }

.mw-editor-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  max-width: 260px;
  padding: .45rem .6rem;
  border-radius: .65rem;
  background: rgba(2,6,23,.96);
  color: #e2e8f0;
  border: 1px solid rgba(148,163,184,.24);
  box-shadow: 0 18px 32px rgba(0,0,0,.35);
  font-size: .78rem;
  line-height: 1.35;
}

.mw-editor-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  padding: .1rem .35rem;
  border-radius: .35rem;
  background: rgba(15,23,42,.92);
  border: 1px solid rgba(148,163,184,.28);
  color: #f8fafc;
  font-size: .72rem;
  font-weight: 700;
}

.mw-editor-toast-zone {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9998;
  display: grid;
  gap: .5rem;
  max-width: min(420px, calc(100vw - 2rem));
}

.mw-editor-toast {
  border-radius: 14px;
  padding: .75rem .9rem;
  color: #e2e8f0;
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(15,23,42,.96);
  box-shadow: 0 16px 30px rgba(0,0,0,.32);
}

.mw-editor-toast[data-type="error"] { background: rgba(127,29,29,.96); }
.mw-editor-toast[data-type="success"] { background: rgba(20,83,45,.96); }
.mw-editor-toast[data-type="warning"] { background: rgba(120,53,15,.96); }

[data-editor-action-disabled="true"],
.mw-ui-disabled-action {
  opacity: .52 !important;
  cursor: not-allowed !important;
  filter: saturate(.65);
}

[data-editor-action-disabled="true"] * {
  pointer-events: none;
}

@media (max-width: 1399px) {
  .mw-editor-layout,
  .editor-layout-grid,
  .editor-grid {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(240px, 320px);
  }
}

@media (max-width: 1199px) {
  .mw-editor-layout,
  .editor-layout-grid,
  .editor-grid {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }

  .editor-right-inspector,
  .mw-editor-inspector-panel {
    grid-column: 1 / -1;
    min-height: 260px;
    max-height: none;
  }
}

@media (max-width: 991px) {
  .mw-editor-layout,
  .editor-layout-grid,
  .editor-grid {
    display: flex;
    flex-direction: column;
  }

  .editor-left-library,
  .mw-editor-library-panel,
  .editor-right-inspector,
  .mw-editor-inspector-panel,
  .editor-main-timeline,
  .mw-editor-timeline-panel,
  .editor-bottom-mixer,
  .mw-editor-mixer-panel {
    min-height: auto;
    max-height: none;
  }

  .editor-main-timeline,
  .mw-editor-timeline-panel {
    min-height: 460px;
  }

  .editor-bottom-mixer,
  .mw-editor-mixer-panel {
    position: sticky;
    bottom: 0;
    z-index: 30;
  }
}

@media (max-width: 575px) {
  :root { --mw-editor-gap: .5rem; --mw-editor-radius: 12px; }

  .mw-editor-panel-header,
  .editor-panel-header {
    padding: .6rem .65rem;
  }

  .editor-main-timeline,
  .mw-editor-timeline-panel {
    min-height: 380px;
  }

  .mw-editor-toast-zone {
    left: .75rem;
    right: .75rem;
    bottom: .75rem;
  }
}
