:root {
  /* Haupt-Hintergrundfarben */
  --app-background-light: hsl(0, 0%, 100%); /* Weiß für den Hauptinhaltsbereich */
  --app-background-dark: #2c3e50; /* Dunkles Blau-Grau für Header/Footer */
  --item-background-light: hsl(0, 0%, 95%); /* Leicht abgetöntes Weiß für Listenelemente/Textarea */

  /* Akzent- und Warnfarben */
  --accent: #1abc9c; /* Helles Grün für interaktive Elemente */
  --danger: #e74c3c; /* Rot für Warnungen/Gefahren */

  /* Textfarben */
  --text-on-light: hsl(210, 20%, 25%); /* Dunkles Grau für Text auf hellen Hintergründen */
  --text-on-dark: #ecf0f1; /* Helles Grau für Text auf dunklen Hintergründen */

  /* Farben für inaktive Elemente/Hilfstexte */
  --inactive-light-bg: hsl(210, 10%, 45%); /* Mittelgrau für inaktive Elemente auf hellem Hintergrund */
  --inactive-dark-bg: #7f8c8d; /* Gedämpftes Grau für inaktive Elemente auf dunklem Hintergrund */

  /* Rahmenfarben */
  --border-light: hsl(210, 10%, 80%); /* Heller Rahmen für helle Elemente */
  --border-dark: #233140; /* Dunkler Rahmen für dunkle Elemente */

  /* Schattenfarbe */
  --shadow: rgba(0, 0, 0, 0.1);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-on-light); /* Standard-Textfarbe jetzt dunkel */
  background-color: var(--item-background-light); /* Allgemeiner Body-Hintergrund */
  box-sizing: border-box;
}

/* Mobile-First: Standardeinstellungen für kleinere Bildschirme */
body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#widget {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100%;
  margin: 0 auto;
  background-color: var(--app-background-light); /* Hauptinhaltsbereich ist hell */
  box-shadow: 0 0 15px var(--shadow);
  overflow: hidden;
}

header {
  background-color: var(--app-background-dark); /* Header ist dunkel */
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--border-dark);
  flex-shrink: 0;
}

.nu-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.5em;
  color: var(--accent);
}

.header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nu-header-name {
  white-space: nowrap;
}

.nu-note { color: var(--text-on-dark); } /* Text im dunklen Header */
.nu-utility { color: var(--accent); }
.nu-com { color: var(--text-on-dark); font-size: 0.8em; }

.header-info {
  font-size: 0.9em;
  color: var(--item-background-light); /* Text im dunklen Header */
}

.header-timer {
  font-size: 0.9em;
  color: var(--text-on-dark); /* Text im dunklen Header */
  width: 100%;
  text-align: center;
}

#timer-controls {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.timer-label {
  font-size: 1em;
  line-height: 1;
  display: inline-block;
  vertical-align: baseline;
}

#timer-display {
  font-family: 'Fira Code', 'Roboto Mono', monospace;
  font-size: 1.1em;
  min-width: 80px;
  text-align: center;
}

#timer-controls button {
  background-color: var(--accent);
  color: var(--text-on-dark); /* Textfarbe auf Akzent-Buttons - HELL */
  font-weight: bold; /* Fett */
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 0.85em;
  white-space: nowrap;
}

#timer-controls button:hover:not(:disabled) {
  background-color: #17a689;
}

#timer-controls button:disabled {
  background-color: var(--inactive-dark-bg);
  cursor: not-allowed;
  opacity: 0.7;
}

#main {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Common styling for web components */
note-list, note-editor, note-quicklinks {
  background-color: var(--app-background-light); /* Diese Komponenten sind hell */
  border: 1px solid var(--border-light); /* Heller Rahmen */
  border-radius: 6px;
  margin: 10px;
  padding: 10px;
  box-shadow: 0 2px 5px var(--shadow);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* Note List specific styles */
note-list {
  min-height: 200px;
  max-height: 40vh;
  overflow-y: auto;
}

#note-count {
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 10px;
  text-align: center;
}

.reorder-instruction {
  font-size: 0.85em;
  color: var(--inactive-light-bg); /* Text auf hellem Hintergrund */
  text-align: center;
  margin-top: 0;
  margin-bottom: 10px;
}

note-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
  overflow-y: auto;
}

note-list li {
  background-color: var(--item-background-light); /* Einzelne Notizen sind leicht abgetönt */
  padding: 10px 15px;
  margin-bottom: 8px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s, transform 0.1s;
  position: relative;
  border: 1px solid var(--border-light); /* Heller Rahmen */
}

note-list li:hover {
  background-color: hsl(0, 0%, 90%); /* Leicht dunklerer Hover-Effekt */
}

note-list li.active {
  background-color: var(--accent);
  color: var(--text-on-dark); /* Textfarbe auf Akzent-Hintergrund - HELL */
  font-weight: bold; /* Fett */
  border-color: var(--accent);
}

note-list li.active .note-title-text {
  color: var(--text-on-dark); /* Textfarbe auf Akzent-Hintergrund - HELL */
}

note-list li.active .note-delete-btn svg {
  stroke: var(--text-on-dark); /* Icon-Farbe auf Akzent-Hintergrund - HELL */
}

.note-title-text {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}

.note-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: transform 0.1s ease-out;
}

.note-delete-btn svg {
  stroke: hsl(0, 0%, 0%); /* Schwarz für das Icon */
  width: 18px;
  height: 18px;
}

.note-delete-btn:hover svg {
  stroke: var(--danger); /* Rot beim Hovern */
}

#new-note {
  background-color: var(--accent);
  color: var(--text-on-dark); /* Textfarbe auf Akzent-Buttons - HELL */
  font-weight: bold; /* Fett */
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  font-size: 1em;
  margin-top: 10px;
  transition: background-color 0.2s;
}

#new-note:hover {
  background-color: #17a689;
}

note-list li.dragging {
  opacity: 0.5;
  transform: scale(0.98);
  border: 2px dashed var(--accent);
}

note-list li.drag-over {
  border-top: 2px solid var(--accent);
  margin-top: 0;
  padding-top: 8px;
}

/* Note Editor specific styles */
note-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 250px;
}

#note-content {
  width: 100%;
  flex: 1;
  padding: 15px;
  border: 1px solid var(--border-light);
  border-radius: 5px;
  background-color: var(--item-background-light); /* Textarea Hintergrund */
  color: var(--text-on-light); /* Textfarbe im Textarea */
  font-size: 1em;
  resize: vertical;
  box-sizing: border-box;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
}

#note-content:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26, 188, 156, 0.3);
}

/* Quick Links specific styles */
note-quicklinks {
  min-height: 150px;
  max-height: 30vh;
  overflow-y: auto;
}

.note-quicklinks-outer {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.note-list-header {
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 10px;
  text-align: center;
}

#quick-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

.ql-link-card {
  background-color: var(--item-background-light); /* Linkkarten Hintergrund */
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-light);
}

.ql-link-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
  min-width: 0;
  cursor: pointer;
}

.ql-link-favicon {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
  object-fit: contain;
}

.ql-link-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ql-link-name {
  font-weight: bold;
  color: var(--text-on-light); /* Link Name Farbe */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95em;
}

.ql-link-url {
  font-size: 0.8em;
  color: var(--inactive-light-bg); /* Link URL Farbe */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ql-new-btn {
  background-color: var(--accent);
  color: var(--text-on-dark); /* Textfarbe auf Akzent-Buttons - HELL */
  font-weight: bold; /* Fett */
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  font-size: 0.9em;
  margin-top: 10px;
  transition: background-color 0.2s;
}

.ql-new-btn:hover {
  background-color: #17a689;
}

/* Footer styles */
footer {
  background-color: var(--app-background-dark); /* Footer ist dunkel */
  color: var(--inactive-dark-bg); /* Textfarbe im dunklen Footer */
  text-align: center;
  padding: 2px 10px;
  font-size: 0.85em;
  border-top: 2px solid var(--border-dark);
  flex-shrink: 0;
}

footer a {
  color: var(--accent); /* Akzentfarbe für Links im Footer */
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: #5ac4b0;
}

/* Dialogs */
.dialog {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
  backdrop-filter: blur(5px);
}

.dialog.visible {
  display: flex;
}

.dialog-content {
  background-color: var(--app-background-light); /* Dialog-Inhalt ist hell */
  padding: 25px;
  border-radius: 8px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  text-align: left;
  color: var(--text-on-light); /* Text im Dialog */
}

.dialog-content h3 {
  color: var(--accent); /* Akzentfarbe im Dialog-Header */
  text-align: center;
}

.dialog-content div {
  line-height: 1.6;
  font-size: 0.95em;
  text-align: justify;
}

.dialog-content a {
  color: var(--accent);
  text-decoration: underline;
}

.dialog-content button {
  background-color: var(--accent);
  color: var(--text-on-dark); /* Textfarbe auf Akzent-Buttons - HELL */
  font-weight: bold; /* Fett */
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 20px;
  width: 100%;
  font-size: 1em;
  transition: background-color 0.2s;
}

.dialog-content button:hover {
  background-color: #17a689;
}

/* Quick Link Modal (Editor/Delete Confirmation) */
.ql-modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
  backdrop-filter: blur(5px);
}

.ql-modal {
  background-color: var(--app-background-light); /* Quick-Link-Modal ist hell */
  padding: 25px;
  border-radius: 8px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
  color: var(--text-on-light); /* Text im Modal */
  text-align: center;
}

.ql-modal .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--inactive-light-bg); /* Schließen-Button auf hellem Hintergrund */
  font-size: 1.5em;
  cursor: pointer;
  padding: 5px;
}

.ql-modal h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--accent);
  font-size: 1.2em;
}

.ql-modal .add-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.ql-modal input[type="text"],
.ql-modal input[type="url"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-light); /* Heller Rahmen */
  border-radius: 5px;
  background-color: var(--item-background-light); /* Eingabefelder Hintergrund */
  color: var(--text-on-light); /* Textfarbe in Eingabefeldern */
  font-size: 1em;
  box-sizing: border-box;
}

.ql-modal input[type="text"]:focus,
.ql-modal input[type="url"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26, 188, 156, 0.3);
}

.ql-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ql-add-btn, .ql-cancel-btn {
  background-color: var(--accent);
  color: var(--text-on-dark); /* Textfarbe auf Akzent-Buttons - HELL */
  font-weight: bold; /* Fett */
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.ql-add-btn:hover {
  background-color: #17a689;
}

.ql-cancel-btn {
  background-color: var(--inactive-light-bg); /* Abbrechen-Button auf hellem Hintergrund */
  color: var(--text-on-dark); /* Textfarbe auf inaktivem Button - HELL */
}

.ql-cancel-btn:hover {
  background-color: hsl(210, 15%, 55%); /* Dunklerer Hover für inaktiven Button */
}

/* Desktop-specific adjustments */
@media (min-width: 701px) {
  body {
    overflow: hidden;
  }

  #widget {
    height: 100vh;
    margin: 0 auto;
    width: 100%;
  }

  header {
    flex-direction: row;
    justify-content: space-between;
  }

  .nu-header-title {
    flex-grow: 1;
    justify-content: flex-start;
  }

  .header-info, .header-timer {
    flex-shrink: 0;
  }

  
  /* Removed .header-info and .header-timer styles */
  

  header {
    position: relative;
  }

  #main {
    flex-direction: row;
    overflow-y: hidden;
  }

  #sidebar {
    display: flex;
    flex-direction: column;
    width: 450px;
    flex-shrink: 0;
    background-color: var(--app-background-light); /* Sidebar ist hell */
    border-right: 1px solid var(--border-light); /* Heller Rahmen */
    overflow-y: hidden;
  }

  .sidebar-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
  }

  .sidebar-half:first-child {
    border-bottom: 1px solid var(--border-light); /* Heller Rahmen */
  }

  note-list, note-quicklinks {
    margin: 0;
    border-radius: 0;
    border: none;
    padding: 10px;
    flex: 1;
    max-height: none;
    overflow-y: auto;
  }

  note-editor {
    flex: 1;
    margin: 0;
    border-radius: 0;
    border: none;
    padding: 10px;
    overflow-y: auto;
  }

  #note-content {
    resize: none;
  }

  .ql-modal .add-row {
    flex-direction: row;
  }

  .ql-modal-actions {
    flex-direction: row;
    justify-content: center;
  }

  .ql-add-btn, .ql-cancel-btn {
    width: auto;
    padding: 10px 20px;
  }
}