html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family: Arial;
  background: #f2f2f2;
}
.container {
  background: #f2f2f2;
  /* padding: 20px; */
  width: 100%;
  margin-left: 0;
  min-height: 100%;
  height: auto;
  box-sizing: border-box;
  overflow-y: auto;
  transition:
    margin-left 0.3s ease,
    width 0.3s ease;
}
h1 {
  margin: 0;
  font-size: 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  background-color: #f2f2f2;
  padding: 10px;
  box-shadow: 0 8px 5px rgba(0, 0, 0, 0.15);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left h1 {
  margin-left: 6px;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
  flex-wrap: wrap;
}

.header-right .search-wrapper {
  margin-bottom: 0;
}

.editable {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 16px;
  background: #fff;

  /* ✅ Auto size */
  height: auto;
  min-height: unset;
  max-height: none;

  white-space: pre-wrap;
  word-break: break-word;
}

.clipboard,
.clipboard * {
  overflow: visible;
}

button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #fff;
  background: #4caf50;
  margin-right: 5px;
}
.blue-btn {
  background: #2196f3;
}
#addBtn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  background: #2196f3;
  margin-top: 0;
  margin-right: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#addBtn svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin-right: 5px;
  color: #fff;
}
.message {
  font-size: 12px;
  color: #777;
  margin-top: 5px;
}

.message-view {
  margin-top: 8px;
  margin-bottom: 5px;
  /* line-height: 1.5; */
}

.message-view strong {
  display: block; /* make title a block element */
  margin-bottom: 6px; /* space between title and text */
  font-size: 1.1em;
}

input[type="date"],
select {
  padding: 5px;
  border-radius: 6px;
  border: 1px solid #ccc;
}
.search-wrapper {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.search-box {
  position: relative;
  width: 10%;
  max-width: 200px;
  min-width: 200px;
}
#searchInput {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid #ccc;
  font-size: 14px;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
#searchInput:focus {
  border-color: #2196f3;
  box-shadow: 0 0 5px rgba(33, 150, 243, 0.5);
}
#clearSearch {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 14px;
  color: #999;
  display: none;
}
#clearSearch:hover {
  color: #333;
}

.filters {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.filter-block {
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sort-by-label {
  margin-right: 6px;
}
#filterTags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.date-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.date-row label {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: #555;
}

#sortBy {
  display: block;
  margin: 0 auto;
}
#clipboardsContainer {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-left: 12px;
  margin-right: 12px;

  /* ✅ Prevent equal-height stretching */
  align-items: flex-start;
  align-content: flex-start;
}

.clipboard {
  width: 24%;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 16px;
  background: #ffff;
  box-sizing: border-box;
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.08);

  height: auto;
  min-height: 0;

  max-height: none;

  display: flex;
  flex-direction: column;
  align-self: flex-start;
}

.clipboard-topbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.clipboard-topbar.is-editing {
  justify-content: space-between;
}

.clipboard-topbar-title {
  flex: 1;
  min-width: 0;
}

.clipboard-topbar-title .editable-title {
  width: 100% !important;
  box-sizing: border-box;
}

.clipboard .editable {
  width: calc(100% - 30px);
  box-sizing: border-box;
  margin-top: 8px;
}

.clipboard-title {
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1.15;
  color: #111;
  margin-right: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 28px);
}

.clipboard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.clipboard-footer-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.clipboard-time {
  margin: 0;
  color: #8a8a8a;
  font-size: 12px;
}

.clipboard-icon-btn {
  background: transparent !important;
  border: none !important;
  color: #6f6f6f;
  width: 22px !important;
  min-width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 6px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.clipboard-icon-btn svg {
  fill: currentColor !important;
}

.clipboard-copy-btn {
  color: #8e8e8e;
}

.clipboard-edit-btn {
  color: #6f6f6f;
}

.clipboard-delete-btn {
  color: #d14a4a;
}

.clipboard .tag {
  border-radius: 999px;
}

.clipboard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.delete-btn {
  background: transparent;
  border: 1.5px solid #f44336;
  color: #f44336;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.delete-btn:hover {
  background: rgba(244, 67, 54, 0.08);
}
.top-actions {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 15px;
}
/* Drawer toggle button */
/* ===== Left Drawer ===== */
#drawer {
  position: fixed;
  top: 0;
  left: -10%;
  width: 10%;
  height: 100%;
  background: #f2f2f2;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  transition: left 0.3s ease;
  z-index: 1002;
}

#drawer.open {
  left: 0;
}

#drawer h3 {
  margin-top: 10px;
  margin-bottom: 20px;
  margin-left: 10px;
  margin-right: 10px;
}

.drawer-header {
  margin-top: 50px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.h3 {
  margin: 0;
  font-style: italic;
  font-weight: 600;
  font-size: 18px;
}

#drawer button {
  display: block;
  width: 100%;
  background: #2196f3;
}

#drawer .manage-tags-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  padding: 0;
  margin: 0 10px 0 0;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2196f3;
}

#drawer .manage-tags-btn svg {
  width: 14px;
  height: 14px;
  fill: #fff;
}

#drawerOverlay {
  display: none !important;
}

/* Drawer toggle button */
#drawerToggle {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1003;
  background: #2196f3;
  color: #fff;
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 6px;
}

body:not(.drawer-open) .page-header {
  padding-left: 52px;
}

body:not(.drawer-open) .header-left h1 {
  margin-left: 6px;
}

/* Shift content when drawer opens */
body.drawer-open .container {
  margin-left: 10%;
  width: 90%;
}

#activeTagFilters {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
  align-items: center;
}

.active-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  color: #fff;
}

.active-tag span {
  cursor: pointer;
  font-weight: bold;
}

#drawerFilterTags {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background-color: #ffffff;
  width: 100%;
  box-sizing: border-box;
}

#drawerFilterTags label,
.drawer-tag-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

#drawerFilterTags input {
  cursor: pointer;
}

.drawer-tag-edit-btn {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px;
  padding: 0;
  margin: 0 6px 0 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.drawer-tag-edit-btn svg {
  width: 34px;
  height: 34px;
}

#drawer #clearAllBtn.drawer-clear-btn {
  background: transparent;
  color: #2196f3;
  border: 1.5px solid #2196f3;
  margin-top: 20px;
  margin-left: 10px;
  margin-right: 10px;
  width: calc(100% - 20px);
}

#drawer #clearAllBtn.drawer-clear-btn:hover {
  background: rgba(73, 173, 255, 0.08);
}

.border-btn {
  background: transparent !important;
  border: 1.5px solid #2196f3;
  color: #2196f3;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.border-btn:hover {
  background: rgba(73, 173, 255, 0.08);
}

.top {
  margin-top: 50px;
}

.right {
  margin-right: 10px;
}

.row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}

.delete-btn svg {
  fill: currentColor;
}
.delete-btn:hover svg {
  color: #f44336;
}

.border-btn svg {
  fill: #2196f3;
}

.clipboard-add-tag-btn {
  border: none !important;
}

/* Tag checkbox list */
.clipboard-tags-picker label {
  padding: 4px 2px;
  border-radius: 6px;
}

.clipboard-tags-picker input {
  cursor: pointer;
}

.clipboard.editing {
  border: 2px solid #2196f3;
  /* background: #f4faff; */
}

.editing {
  border: 2px solid #2196f3 !important;
  /* background: #f4f9ff; */
}

.new-clipboard .editing {
  border: 1px solid #b8b8b8 !important;
}

/* Tags modal */
.tags-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
  z-index: 2000;
}

.tags-modal-overlay.open {
  display: flex;
}

.tags-modal {
  width: min(560px, 100%);
  background: #f3f3f3;
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.tags-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}

.tags-modal-header h2 {
  margin: 0;
  color: #111827;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
}

.tags-modal-header h2.is-edit-title {
  font-size: 22px;
}

.tags-modal-close-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #7a7a7a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

.tags-modal-close-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.tags-modal-divider {
  height: 1px;
  background: #cfcfcf;
  margin: 0 20px;
}

.tags-modal-body {
  padding: 18px 20px 20px;
}

.tags-modal-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#tagsModalName {
  flex: 1;
  min-width: 0;
  border: 1px solid #bdbdbd;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 20px;
  color: #111827;
  background: #efefef;
  box-sizing: border-box;
}

#tagsModalName::placeholder {
  font-size: 20px;
}

#tagsModalColor {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  overflow: hidden;
}

#tagsModalColor::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 8px;
}

#tagsModalColor::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

#tagsModalColor::-moz-color-swatch {
  border: none;
  border-radius: 8px;
}

.tags-modal-actions {
  display: flex;
  justify-content: stretch;
  gap: 10px;
  margin-top: 18px;
}

.tags-modal-actions button {
  flex: 1;
}

#tagsModalDeleteBtn {
  display: none;
  border-radius: 8px;
  border: 1px solid #d64545;
  background: transparent;
  color: #c53030;
  font-size: 18px;
  font-weight: 600;
  padding: 12px 16px;
  margin: 0;
}

.tags-modal-overlay.editing-tag #tagsModalDeleteBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#tagsModalSaveBtn {
  border-radius: 8px;
  border: none;
  background: #2d93df;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  padding: 12px 16px;
  margin: 0;
}

/* Red close button in edit mode */
.edit-close-mode {
  color: #e53935;
  border-color: #e53935;
}

.edit-close-mode svg {
  fill: #e53935;
}

@media (max-width: 480px) {
  #drawer {
    left: -40%;
    width: 40%;
  }

  body.drawer-open .container {
    margin-left: 0;
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 10px;
  }

  body.drawer-open .page-header {
    padding-left: 10px;
  }

  .header-right {
    width: 100%;
    margin-left: 0;
    justify-content: center;
    align-items: center;
  }

  body:not(.drawer-open) .header-right {
    align-self: center;
    justify-content: center;
    align-items: center;
  }

  body:not(.drawer-open) .page-header {
    padding-left: 10px;
    align-items: center;
  }

  body:not(.drawer-open) .header-left {
    width: calc(100% - 50px);
    margin-left: 50px;
    justify-content: flex-start;
    align-self: flex-start;
  }

  body.drawer-open .header-left {
    width: calc(100% - 50px);
    margin-left: 50px;
    justify-content: flex-start;
    align-self: flex-start;
  }

  body.drawer-open .header-right {
    align-self: center;
    justify-content: center;
    align-items: center;
  }

  .row_apart {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .search-box {
    margin-bottom: 10px;
  }

  .clipboard {
    width: 100%;
  }

  .search-wrapper {
    margin-top: 10px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
  }

  body.drawer-open .search-wrapper {
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
  }
}
