/* Top strip with centered logo and right controls */
.top-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 4px 16px;
  pointer-events: none;
}

.top-strip-left,
.top-strip-center,
.top-strip-right {
  pointer-events: none;
}

.top-strip-right > *,
.top-strip-center > *,
.top-strip-left > * {
  pointer-events: auto;
}

.top-strip-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Logo */
.app-logo {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
}

.app-logo img {
  max-height: 25px;
  display: block;
}

/* Page tabs */
.page-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}

.page-tab {
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.85rem;
  background: rgba(20, 20, 20, 0.75);
  border: 1px solid #444;
  color: #e0e0e0;
  cursor: pointer;
  white-space: nowrap;
}

.page-tab:hover {
  background: rgba(60, 60, 60, 0.9);
}

.page-tab.active {
  background: #1fb26a;
  border-color: #18a35f;
  color: #ffffff;
}

.page-tab-add {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  padding: 0;
  text-align: center;
  font-size: 16px;
  line-height: 1;
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid #444;
  color: #e0e0e0;
}

.page-tab-add:hover {
  background: rgba(60, 60, 60, 0.95);
}

body.theme-light .page-tab {
  background: rgba(245, 245, 245, 0.9);
  border-color: #ccc;
  color: #222;
}

body.theme-light .page-tab:hover {
  background: #e0e0e0;
}

body.theme-light .page-tab.active {
  background: #1976d2;
  border-color: #1259a2;
  color: #ffffff;
}

body.theme-light .page-tab-add {
  background: #f5f5f5;
  border-color: #ccc;
  color: #222;
}

body.theme-light .page-tab-add:hover {
  background: #e0e0e0;
}

/* Theme switch slider styles and positioning (controls area) */
#theme-toggle-wrap {
  display: flex;
  justify-content: flex-end;
}

.theme-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(28, 28, 28, 0.35);
  border-radius: 24px;
  padding: 5px 11px;
  box-shadow: 0 1px 8px #0005;
}

.sun { color: #ffe071; }
.moon { color: #d7eaff; }

.switch {
  position: relative;
  display: inline-block;
  width: 41px;
  height: 22px;
  margin: 0 3px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333;
  border-radius: 22px;
  transition: background .2s;
  box-shadow: 0 0 2px #0006;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px; width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #fff9da;
  transition: transform .2s, background .2s;
  border-radius: 50%;
  box-shadow: 0 0 2px #0004;
}

input:checked + .slider {
  background-color: #efefef;
}

input:checked + .slider:before {
  transform: translateX(19px);
  background: #273147;
}

@media (max-width: 520px) {
  .top-strip { padding: 4px 8px; }
  .switch { width: 32px; height: 17px; }
}

/* Global edit button state (top-right pencil) */
.global-edit-button {
  background: transparent;
  border: none;
  padding: 0 2px 0 0;
  cursor: pointer;
}

.global-edit-button[aria-pressed="true"] svg path:first-child {
  stroke: #fe6b6b !important;
}

/* Pencil button for widget edit (inside widgets) */
.widget-pencil {
  background: transparent;
  border: none;
  padding: 0 4px 0 0;
  cursor: pointer;
  outline: none;
  vertical-align: middle;
}

.widget-pencil[aria-pressed="true"] svg path:first-child {
  stroke: #fe6b6b !important;
}

.widget-pencil svg { vertical-align: middle; }

/* Top add-widget plus button in header */
.add-widget-trigger-wrap {
  position: relative;
}

.add-widget-trigger {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #1c7f4b;
  background: #1fb26a;
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.add-widget-trigger:hover {
  background: #25c877;
}

body.theme-light .add-widget-trigger {
  border-color: #1c7f4b;
  background: #1fb26a;
  color: #ffffff;
}

body.theme-light .add-widget-trigger:hover {
  background: #25c877;
}

/* Add-widget dropdown menu (hidden by default) */
.add-widget-menu {
  position: absolute;
  top: 115%;
  right: 0;
  background: #151515;
  border-radius: 4px;
  border: 1px solid #444;
  min-width: 170px;
  box-shadow: 0 6px 18px #0008;
  padding: 4px 0;
  display: none;
  z-index: 400;
}

body.theme-light .add-widget-menu {
  background: #ffffff;
  border-color: #ccc;
  box-shadow: 0 6px 16px #0004;
}

.add-widget-trigger-wrap.open .add-widget-menu {
  display: block;
}

.widget-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.9rem;
}

.widget-type-row:hover {
  background: #262626;
}

body.theme-light .widget-type-row:hover {
  background: #f5f5f5;
}

body.theme-light .widget.search-shell {
  background: transparent;
  border: none;
  box-shadow: none;
}

.widget-type-name {
  flex: 1;
}

.widget-type-add {
  background: transparent;
  color: #76e0c1;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0.15em 0.5em;
  font-size: 0.8rem;
  cursor: pointer;
}

.widget-type-add:hover {
  background: #232323;
}

body.theme-light .widget-type-add {
  color: #0066cc;
  border-color: #999;
}

body.theme-light .widget-type-add:hover {
  background: #e0e0e0;
}

/* Main dashboard styles */
body {
  font-family: system-ui, sans-serif;
  background: #222 url('images/bg.jpg') no-repeat center center fixed;
  color: #eee;
  margin: 0;
  transition: background 0.25s, color 0.25s;
}

body.theme-light {
  background: #f5f5f5;
  color: #111;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 1200px;
  margin: 3.0rem auto 2rem;
  padding: 0 1rem;
}

#widget-controls {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* GRID */
#widgets-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.5rem;
  position: relative;
}

.widget {
  background: #191919cc;
  border-radius: 8px;
  padding: 1rem 2rem;
  position: relative;
  min-width: 300px;
  grid-column: span 2;
  transition: grid-column 0.2s;
}

.widget.size-small { grid-column: span 2; }
.widget.size-medium { grid-column: span 3; }
.widget.size-large { grid-column: span 6; }

body.theme-light .widget {
  background: rgba(220, 220, 220, 0.90);
  border: 1px solid #d0d0d0;
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 0.25em;
  margin-bottom: 1em;
  flex-wrap: wrap;
}

/* Title + color */
.widget-title {
  font-size: 1.2em;
  font-weight: bold;
  flex: 1 1 auto;
  min-width: 0;
}

.widget-title-color-picker {
  width: 30px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 999px;
  margin-left: 6px;
  cursor: pointer;
  background: transparent;
}

.widget-title-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}
.widget-title-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 999px;
}
.widget-title-color-picker::-moz-color-swatch {
  border: none;
  border-radius: 999px;
}

.widget-header .edit-title {
  font-size: 1.2em;
  font-weight: bold;
  flex: 1 1 auto;
  min-width: 0;
  outline: none;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
}

/* Delete buttons */
.widget-header .delete,
.bookmarks-list .delete,
.todo-list .delete {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  padding: 0;
  margin: 0 4px 0 0;
  background: #D1131A;
  color: #ffffff;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.widget-header .delete:hover,
.bookmarks-list .delete:hover,
.todo-list .delete:hover {
  background: #ED4045;
}

/* Size buttons */
.size-buttons {
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #444;
  margin-left: 0.35em;
}

body.theme-light .size-buttons {
  border-color: #ccc;
}

.size-button {
  padding: 0.1em 0.6em;
  background: transparent;
  border: none;
  font-size: 0.8em;
  cursor: pointer;
  color: inherit;
}

.size-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-light .size-button:hover {
  background: rgba(0, 0, 0, 0.04);
}

.size-button[aria-pressed="true"] {
  background: #ffe08233;
  color: #ffe082;
}

body.theme-light .size-button[aria-pressed="true"] {
  background: #ffe08255;
  color: #5d4037;
}

/* Old dropdown (kept for safety) */
.resize-select {
  margin-left: 0.7em;
  background: #232323;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0.14em 0.6em;
  font-size: 1em;
  cursor: pointer;
}

body.theme-light .resize-select {
  background: #fff;
  color: #222;
  border-color: #ccc;
}

.notes,
.edit-notes {
  min-height: 120px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #232323;
  padding: 1em;
  outline: none;
  margin-bottom: 1em;
}

body.theme-light .notes,
body.theme-light .edit-notes {
  background: #ffffff;
  border-color: #bbbbbb;
}

.edit-notes { outline: 2px solid #e6e66b; }

/* Bookmarks */
.bookmarks-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bookmarks-list li {
  margin: 0.15rem 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.bookmark-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.bookmark-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: block;
}

/* Editing inputs for bookmarks */
.bookmarks-list li .edit-label,
.bookmarks-list li .edit-url,
.bookmarks-list li .edit-icon-slug {
  border: none;
  background: #191919cc;
  color: inherit;
  padding: 0.2em 0.5em;
  outline: none;
}

.bookmarks-list li .edit-label,
.bookmarks-list li .edit-url {
  flex: 1 1 0;
  min-width: 0;
}

.edit-icon-slug {
  flex: 0 0 9rem;
  min-width: 7rem;
}

body.theme-light .bookmarks-list li .edit-label,
body.theme-light .bookmarks-list li .edit-url,
body.theme-light .bookmarks-list li .edit-icon-slug {
  background: #ffffff;
  border-radius: 2px;
  border: 1px solid #bbbbbb;
}

.bookmarks-list li .bookmark-label {
  flex: 1;
  color: #76e0c1;
  text-decoration: none;
  cursor: pointer;
  word-break: break-all;
}

body.theme-light .bookmarks-list li .bookmark-label {
  color: #000000;
}

body.theme-light .bookmarks-list li .bookmark-label:hover {
  text-decoration: underline;
}

.bookmarks-list li .edit-url {
  color: #bbb;
}

.bookmarks-list li .delete {
  color: #fe6b6b;
  cursor: pointer;
  font-size: 1em;
  background: none;
  border: none;
}

.button-bar {
  display: flex;
  gap: 0.5em;
  margin-bottom: 0.3em;
}

/* Green + add button for bookmarks header */
.bookmark-add-button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #3fbf6b;
  background: #2e7d32;
  color: #e8f5e9;
  font-size: 16px;
  line-height: 1;
  text-align: center;
  padding: 0;
  cursor: pointer;
}

.bookmark-add-button:hover {
  background: #3fbf6b;
}

body.theme-light .bookmark-add-button {
  background: #43a047;
  border-color: #2e7d32;
  color: #ffffff;
}

body.theme-light .bookmark-add-button:hover {
  background: #66bb6a;
}

/* To‑do */
.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.todo-list li {
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: #262626;
  margin-bottom: 0.4em;
  padding: 0.4em 0.6em;
  border-radius: 4px;
}

body.theme-light .todo-list li,
body.theme-light .bookmarks-list li {
  background: #ffffff;
  border-color: #bbbbbb;
}

.todo-list li span {
  flex: 1;
  word-break: break-word;
}

.todo-list li span.todo-done {
  text-decoration: line-through;
  opacity: 0.65;
}

.todo-add-row {
  display: flex;
  gap: 0.4em;
  margin-top: 0.6em;
}

.todo-add-input {
  flex: 1;
  padding: 0.3em 0.5em;
  border-radius: 4px;
  border: 1px solid #444;
  outline: none;
  background: #232323;
  color: inherit;
}

body.theme-light .todo-add-input {
  background: #ffffff;
  border-color: #ccc;
}

/* Green + button for To‑Do add */
.todo-add-button {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #3fbf6b;
  background: #2e7d32;
  color: #e8f5e9;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  padding: 0;
  cursor: pointer;
  margin-top: 2px;
}

.todo-add-button:hover {
  background: #3fbf6b;
}

body.theme-light .todo-add-button {
  background: #43a047;
  border-color: #2e7d32;
  color: #ffffff;
}

body.theme-light .todo-add-button:hover {
  background: #66bb6a;
}

/* Generic buttons */
button {
  background: #232323;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0.4em 1em;
  cursor: pointer;
  font-size: 1em;
}

body.theme-light button {
  background: #ffffff;
  color: #111;
  border-color: #ccc;
}

button:hover,
.delete:hover {
  background: #444;
}

/* Force search delete to use red-circle style in all themes */
.search-widget-delete {
  background: #D1131A !important;
  color: #ffffff !important;
  border-radius: 50% !important;
  border: none !important;
  padding: 0 !important;
}

body.theme-light button:hover,
body.theme-light .delete:hover {
  background: #e0e0e0;
}

/* Search shell */
.widget.search-shell {
  background: transparent;
  padding: 0;
  border-radius: 0;
  min-width: 0;
  border: none;
  box-shadow: none;
}

.widget.search-shell .widget-header {
  height: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

/* Floating overlay for active editing bookmarks widget */
.widget-floating-edit {
  position: relative;
  z-index: 500;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.widget-temp-large {
  grid-column: 1 / -1 !important;
}

@media (max-width: 600px) {
  .widget-floating-edit {
    border-radius: 0;
  }
}

/* Icon picker dropdown */
.icon-picker-dropdown {
  position: absolute;
  background: #151515;
  border-radius: 4px;
  border: 1px solid #444;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8);
  max-height: 260px;
  overflow-y: auto;
  padding: 2px 0;
  z-index: 600;
  font-size: 0.85rem;
}

body.theme-light .icon-picker-dropdown {
  background: #ffffff;
  border-color: #ccc;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.icon-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.5rem;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.icon-picker-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-light .icon-picker-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.icon-picker-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #777;
  flex: 0 0 auto;
}

.icon-picker-text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.icon-picker-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-picker-slug {
  font-size: 0.75rem;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
