/* style-editor.css */

/* Reset & Basis */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020617;
  color: #e5e7eb;
}

code {
  font-family: ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
}

/* Header */

.app-header {
  background: linear-gradient(90deg, #0f172a, #1e3a8a);
  border-bottom: 1px solid #1f2937;
}

.app-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: #9ca3af;
}

.header-actions {
  font-size: 0.75rem;
  color: #9ca3af;
}

.hint code {
  color: #e5e7eb;
}

/* Layout */

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  gap: 1rem;
}

.panel {
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #0b1120;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-left {
  flex: 0 0 360px;
  max-width: 360px;
}

.panel-right {
  flex: 1 1 auto;
}

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

/* Datei-/Button-Controls */

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

.file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.file-row label {
  font-size: 0.8rem;
}

.file-row input[type="file"] {
  font-size: 0.8rem;
}

button {
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid #334155;
  background: #111827;
  color: #e5e7eb;
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
}

button:hover {
  border-color: #38bdf8;
}

/* Kartenliste */

.card-list-wrapper {
  border-radius: 6px;
  border: 1px solid #1f2937;
  overflow: auto;
  max-height: 60vh;
}

.card-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.card-list th,
.card-list td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid #1f2937;
}

.card-list th {
  background: #111827;
  color: #9ca3af;
  font-weight: 600;
}

.card-list tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.85);
}

.card-list tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.7);
}

.card-list tbody tr:hover {
  background: rgba(31, 41, 55, 0.95);
  cursor: pointer;
}

/* ausgewählte Karte in der Editor-Liste hervorheben */
.card-list tbody tr.selected {
  background: rgba(56, 189, 248, 0.25);
}

/* Rechtes Panel: Details */

.card-detail-empty {
  font-size: 0.85rem;
  color: #9ca3af;
}

.card-detail-form {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* Stammdaten */

.card-meta h3 {
  margin: 0 0 0.3rem;
}

.card-meta-grid {
  display: flex;
  gap: 0.5rem;
}

.card-meta-grid label {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card-meta-grid input {
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
}

/* Rotationen */

.rotations-section h3 {
  margin: 0 0 0.3rem;
}

.rotations-hint {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: #9ca3af;
}

.rotations-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.rotation-block {
  border-radius: 6px;
  border: 1px solid #1f2937;
  background: #020617;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* farbige Header je Rotation */

.rotation-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}

.rotation-header h4 {
  margin: 0;
  font-size: 0.9rem;
}

/* Farben für Rotation 1–4 */
.rotation-block[data-rotation-index="0"] .rotation-header {
  background: #2563eb; /* Blau */
}

.rotation-block[data-rotation-index="1"] .rotation-header {
  background: #16a34a; /* Grün */
}

.rotation-block[data-rotation-index="2"] .rotation-header {
  background: #f97316; /* Orange */
}

.rotation-block[data-rotation-index="3"] .rotation-header {
  background: #7c3aed; /* Violett */
}

.rotation-header h4 {
  color: #f9fafb;
}

.rotation-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rotation-section h5 {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
}

.rotation-section label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.25rem;
  position: relative; /* wichtig für Tag-Suggestions */
}

.rotation-section input[type="text"],
.rotation-section input[type="number"],
.rotation-section select {
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
}

/* Spezielles Styling für Tags-Input */

.rot-tags {
  width: 100%;
}

/* Ressourcen */

.rot-resources {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.resources-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.resource-row {
  display: grid;
  grid-template-columns: 2.5fr 2fr auto;
  gap: 0.2rem;
  align-items: center;
}

.resource-row select,
.resource-row input {
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.8rem;
}

.resource-remove {
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
}

/* Tag-Autocomplete */

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.2rem;
}

.tag-chip {
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
}

.tag-chip:hover {
  border-color: #38bdf8;
}

/* Punkte-Regel */

.rot-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
}

/* Eingabefelder */

.rot-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.inputs-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.input-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1.5fr auto;
  gap: 0.2rem;
  align-items: center;
}

.input-row input {
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
}

/* Tag-Autocomplete */

.tag-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 0.15rem;
  list-style: none;
  padding: 0.2rem 0;
  border-radius: 4px;
  background: #020617;
  border: 1px solid #1f2937;
  box-shadow: 0 4px 6px rgba(15, 23, 42, 0.4);
  font-size: 0.8rem;
  max-height: 160px;
  overflow-y: auto;
  display: none;
  z-index: 20;
}

.tag-suggestions.visible {
  display: block;
}

.tag-suggestion-item {
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
}

.tag-suggestion-item:hover {
  background: #111827;
}

.tag-suggestion-item.highlighted {
  background: #1d4ed8;
}

.tag-suggestion-label {
  color: #e5e7eb;
  font-size: 0.75rem;
}

/* Karten-Aktion */

.card-actions {
  margin-top: 0.5rem;
}

/* Forward-Check-Modal */

.forward-check-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.forward-check-backdrop.visible {
  display: flex;
}

.forward-check-dialog {
  background: #0b1120;
  border-radius: 8px;
  border: 1px solid #1f2937;
  padding: 1rem;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  font-size: 0.85rem;
}

.forward-check-message {
  margin: 0 0 0.5rem;
  color: #e5e7eb;
}

.forward-check-list {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.forward-check-list ul {
  margin: 0;
  padding-left: 1rem;
}

.forward-check-list li {
  margin-bottom: 0.25rem;
  color: #e5e7eb;
}

.forward-check-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Mobile */

@media (max-width: 900px) {
  .app-main {
    flex-direction: column;
  }

  .panel-left {
    max-width: 100%;
    flex: 1 1 auto;
  }

  .rotations-grid {
    grid-template-columns: 1fr;
  }
}

/* Modal-Backdrop (Überlagerung) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop[hidden] {
  display: none;
}

/* Modal-Box */
.modal {
  background: #020617;
  border-radius: 8px;
  border: 1px solid #1f2937;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
  padding: 0.75rem 0.9rem;
  min-width: 260px;
  max-width: 320px;
}

/* Titel */
.modal-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

/* Formularfelder im Modal */
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
}

.modal-field span {
  color: #9ca3af;
}

.modal-field input,
.modal-field select {
  font-size: 0.85rem;
  padding: 0.15rem 0.3rem;
  border-radius: 0.2rem;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
}

/* Fehlermeldung */
.modal-error {
  min-height: 1rem;
  font-size: 0.75rem;
  color: #f97373;
  margin-bottom: 0.25rem;
}

/* Buttons im Modal */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.modal-actions button {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #334155;
  background: #020617;
  color: #9ca3af;
  cursor: pointer;
}

.modal-actions button[type="submit"] {
  border-color: #38bdf8;
  color: #38bdf8;
}

.modal-actions button:hover {
  filter: brightness(1.1);
}

/* Shortcut-Hinweis */
.modal-hint {
  margin-top: 0.3rem;
  font-size: 0.7rem;
  color: #9ca3af;
  text-align: right;
}

/* Rotationsspalte: breit genug für "aus" und den Dropdown-Pfeil */
#cards-table th:nth-child(2),
#cards-table td:nth-child(2) {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  white-space: nowrap;
  text-align: center;
}

#cards-table .rotation-select {
  width: 4.25rem;
  min-width: 4.25rem;
  max-width: 4.25rem;
  box-sizing: border-box;
  padding-left: 0.25rem;
  padding-right: 1.25rem;
  white-space: nowrap;
}