/* ================================================================
   folders.css — Спільні стилі для папок
   Використовується скрізь: popup (fp-*) і tabs dropdown (fd-*)
   ================================================================ */

/* ---------------------------------------------------------------
   TABS: Папки — іконка на мобільному, текст на десктопі
   --------------------------------------------------------------- */
.tab-folders-text {
  display: inline;
}

.tab-folders-icon {
  display: none;
  width: 18px;
  height: 18px;
  filter: invert(0.6);
  vertical-align: middle;
}

.tab.active .tab-folders-icon {
  filter: invert(0);
}

@media (max-width: 600px) {
  .tab-folders-text {
    display: none;
  }

  .tab-folders-icon {
    display: inline-block;
  }
}

/* ---------------------------------------------------------------
   fd-* — Dropdown «Папки» в tabs-container
   --------------------------------------------------------------- */
.folders-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #1e1e1e;
  border-radius: 16px;
  padding: 8px 0;
  min-width: 300px;
  z-index: 100;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  margin-top: 10px;
  border: 1px solid #333;
  text-align: left;
}

.folders-dropdown.open {
  display: block;
  animation: fdSlideIn .2s cubic-bezier(.4, 0, .2, 1);
}

@keyframes fdSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.folders-dropdown .fd-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: #ccc;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  position: relative;
}

.folders-dropdown .fd-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.folders-dropdown .fd-link img {
  width: 15px;
  height: 15px;
  filter: invert(0.7);
  transition: filter .15s;
  flex-shrink: 0;
}

.folders-dropdown .fd-link:hover img {
  filter: invert(0.95);
}

.fd-separator {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 0;
}

.fd-right {
  margin-left: auto;
  display: grid;
  align-items: center;
  justify-items: end;
}

.fd-right>* {
  grid-area: 1/1;
  transition: opacity .15s;
}

.fd-count {
  font-size: 12px;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.fd-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
}

.fd-link:hover .fd-actions {
  opacity: 1;
  pointer-events: auto;
}

.fd-link:hover .fd-count {
  opacity: 0;
}

.fd-action-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  padding: 0;
}

.fd-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.fd-action-btn img {
  width: 14px;
  height: 14px;
  filter: invert(0.7);
}

/* Create form */
.fd-create-form {
  padding: 8px 16px 12px;
  display: none;
}

.fd-create-form.open {
  display: block;
}

.fd-create-input {
  width: 100%;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 8px 12px;
  color: #f5f5f5;
  font-size: 13px;
  outline: none;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.fd-create-input:focus {
  border-color: #666;
}

.fd-icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 8px;
}

.fd-icon-opt {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  background: #2a2a2a;
  transition: border-color .15s, background .15s;
}

.fd-icon-opt:hover {
  background: #333;
}

.fd-icon-opt.selected {
  border-color: #f5f5f5;
  background: #333;
}

.fd-icon-opt img {
  width: 16px;
  height: 16px;
  filter: invert(0.7);
}

.fd-create-submit {
  background: #f5f5f5;
  color: #121212;
  border: none;
  border-radius: 10px;
  padding: 7px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: opacity .2s;
}

.fd-create-submit:hover {
  opacity: 0.85;
}

.fd-create-submit:disabled {
  opacity: 0.4;
}

.fd-rename-input {
  background: #2a2a2a;
  border: 1px solid #666;
  border-radius: 8px;
  padding: 4px 8px;
  color: #f5f5f5;
  font-size: 13px;
  outline: none;
  width: 100px;
}

/* ---------------------------------------------------------------
   fp-* — Popup «Додати в папку» (відкривається по кліку на bookmark)
   --------------------------------------------------------------- */
.fp-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: transparent;
}

.fp-popup {
  position: fixed;
  z-index: 9999;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 0;
  min-width: 260px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  animation: fpSlideIn .2s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
}

@keyframes fpSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fp-header {
  padding: 16px 20px 12px;
  font-size: 15px;
  font-weight: 600;
  color: #f5f5f5;
  border-bottom: 1px solid #2a2a2a;
}

.fp-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 6px 0;
}

.fp-list::-webkit-scrollbar {
  width: 4px;
}

.fp-list::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

.fp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #ccc;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-size: 14px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.fp-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.fp-item img {
  width: 16px;
  height: 16px;
  filter: invert(0.7);
  flex-shrink: 0;
  transition: filter .15s;
}

.fp-item:hover img {
  filter: invert(0.95);
}

/* Right area: indicator + actions (grid overlay) */
.fp-right {
  margin-left: auto;
  display: grid;
  align-items: center;
  justify-items: end;
  flex-shrink: 0;
}

.fp-right>* {
  grid-area: 1/1;
  transition: opacity .15s;
}

.fp-item .fp-count {
  font-size: 12px;
  color: #555;
  min-width: 20px;
  text-align: right;
}

.fp-item .fp-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  -webkit-mask-image: url(https://doctrina.space/css/svg/fi-rr-check-circle.svg);
  mask-image: url(https://doctrina.space/css/svg/fi-rr-check-circle.svg);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  background-color: rgb(186, 250, 191);
}

.fp-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
}

.fp-item:hover .fp-actions {
  opacity: 1;
  pointer-events: auto;
}

.fp-item:hover .fp-indicator {
  opacity: 0;
}

.fp-action-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s;
  flex-shrink: 0;
}

.fp-action-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.fp-action-del:hover {
  background: rgba(255, 80, 80, 0.22) !important;
}

.fp-action-btn img {
  width: 12px;
  height: 12px;
  filter: invert(0.7);
}

.fp-divider {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 0;
}

.fp-create-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #a0a0a0;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-size: 14px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.fp-create-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f5f5f5;
}

.fp-create-btn img {
  width: 18px;
  height: 18px;
  filter: invert(0.5);
}

/* Popup create form */
.fp-create-form {
  padding: 12px 16px 16px;
  border-top: 1px solid #2a2a2a;
  display: none;
}

.fp-create-form.open {
  display: block;
}

.fp-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.fp-input {
  flex: 1;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 8px 12px;
  color: #f5f5f5;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.fp-input:focus {
  border-color: #666;
}

.fp-submit {
  background: #f5f5f5;
  color: #121212;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity .2s;
  white-space: nowrap;
}

.fp-submit:hover {
  opacity: 0.85;
}

.fp-submit:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Icon picker in popup */
.fp-icon-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.fp-icon-opt {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  background: #2a2a2a;
  transition: border-color .15s, background .15s;
}

.fp-icon-opt:hover {
  background: #333;
}

.fp-icon-opt.selected {
  border-color: #f5f5f5;
  background: #333;
}

.fp-icon-opt img {
  width: 18px;
  height: 18px;
  filter: invert(0.7);
}