/* =========================================================
   Notepad — Tool-specific styles
   ========================================================= */

/* ---------------------------------------------------------
   Wrapper overrides
   --------------------------------------------------------- */
.notepad-wrap {
  padding: 0 !important;
  min-height: unset !important;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------
   Tab bar
   --------------------------------------------------------- */
.notepad-tabbar {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border-solid);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  flex-shrink: 0;
  min-height: 40px;
}

.notepad-tabbar::-webkit-scrollbar {
  height: 3px;
}
.notepad-tabbar::-webkit-scrollbar-track {
  background: transparent;
}
.notepad-tabbar::-webkit-scrollbar-thumb {
  background: var(--color-border-solid);
  border-radius: 2px;
}

/* Individual tab */
.notepad-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  min-width: 90px;
  max-width: 180px;
  height: 40px;
  border: none;
  border-right: 1px solid var(--color-border-solid);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  transition:
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
  flex-shrink: 0;
  user-select: none;
}

.notepad-tab:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.notepad-tab.is-active {
  background: var(--color-bg-card);
  color: var(--color-text-strong);
  border-bottom: 2px solid var(--color-accent);
  margin-bottom: -1px;
  font-weight: 600;
}

/* Tab label — the text part */
.notepad-tab__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

/* Tab rename input (inline editing) */
.notepad-tab__input {
  flex: 1;
  min-width: 0;
  padding: 1px 4px;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  color: var(--color-text-strong);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  outline: none;
}

/* Tab close button */
.notepad-tab__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition:
    opacity var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.notepad-tab:hover .notepad-tab__close,
.notepad-tab.is-active .notepad-tab__close {
  opacity: 1;
}

.notepad-tab__close:hover {
  background: var(--color-danger-dim, rgba(239,68,68,.15));
  color: var(--color-danger, #ef4444);
}

/* Add-tab button */
.notepad-tabbar__add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-right: 1px solid var(--color-border-solid);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.notepad-tabbar__add:hover {
  background: var(--color-bg-hover);
  color: var(--color-accent);
}

/* ---------------------------------------------------------
   Toolbar
   --------------------------------------------------------- */
.notepad-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border-solid);
  flex-shrink: 0;
}

.notepad-toolbar__saved {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}

.notepad-toolbar__saved.is-visible {
  opacity: 1;
}

.notepad-toolbar__spacer {
  flex: 1;
}

.notepad-toolbar__sep {
  width: 1px;
  height: 20px;
  background: var(--color-border-solid);
  margin-inline: var(--sp-1);
  flex-shrink: 0;
}

.notepad-toolbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.notepad-toolbar__btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-strong);
  border-color: var(--color-border-solid);
}

.notepad-toolbar__btn--fullscreen[aria-pressed="true"] {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.notepad-toolbar__action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border-solid);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.notepad-toolbar__action-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-strong);
  border-color: var(--color-text-muted);
}

.notepad-toolbar__action-btn--danger:hover {
  background: var(--color-danger-dim, rgba(239,68,68,.12));
  color: var(--color-danger, #ef4444);
  border-color: var(--color-danger, #ef4444);
}

/* ---------------------------------------------------------
   Textarea
   --------------------------------------------------------- */
.notepad-textarea {
  flex: 1;
  width: 100%;
  min-height: 480px;
  padding: var(--sp-5) var(--sp-6);
  background: var(--color-bg-card);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  border: none;
  border-radius: 0;
  resize: none;
  outline: none;
  box-sizing: border-box;
  transition: background var(--dur-fast) var(--ease);
}

.notepad-textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.5;
}

@media (max-width: 640px) {
  .notepad-textarea {
    padding: var(--sp-4);
    font-size: 0.9375rem;
  }
}

/* ---------------------------------------------------------
   Status bar
   --------------------------------------------------------- */
.notepad-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border-solid);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.notepad-statusbar__left {
  display: flex;
  gap: var(--sp-4);
}

.notepad-statusbar__right {
  opacity: 0.55;
}

/* ---------------------------------------------------------
   Fullscreen mode
   --------------------------------------------------------- */
.notepad-wrap.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 900;
  border-radius: 0 !important;
  border: none !important;
}

.notepad-wrap.is-fullscreen .notepad-tabbar {
  border-radius: 0;
}

.notepad-wrap.is-fullscreen .notepad-statusbar {
  border-radius: 0;
}

.notepad-wrap.is-fullscreen .notepad-textarea {
  min-height: 0;
}

/* ---------------------------------------------------------
   Toast notification
   --------------------------------------------------------- */
.notepad-toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + var(--sp-6)));
  background: var(--color-bg-elevated);
  color: var(--color-text-strong);
  border: 1px solid var(--color-border-solid);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-5);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 200ms var(--ease),
    transform 200ms var(--ease);
  z-index: 1000;
  white-space: nowrap;
}

.notepad-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
