/* ========== Base & theme ========== */
:root {
  --primary-color: #4ecdc4;
  --primary-color-dark: #5ee7df;
}

/* ========== Glass ========== */
.glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.dark .glass {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ========== Body ========== */
body {
  background: #F3F4F6;
  background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
  background-size: 24px 24px;
}

.dark body {
  background: #0f172a;
  background-image: radial-gradient(#1e293b 1px, transparent 1px);
  background-size: 24px 24px;
}

body.custom-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ========== Header: time & weather font and size ========== */
.header-greeting {
  font-family: "Outfit", sans-serif;
  font-size: 1.875rem;
  font-weight: 300;
  letter-spacing: -0.02em;
}

.header-time-weather {
  font-family: "Inter", sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #64748b;
}

.dark .header-time-weather {
  color: #94a3b8;
}

.header-time-weather .header-weather-icon {
  color: #f59e0b;
}

.dark .header-time-weather .header-weather-icon {
  color: #fbbf24;
}

/* ========== Widget windows ========== */
.widget-window {
  z-index: 11;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 241, 0.5);
  display: flex;
  flex-direction: column;
  min-width: 280px;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  cursor: move;
}

.dark .widget-header {
  background: #1e293b;
  border-color: #334155;
}

.widget-window.hidden {
  display: none !important;
}

/* ========== Pomodoro widget ========== */
.pomodoro-body {
  background: #fff;
}

.dark .pomodoro-body {
  background: #1e293b;
}

.pomodoro-phase-pill {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.dark .pomodoro-phase-pill {
  background: rgba(127, 29, 29, 0.4);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fca5a5;
}

.pomodoro-timer-wrap {
  min-height: 4rem;
}

.pomodoro-timer-text {
  font-size: 2.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.pomodoro-progress-fill {
  background: var(--primary-color);
}

.dark .pomodoro-progress-fill {
  background: var(--primary-color-dark);
}

.pomodoro-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.pomodoro-btn:active {
  transform: scale(0.96);
}

.pomodoro-btn-play {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.pomodoro-btn-play:hover {
  background: #3dbdb5;
  border-color: #3dbdb5;
}

.dark .pomodoro-btn-play {
  background: var(--primary-color-dark);
  border-color: var(--primary-color-dark);
}

.dark .pomodoro-btn-play:hover {
  background: #6ef0e8;
  border-color: #6ef0e8;
}

.pomodoro-btn-secondary {
  background: #fff;
  color: #334155;
}

.pomodoro-btn-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.dark .pomodoro-btn-secondary {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

.dark .pomodoro-btn-secondary:hover {
  background: #475569;
  border-color: #64748b;
}

.pomodoro-btn .material-symbols-outlined {
  font-size: 1.5rem;
}

/* Pomodoro confirmation popup (section/break ended) */
.pomodoro-confirm-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
}

.pomodoro-confirm-overlay.hidden {
  display: none !important;
}

.pomodoro-confirm-box {
  min-width: 260px;
  max-width: 320px;
}

/* Pomodoro Settings modal */
.pomodoro-settings-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
}

.pomodoro-settings-overlay.hidden {
  display: none !important;
}

.pomodoro-settings-box {
  width: 100%;
  max-width: 320px;
}

.pomodoro-settings-input {
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pomodoro-settings-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.25);
}

/* Pomodoro timer / history view toggle */
.pomodoro-view.hidden {
  display: none !important;
}

/* ========== Confirm modal ========== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.confirm-overlay:not(.hidden) {
  display: flex;
}

.confirm-overlay.hidden {
  display: none !important;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.confirm-box {
  position: relative;
}

/* ========== Settings modal ========== */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.settings-overlay:not(.hidden) {
  display: flex;
}

.settings-overlay.hidden {
  display: none !important;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.settings-box {
  position: relative;
}

.settings-header {
  background: #fff;
}

.dark .settings-header {
  background: #1e293b;
}

.settings-footer {
  padding-top: 0;
}

/* ========== Nav: active state when widget is open ========== */
.nav-widget.active {
  background: rgba(78, 205, 196, 0.2);
  color: #4ecdc4;
}

.dark .nav-widget.active {
  background: rgba(78, 205, 196, 0.2);
  color: #5ee7df;
}

/* ========== Todo widget ========== */
#todoListWrap {
  max-height: 240px;
  overflow-y: auto;
}

.todo-add-btn {
  background: #4ecdc4;
}

.todo-add-btn:hover {
  background: #3db8b0;
}

.todo-check-done .material-symbols-outlined {
  color: #4ecdc4;
}

.todo-item .todo-edit-input {
  min-width: 0;
}

/* ========== Notes widget ========== */
.widget-notes {
  min-height: 320px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.widget-notes .widget-header {
  flex-shrink: 0;
}

.notes-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.notes-sidebar {
  flex-shrink: 0;
}

.notes-list {
  min-height: 80px;
}

.notes-list-item {
  cursor: pointer;
}

.notes-editor-wrap {
  min-height: 0;
}

.notes-placeholder {
  pointer-events: none;
}

/* Note popup (zoom view) */
.notes-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.4);
}

.notes-popup-overlay.hidden {
  display: none !important;
}

.notes-popup {
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.notes-popup-body {
  min-height: 0;
  overflow: auto;
}

/* ========== Music widget ========== */
.music-player-body {
  overflow: visible;
}

.music-track-title {
  font-size: 1.1rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.25rem;
}

.music-progress-bar {
  -webkit-tap-highlight-color: transparent;
}

.music-progress-fill,
.music-progress-bar .music-progress-handle {
  background: #4ecdc4;
}

.dark .music-progress-fill,
.dark .music-progress-bar .music-progress-handle {
  background: #5ee7df;
}

.music-progress-bar:hover .music-progress-handle {
  opacity: 1;
}

.music-progress-handle {
  opacity: 0;
  transition: left 0.1s linear, opacity 0.2s;
}

.music-play-pause-btn {
  background: #4ecdc4;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.music-play-pause-btn:hover {
  background: #3db8b0;
  transform: scale(1.05);
}

.music-play-pause-btn .material-symbols-outlined {
  font-size: 28px;
}

.music-control-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.music-control-icon:hover,
.music-control-icon.active {
  color: #4ecdc4;
}

.dark .music-control-icon:hover,
.dark .music-control-icon.active {
  color: #5ee7df;
}

.music-control-icon .material-symbols-outlined {
  font-size: 22px;
}

.music-dropdown-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 6px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s, color 0.2s;
}

.music-dropdown-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #475569;
}

.dark .music-dropdown-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.music-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  background: #cbd5e1;
  border-radius: 2px;
  outline: none;
  height: 6px;
}

.dark .music-volume-slider {
  background: #475569;
}

.music-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  background: #4ecdc4;
  border-radius: 50%;
  cursor: pointer;
}

.music-volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: #4ecdc4;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.dark .music-volume-slider::-webkit-slider-thumb {
  background: #5ee7df;
}

.dark .music-volume-slider::-moz-range-thumb {
  background: #5ee7df;
}

/* Music widget: center player with Albums left / Playlist right panels */
.music-widget-layout {
  width: 420px;
  max-width: 95vw;
  overflow: visible; /* allow side panels to show outside widget bounds */
}

.music-widget-layout .music-widget-content {
  position: relative;
}

/* Side panels: float to the left and right of the player (separate windows) */
.music-side-panel {
  position: absolute;
  top: 0;
  width: 200px;
  max-height: 320px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 241, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1;
}

.dark .music-side-panel {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
}

.music-side-panel.visible {
  display: flex;
}

/* Albums: to the left of the player */
.music-album-panel {
  right: 100%;
  margin-right: 8px;
  left: auto;
}

/* Playlist: to the right of the player */
.music-playlist-panel {
  left: 100%;
  margin-left: 8px;
  right: auto;
}

.music-panel-header {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: #fff;
}

.dark .music-panel-header {
  color: #e2e8f0;
  border-color: #475569;
  background: #1e293b;
}

.music-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Vertical list items: full width, stack on top of each other */
.music-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  transition: background 0.2s;
  text-align: left;
  border: none;
  background: none;
}

.music-panel-content .music-dropdown-item {
  border-radius: 0;
}

.music-panel-placeholder {
  padding: 12px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  margin: 0;
}

.dark .music-panel-placeholder {
  color: #94a3b8;
}

.dark .music-dropdown-item {
  color: #e2e8f0;
}

.music-dropdown-item:hover {
  background: #f1f5f9;
}

.dark .music-dropdown-item:hover {
  background: #334155;
}

.music-dropdown-item.active {
  background: #e8f5f4;
  color: #4ecdc4;
  font-weight: 500;
}

.dark .music-dropdown-item.active {
  background: rgba(94, 231, 223, 0.2);
  color: #5ee7df;
}

/* ========== Ambient Sounds ========== */
.ambient-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.ambient-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.ambient-icon-wrap {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: transform 0.2s ease;
}

.ambient-icon-wrap:hover {
  transform: scale(1.1);
}

.ambient-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  transition: filter 0.3s ease;
  display: block;
}

.ambient-icon.muted {
  filter: opacity(0.25);
}

.ambient-icon.low {
  filter: opacity(0.45);
}

.ambient-icon.medium {
  filter: opacity(0.65);
}

.ambient-icon.max {
  filter: none;
}

.dark .ambient-icon {
  filter: invert(1);
}

.dark .ambient-icon.muted {
  filter: invert(1) opacity(0.25);
}

.dark .ambient-icon.low {
  filter: invert(1) opacity(0.45);
}

.dark .ambient-icon.medium {
  filter: invert(1) opacity(0.65);
}

.dark .ambient-icon.max {
  filter: invert(1);
}

.ambient-label {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.5px;
  color: #64748b;
}

.dark .ambient-label {
  color: #94a3b8;
}

@media (max-width: 400px) {
  .ambient-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
