/* ── Search ── */
.search-bar {
  height: 38px;
  padding: 0 14px;
  border: 0.5px solid rgba(31, 31, 30, 0.15);
  border-radius: 8px;
  background: var(--color-card);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  min-width: 200px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search-bar::placeholder {
  color: rgb(143, 142, 138);
}

.search-bar:focus {
  outline: none;
  border-color: var(--color-text-secondary);
  box-shadow: 0 0 0 3px rgba(100, 110, 120, 0.10);
}

/* ── Sort Cycle Button (single button, 3 states) ── */
.docs-sort-cycle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border: 0.5px solid rgba(31, 31, 30, 0.15);
  border-radius: 8px;
  background: var(--color-card);
  color: rgb(115, 113, 108);
  font-size: var(--font-size-xs);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
  height: 36px;
}

.docs-sort-cycle:hover {
  color: var(--color-text-primary);
  background: rgba(0, 0, 0, 0.04);
}

.docs-sort-cycle:focus-visible {
  outline: 2px solid rgba(31, 31, 30, 0.3);
  outline-offset: -2px;
}

.docs-sort-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── New Text Button ── */
/* ── Split "Ny tekst" Button ── */
.docs-new-split {
  position: relative;
  display: inline-flex;
}

#new-doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-text-primary);
  color: #fff;
  border: none;
  box-shadow: none;
  min-height: 40px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-radius: 8px 0 0 8px;
  transition: opacity 180ms ease;
}

#new-doc-btn:hover {
  background: #2d2d32;
  opacity: 1;
}

.docs-new-gdocs {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-height: 40px;
  background: var(--color-text-primary);
  color: #fff;
  border: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-radius: 0 8px 8px 0;
  border-left: 0.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
  padding: 0;
  cursor: pointer;
  transition: background 180ms ease;
}

#new-doc-gdocs:hover,
.docs-new-gdocs:hover {
  background: #2d2d32;
  border-color: transparent;
}

.docs-new-gdocs-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.docs-new-gdocs-circle svg {
  display: block;
}

.docs-new-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid rgba(31, 31, 30, 0.2);
  border-radius: 12px;
  box-shadow: rgba(0, 0, 0, 0.08) 0px 2px 8px 0px;
  padding: 6px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px) scale(0.98);
  transition: opacity 120ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 120ms cubic-bezier(0.16, 1, 0.3, 1),
              visibility 120ms;
}

.docs-new-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.docs-new-dropdown-item button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgb(55, 55, 52);
  font-size: 14px;
  font-weight: 430;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 75ms ease;
  white-space: nowrap;
}

.docs-new-dropdown-item button:hover {
  background: rgba(0, 0, 0, 0.04);
}

.docs-new-dropdown-item button .gdocs-google-icon {
  flex-shrink: 0;
}

/* Hide old gdocs bar */
.gdocs-bar { display: none; }

/* ── Google Docs Connect Prompt (for disconnected users) ── */
.gdocs-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: var(--space-6);
  border: 1px solid rgba(66, 133, 244, 0.2);
  border-radius: var(--radius-md);
  background: rgba(66, 133, 244, 0.04);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .gdocs-prompt {
  background: rgba(66, 133, 244, 0.08);
  border-color: rgba(66, 133, 244, 0.15);
}

.gdocs-prompt-icon {
  flex-shrink: 0;
  color: #4285F4;
}

.gdocs-prompt-text {
  flex: 1;
  min-width: 0;
}

.gdocs-prompt-btn {
  flex-shrink: 0;
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: #4285F4;
  color: #fff;
  font-size: var(--font-size-xs);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.gdocs-prompt-btn:hover {
  background: #3367d6;
}

.gdocs-prompt-btn:active {
  transform: scale(0.97);
}

.gdocs-prompt-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-tertiary);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.gdocs-prompt-close:hover {
  background: var(--color-bg);
  color: var(--color-text-primary);
}

@media (max-width: 767px) {
  .gdocs-prompt {
    gap: 8px;
    padding: 8px 12px;
  }
  .gdocs-prompt-text {
    font-size: var(--font-size-xs);
  }
}

.gdocs-google-icon {
  flex-shrink: 0;
}

.gdocs-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}


.gdocs-import-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 0.5px solid rgba(31, 31, 30, 0.15);
  border-radius: 8px;
  background: var(--color-card);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  min-height: 40px;
  white-space: nowrap;
}

.gdocs-import-btn:hover {
  border-color: #4285F4;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
  background: rgba(66, 133, 244, 0.04);
}

[data-theme="dark"] .gdocs-import-btn:hover {
  background: rgba(66, 133, 244, 0.12);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.25);
}

.gdocs-import-btn:focus-visible {
  outline: 2px solid rgba(31, 31, 30, 0.3);
  outline-offset: -2px;
}

.gdocs-import-btn:active {
  transform: scale(0.98);
}

.gdocs-import-btn .gdocs-google-icon {
  flex-shrink: 0;
}

.gdocs-disconnect-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.gdocs-disconnect-btn:hover {
  background: rgba(255, 62, 29, 0.08);
  color: #ff3e1d;
}

/* ── Responsive: Search ── */
@media (max-width: 767px) {
  .docs-search-wrap {
    width: 100%;
    order: 1;
  }

  .search-bar {
    width: 100%;
    min-width: 100%;
  }

  .docs-sort-cycle {
    order: 2;
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  .docs-search-wrap {
    width: 100%;
    flex-basis: 100%;
  }

  .docs-new-split {
    flex-basis: 100%;
    order: 3;
  }

  #new-doc-btn {
    flex: 1;
    justify-content: center;
  }
}
