/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Dark Theme Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #13131a;
  --bg-tertiary: #1a1a24;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-tertiary: #6b6b7b;
  --accent-primary: #ffffff;
  --accent-secondary: #2a2a3a;
  --border-color: #2a2a3a;
  --hover-bg: #1f1f2a;
  --selected-bg: #252530;
  --button-bg: #1a1a24;
  --button-hover: #252530;
}

/* Light theme palette */
body.light-theme {
  --bg-primary: #f8f9fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f3f4f6;

  --text-primary: #111827;     /* near-black */
  --text-secondary: #4b5563;   /* gray-600 */
  --text-tertiary: #6b7280;    /* gray-500 */

  --accent-primary: #4B5563;        /* gray-600 */
  --accent-secondary: rgba(75,85,99,0.25);

  --border-color: #e5e7eb;
  --hover-bg: #eef2f7;
  --selected-bg: #dbdcdeca;

  --button-bg: #ffffff;
  --button-hover: #eef2f7;
}

/* Light-mode ONLY: "Hinzufügen" button colors */
body.light-theme .add-button {
  background-color: var(--bg-tertiary);       /* match Bezeichnung field */
}

body.light-theme .add-button:hover {
  background-color: var(--selected-bg);     /* your hover color */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
}

/* App Container */
.app-container {
  display: flex;
  height: 100vh;
  height: 100dvh; /* iOS Safari: accounts for dynamic browser chrome */
  overflow: hidden;
}

/* Sidebar Styles */
/*collapse sidebar */
.sidebar-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Collapsed sidebar: keep header, hide the rest */
/* Collapse: hide tabs + report list, keep the very top header intact */
body.sidebar-collapsed .sidebar-nav,
body.sidebar-collapsed .report-list {
  display: none !important;
}

/* So absolute children are positioned relative to the app */
.app-container {
  position: relative;
}

/* Collapsed: sidebar no longer takes column space */
body.sidebar-collapsed .sidebar {
  position: absolute;
  left: 0;
  top: 0;
  width: 270px; /* same visual width as expanded header */
  height: 3.5rem; /* header height only */
  background: transparent;
  border-right: none; /* the column divider moves to the header row */
  overflow: visible;
  pointer-events: none; /* prevent the transparent area from blocking clicks */
  z-index: 5; /* above main content header */
  box-shadow: none !important; /* avoid lingering light-mode shadow */
}

/* Keep the header fully functional & looking the same */
body.sidebar-collapsed .sidebar-header {
  pointer-events: auto; /* re-enable clicks for the two buttons */
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color); /* keep vertical divider */
  border-bottom: 1px solid var(--border-color); /* keep top-row bottom line */
}

/* Light-mode collapsed: remove the "box" effect by making header transparent */
body.light-theme.sidebar-collapsed .sidebar-header {
  background: transparent;
  border-right-color: transparent;
  border-bottom-color: transparent;
}

/* Hide the settings items only when you're on Settings AND the sidebar is collapsed */
body.settings-active.sidebar-collapsed .settings-menu {
  display: none !important;
}

/* Collapsed: hide mic status box that lives in the sidebar footer */
body.sidebar-collapsed .sidebar-mic-status {
  display: none !important;
}

/* Collapsed + narrow viewport: progressively hide right-side header buttons
   to prevent overlap with the sidebar-header tools (pin & sidebar-toggle).
   Stage 1 (≤768px): hide everything except the export button.
   Stage 2 (≤480px): hide the export button too.                             */
@media (max-width: 700px) {
  body.sidebar-collapsed .header-actions > *:not(.export-btn) {
    display: none !important;
  }
}
@media (max-width: 390px) {
  body.sidebar-collapsed .header-actions {
    display: none !important;
  }
}

.sidebar {
  width: 270px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  font-style: normal;
  /* Acts as a "home" button: back to the report list with a new report selected. */
  cursor: pointer;
  user-select: none;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.pin-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.pin-toggle svg {
  transform: translateY(1px);
}

.pin-toggle:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.pin-toggle.active {
  color: var(--accent-primary);
}

.pin-toggle.active svg {
  fill: currentColor;
}

/* Sidebar Navigation */
.sidebar-nav {
  display: flex;
  padding: 0.5rem;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.nav-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-button:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.nav-button.active {
  background-color: var(--selected-bg);
  color: var(--text-primary);
  font-weight: 600;
}

/* Report List */
.report-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Pull-to-refresh (PullToRefresh.js): grows at the top of the list while pulling */
.ptr-indicator {
  --ptr-progress: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  color: var(--text-tertiary);
  transition: color 0.15s;
}

.ptr-indicator svg {
  opacity: var(--ptr-progress);
  transform: rotate(calc(var(--ptr-progress) * 270deg));
}

.ptr-indicator.ready,
.ptr-indicator.refreshing {
  color: var(--text-primary);
}

.ptr-indicator.settling {
  transition: height 0.2s ease, color 0.15s;
}

.ptr-indicator.refreshing svg {
  opacity: 1;
  animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
  from { transform: rotate(270deg); }
  to { transform: rotate(630deg); }
}

.report-list.ptr-pulling {
  user-select: none;
  cursor: grabbing;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-item {
  padding: 1rem;
  margin-bottom: 0.5rem;
  background-color: var(--bg-tertiary);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.report-item:hover {
  background-color: var(--hover-bg);
  border-color: var(--border-color);
}

.report-item.selected {
  background-color: var(--selected-bg);
  border-color: var(--accent-primary);
}

.report-item h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.report-item h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.report-item time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
}

.report-item p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin: 0;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  overflow: hidden;
}

/* Main Header */
.main-header {
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 1rem;
}

.impressoft-btn,
.export-btn {
  padding: 0.5rem 1.5rem;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.impressoft-btn:hover,
.export-btn:hover {
  background-color: var(--button-hover);
  border-color: var(--text-secondary);
}

/* Light theme: make import/export hover look like other light buttons (blue outline) */
body.light-theme .impressoft-btn:hover,
body.light-theme .export-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Export menu → "Senden": username prompt shown in place of the menu */
.export-send {
  animation: export-send-in 0.16s ease-out;
}

@keyframes export-send-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

.export-send-input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.25rem;
  outline: none;
  transition: border-color 0.15s;
}

.export-send-input::placeholder {
  color: var(--text-tertiary);
}

.export-send-input:focus {
  border-color: var(--text-secondary);
}

.export-send-input.has-error {
  border-color: #e5484d;
}

.export-send-error {
  font-size: 0.8rem;
  line-height: 1.3;
  color: #e5484d;
  margin: -0.15rem 0 0.1rem;
}

.export-send-error:empty {
  display: none;
}

.export-send-submit,
.export-send-back {
  padding: 0.75rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.export-send-submit {
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-weight: 500;
  transition: opacity 0.15s;
}

.export-send-submit:hover {
  opacity: 0.9;
}

.export-send-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.export-send-back {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Report Content */
.report-content {
  flex: 1;
  padding: 0.75rem;
  overflow-y: scroll;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.report-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}

.report-section {
  margin-bottom: 1.5rem;
}

.report-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 0.5rem;
}

/* Center only the voice instruction and push it down a few lines */
.voice-instruction {
  margin-top: 2.5rem; /* pushes the text down a few lines */
  font-size: 1rem;
  text-align: center; /* center text inside the paragraph */
}

.report-section strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Voice Input Container */
.voice-input-container {
  /* Responsive height based on viewport with sane bounds */
  height: clamp(56px, 6vh, 110px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.5vw, 2rem);
  padding: clamp(0.75rem, 1.8vw, 1.25rem);
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  position: relative;
}

/* This is the container for the central recording button and the audio ring */
.voice-control-center {
  /* Anchor mic button dead-center regardless of siblings */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* Logo Animation Wrapper */
/* OLD LOGO WRAPPER 
#logo-wrapper {
  position: absolute;
  width: clamp(160px, 24vmin, 300px);
  height: clamp(160px, 24vmin, 300px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
*/
#logo-wrapper {
  position: absolute;
  width: clamp(200px, 50vmin, 600px);
  height: clamp(56px, 6vmin, 110px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

#logo-wrapper canvas {
  display: block;
}

/*footer display control*/
.hidden {
  display: none !important;
}

/* Bottom footer slot: shared frame for audio or add-section */
#bottom-slot {
  border-top: 1px solid var(--border-color); /* the thin line */
  background-color: var(--bg-secondary); /* same as audio background */
  padding: 0.75rem; /* <-- creates margin on all sides inside the slot */
}

/* Avoid a double border when audio is inside the slot */
#bottom-slot .voice-input-container {
  border-top: none;
}

/* Make the add-section look tidy inside the slot */
#bottom-slot .settings-add-section {
  margin: 0 auto; /* center horizontally */
  max-width: 800px; /* optional: align with your .report-content max-width */
  /* width will auto-fit; remove if you want full width inside the padded slot */
}

/* Voice Control Group */
.voice-control-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 2;
}

.voice-button {
  /* Responsive mic size */
  width: clamp(58px, 7.5vmin, 96px);
  height: clamp(58px, 7.5vmin, 96px);
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.voice-button:hover {
  background-color: var(--button-hover);
  border-color: var(--text-secondary);
  transform: scale(1.05);
}

/* Light theme: avoid dark blackout hover on the record button; use blue outline */
body.light-theme .voice-button:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}
body.light-theme .voice-button:hover .voice-icon {
  color: var(--accent-primary);
}

.voice-button.recording {
  background-color: #ff3333;
  border-color: #ff3333;
  color: #ffffff;
  animation: pulse 1.5s infinite;
}

.voice-button.recording .voice-icon {
  color: #ffffff;
}

.voice-button.paused {
  background-color: #22c55e;
  border-color: #22c55e;
  color: #ffffff;
}

.voice-button.paused .voice-icon {
  color: #ffffff;
}

.voice-button.selected {
  border-color: inherit;
}

.stop-recording-button {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background-color: #1a1a24;
  border-color: #1a1a24;
  color: #ffffff;
}

.stop-recording-button .voice-icon {
  color: #ffffff;
}

/* Privacy disclaimer - bottom right corner */
.privacy-disclaimer {
  position: absolute;
  bottom: 1rem;
  right: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  opacity: 0.7;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

.stop-recording-button:hover {
  background-color: #1a1a24;
  border-color: #1a1a24;
  transform: translateY(-50%) scale(1.05);
}

body.light-theme .stop-recording-button {
  background-color: #1a1a24;
  border-color: #1a1a24;
  color: #ffffff;
}

body.light-theme .stop-recording-button:hover {
  background-color: #1a1a24;
  border-color: #1a1a24;
  transform: translateY(-50%) scale(1.05);
}

.voice-icon {
  color: var(--text-primary);
  /* Make the icon scale with the button */
  width: 60%;
  height: 60%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-icon svg {
  width: 100%;
  height: 100%;
}

/* .clear-btn styles removed (button no longer used) */

/* Settings Menu in Sidebar */
.settings-menu {
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
}

.settings-menu-item {
  padding: 1rem;
  margin-bottom: 0.5rem;
  background-color: var(--bg-tertiary);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;  /* ← ADD THIS LINE */
  color: var(--text-primary);  /* ← ADD THIS LINE */
}
/*
.report-item.selected {
  background-color: var(--selected-bg);
  border-color: var(--accent-primary);
}

.report-item {
  padding: 1rem;
  margin-bottom: 0.5rem;
  background-color: var(--bg-tertiary);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}*/

.settings-menu-item.active,
.settings-menu-item.selected {
  background-color: var(--selected-bg);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.settings-menu-item:not(.active):not(.selected):hover {
  background-color: var(--hover-bg);
  border-color: var(--border-color);
}

/* Settings Content */
.settings-list {
  margin-bottom: 1.5;
}

/* TEMP: Hide unimplemented 'Others' settings entry (both top tabs and sidebar card) */
/* .settings-tab-btn[data-tab="others"],
.settings-menu-item[data-tab="others"] {
  display: none !important;
} */

/* Others Tab Styles */
.others-item h3 {
  margin-bottom: 0.5rem;
}

.setting-control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.settings-select {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 0.25rem;
  width: 100%;
  max-width: 300px;
  font-size: 0.875rem;
  outline: none;
}

.settings-select:focus {
  border-color: var(--accent-primary);
}

/* Switch styles */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ff4444;
  transition: .4s;
  border: 1px solid var(--border-color);
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #22c55e;
  border-color: #22c55e;
}

input:checked + .slider:before {
  transform: translateX(16px);
  background-color: #ffffff;
}

.file-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.file-path {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-item {
  padding: 1rem;
  margin-bottom: 0.75rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5;
}

.settings-item h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.settings-item p {
  color: var(--text-secondary);
  line-height: 1.5;
}

.settings-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 2.5rem;
  font-style: italic;
}

.settings-add-section {
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-input,
.settings-textarea {
  padding: 0.75rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.375rem;
  font-family: inherit;
  font-size: 0.875rem;
}

.settings-input:focus,
.settings-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.settings-textarea {
  min-height: 100px;
  resize: vertical;
}

.templates-add-section {
  padding: 0.4rem; 
  gap: 0.3rem; 
}

.templates-add-section .settings-textarea{
  min-height: 60px;
}

.add-button {
  align-self: flex-end;
  padding: 0.625rem;
  background-color: var(--accent-primary);
  /* color: var(--text-primary); */
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.add-button:hover {
  background-color: var(--accent-secondary);
}

/* Hide report list when settings active */
body.settings-active .report-list {
  display: none !important;
}

/* Animations */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 51, 51, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 51, 51, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 51, 51, 0);
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Responsive Design */
@media (max-width: 768px) {
  /*
  .sidebar {
    width: 250px;
  }
  */
  .report-content {
    padding: 1rem;
  }

  /* Keep responsive sizing; slightly larger but bounded for small screens */
  .voice-button { width: clamp(52px, 14vmin, 72px); height: clamp(52px, 14vmin, 72px); }
  
  .stop-recording-button {
    right: 0.75rem;
  }

  .stop-recording-button:hover {
    transform: translateY(-50%) scale(1.05);
  }
}

.feedback-btn,
.logout-btn,
.textinput-btn,
.info-btn,
.meditation-btn,
.hid-pair-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-right: 0.5rem;
}

.feedback-btn:hover,
.logout-btn:hover,
.textinput-btn:hover,
.info-btn:hover,
.meditation-btn:hover,
.hid-pair-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.feedback-btn:hover svg,
.textinput-btn:hover svg,
.info-btn:hover svg,
.hid-pair-btn:hover svg {
  fill: var(--accent-primary);
}

.feedback-btn svg,
.textinput-btn svg,
.info-btn:hover svg,
.meditation-btn svg {
  width: 20px;
  height: 20px;
  transition: fill 0.2s, stroke 0.2s;
}

.meditation-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
}

.feedback-btn.selected,
.feedback-btn.recording {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.feedback-btn.selected svg,
.feedback-btn.recording svg {
  fill: currentColor;
}

/* Light theme feedback button */
body.light-theme .feedback-btn {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: none;
}

body.light-theme .feedback-btn svg {
  fill: currentColor;
}

body.light-theme .feedback-btn.selected,
body.light-theme .feedback-btn.recording {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

body.light-theme .feedback-btn:hover,
body.light-theme .textinput-btn:hover,
body.light-theme .info-btn:hover,
body.light-theme .meditation-btn:hover,
body.light-theme .hid-pair-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

body.light-theme .feedback-btn:hover svg,
body.light-theme .textinput-btn:hover svg,
body.light-theme .info-btn:hover svg,
body.light-theme .hid-pair-btn:hover svg {
  fill: var(--accent-primary);
}

/* Adjust header actions spacing */
.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Microphone Status Display */
#mic-status-container {
  animation: fadeIn 0.3s ease;
  transition: all 0.2s ease;
}

#mic-status-container:hover {
  background-color: var(--hover-bg) !important;
}

@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(-5px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* Light theme adjustments */
body.light-theme #mic-status-container {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

body.light-theme #mic-status-container:hover {
  background-color: var(--bg-tertiary) !important;
}

/* Ensure mic status stays inside container on small screens */
@media (max-width: 768px) {
  #mic-status-container {
    font-size: 0.8rem;
  }
  
  #mic-status-container svg {
    width: 16px;
    height: 16px;
  }
}

.sidebar-mic-status {
  padding: 1rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  border-radius: 0;
}

.sidebar-mic-status.open-recordings-trigger {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sidebar-mic-status.open-recordings-trigger:hover {
  background: var(--bg-secondary);
}

.sidebar-mic-status.open-recordings-trigger:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: -2px;
}

/* HID Pairing Button - Connected State */
.hid-pair-btn.connected {
  border-color: #22c55e;
  color: #22c55e;
}

.hid-pair-btn.connected:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: #22c55e;
  color: #22c55e;
}

body.light-theme .hid-pair-btn.connected {
  border-color: #22c55e;
  color: #22c55e;
}

body.light-theme .hid-pair-btn.connected:hover {
  background: rgba(34, 197, 94, 0.1);
}

/* Loading Screen */
.loading-screen {
  padding: 1rem;
  text-align: center;
  transition: opacity 0.3s ease-out;
}

.loading-screen p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.loading-bar-container {
  width: 100%;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.loading-bar {
  width: 0;
  height: 100%;
  background-color: var(--accent-primary);
  border-radius: 2px;
}

/* ============================================================ */
/* Meditation Overlay                                            */
/* ============================================================ */
.meditation-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;             /* above sidebar, header, dialogs */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;          /* plain white background */
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: all;
  --med-fg: #111827;            /* circle / ring color in light mode */
  --med-fg-soft: rgba(17, 24, 39, 0.10);
  --med-label: rgba(17, 24, 39, 0.55);
}

.meditation-overlay.visible {
  opacity: 1;
}

/* Dark mode: dark background with light circle/ring */
body:not(.light-theme) .meditation-overlay {
  background: #0a0a0f;
  --med-fg: #f3f4f6;
  --med-fg-soft: rgba(243, 244, 246, 0.10);
  --med-label: rgba(243, 244, 246, 0.55);
}

.meditation-stage {
  position: relative;
  width: 400px;
  height: 400px;
  max-width: min(80vw, 80vh);
  max-height: min(80vw, 80vh);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Progress ring */
.meditation-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.meditation-ring-track {
  fill: none;
  stroke: var(--med-fg-soft);
  stroke-width: 6;
}

.meditation-ring-progress {
  fill: none;
  stroke: var(--med-fg);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
}

/* Breathing circle */
.meditation-breath-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220px;
  height: 220px;
  max-width: 55%;
  max-height: 55%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--med-fg) 0%, var(--med-fg) 55%, color-mix(in srgb, var(--med-fg) 70%, transparent) 100%);
  opacity: 0.92;
  transform: translate(-50%, -50%) scale(0.55);
  transition: transform 4s cubic-bezier(0.45, 0, 0.55, 1);
  box-shadow:
    0 0 60px color-mix(in srgb, var(--med-fg) 20%, transparent),
    0 0 120px color-mix(in srgb, var(--med-fg) 12%, transparent);
}

/* Fallback if color-mix() not supported */
@supports not (color: color-mix(in srgb, white, black)) {
  .meditation-breath-circle {
    background: var(--med-fg);
  }
}

.meditation-phase-label {
  position: absolute;
  top: calc(100% + 28px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--med-label);
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 300;
  user-select: none;
  white-space: nowrap;
}

/* Way-out hint on the meditation overlay. Deliberately quiet, but always
   present: the session can start on its own at a configured meditation time
   (meditationSchedule.js), and a doctor who did not press anything must be
   able to see how to get back to work. */
.meditation-note {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--med-label);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 300;
  user-select: none;
  white-space: nowrap;
  opacity: 0.7;
}

/* Verpflichtende Meditationszeiten (Einstellungen → Sonstiges) */
.meditation-schedule-editor {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.meditation-time-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  min-height: 1.75rem;
}

.meditation-time-empty {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.meditation-time-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.4rem 0.25rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.meditation-time-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
  border-radius: 50%;
}

.meditation-time-remove:hover {
  color: var(--accent-primary);
}

.meditation-time-add {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meditation-time-input {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.35rem;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
