/* ── Rephrase page styles ────────────────────────────────────────────────── */

.tr-body { background: #f8fafc; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.tr-nav {
  position: sticky; top: 0; z-index: 100;
  background: #fff; border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); height: 56px; flex-shrink: 0;
}
.tr-nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 28px; height: 100%;
  display: flex; align-items: center; gap: 12px;
}
.tr-nav-brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: inherit; flex-shrink: 0;
}
.tr-nav-logo {
  width: 32px; height: 32px; background: #eff6ff; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; color: #2563eb;
}
.tr-nav-brand-name { font-size: 14px; font-weight: 700; color: #1e293b; }
.tr-nav-tools { display: flex; margin-left: 8px; }
.tr-nav-tool {
  text-decoration: none; font-size: 13.5px; font-weight: 500; color: #6b7280;
  padding: 0 16px; height: 56px; display: flex; align-items: center;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tr-nav-tool:hover { color: #2563eb; }
.tr-nav-tool--active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.tr-nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tr-tier-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0;
  border-radius: 999px; font-size: 12px; font-weight: 600; padding: 3px 10px;
  white-space: nowrap;
}

/* ── Shared buttons ─────────────────────────────────────────────────────── */
.tr-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; padding: 9px 16px;
  transition: background .15s, box-shadow .15s, transform .15s; white-space: nowrap;
}
.tr-btn:disabled { opacity: .5; cursor: not-allowed; }
.tr-btn-primary { background: #2563eb; color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.22); }
.tr-btn-primary:hover:not(:disabled) { background: #1d4ed8; box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.tr-btn-ghost { background: #fff; color: #1a1a2e; border: 1px solid #e5e7eb; }
.tr-btn-ghost:hover:not(:disabled) { background: #f9fafb; }
.tr-btn-sm { padding: 6px 14px; font-size: 13px; }
.tr-nav-right #auth-button { border-radius: 10px; padding: 8px 16px; }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.tr-hero {
  text-align: center; padding: 44px 24px 28px;
  background: #fff; border-bottom: 1px solid #e5e7eb;
}
.tr-hero-headline {
  font-size: 40px; font-weight: 800; color: #1a1a2e;
  letter-spacing: -.02em; line-height: 1.2; margin-bottom: 10px;
}
.tr-hero-headline em { font-style: normal; color: #2563eb; }
.tr-hero-sub { font-size: 16px; color: #6b7280; }

/* ── Tone tabs bar ──────────────────────────────────────────────────────── */
.tr-tone-bar {
  background: #fff; border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 56px; z-index: 90;
}
.tr-tone-bar-inner { max-width: 1280px; margin: 0 auto; padding: 0 28px; }
.tr-tone-tabs { border-bottom: none; display: flex; flex-wrap: wrap; gap: 0; margin: 0; }
.tr-tone-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 12px 18px; font-size: 13.5px; font-weight: 500; color: #6b7280;
  cursor: pointer; font-family: inherit; white-space: nowrap;
  transition: color .15s, border-color .15s; margin-bottom: -1px;
}
.tr-tone-tab:hover { color: #1a1a2e; }
.tr-tone-tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.tr-tone-tab--more { display: none; }

/* ── Main layout ────────────────────────────────────────────────────────── */
.tr-layout {
  display: grid; grid-template-columns: 1fr 300px; gap: 24px;
  max-width: 1280px; margin: 0 auto; padding: 24px 28px 48px;
  align-items: start; flex: 1;
}
.tr-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.tr-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.tr-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.tr-card-header-left { display: flex; align-items: center; gap: 8px; }
.tr-card-header-right { display: flex; align-items: center; gap: 8px; }
.tr-panel-label { font-size: 13px; font-weight: 700; color: #1a1a2e; }
.tr-sample-btn {
  background: none; border: none; font-size: 12px; color: #2563eb;
  cursor: pointer; font-family: inherit; font-weight: 500; padding: 0;
  transition: text-decoration .1s;
}
.tr-sample-btn:hover { text-decoration: underline; }
.tr-char-counter { font-size: 12px; color: #6b7280; }
.tr-icon-btn {
  background: none; border: none; color: #9ca3af; cursor: pointer;
  padding: 4px; border-radius: 5px; display: flex; transition: all .15s;
}
.tr-icon-btn:hover { color: #6b7280; background: #f3f4f6; }

/* Textarea */
.tr-textarea {
  width: 100%; min-height: 160px; padding: 12px 14px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 14px; font-family: inherit; line-height: 1.65;
  resize: vertical; color: #1a1a2e; background: #fff;
  transition: border-color .15s;
}
.tr-textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.tr-textarea::placeholder { color: #9ca3af; }
.tr-validation-error { display: block; font-size: 12.5px; color: #dc2626; min-height: 16px; margin-top: 4px; }
.tr-input-helper { margin-top: 6px; font-size: 12px; color: #4b5563; line-height: 1.45; }

/* Rephrase button */
.tr-rephrase-btn {
  width: 100%; padding: 14px; margin-top: 4px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; border: none; border-radius: 10px;
  font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 16px rgba(37,99,235,.3);
  transition: all .2s;
}
.tr-rephrase-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 6px 22px rgba(37,99,235,.42); transform: translateY(-1px);
}
.tr-rephrase-btn:disabled { background: #93c5fd; box-shadow: none; cursor: not-allowed; }

/* Output */
.tr-output-card { margin-top: 0; }
.tr-improved-badge {
  display: inline-block; background: #d1fae5; color: #065f46;
  border: 1px solid #6ee7b7; border-radius: 4px;
  font-size: 11px; font-weight: 700; padding: 2px 8px; letter-spacing: .04em;
}
.tr-output-text {
  min-height: 100px; padding: 14px 16px;
  background: #fafbfe; border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 14px; line-height: 1.75; color: #1a1a2e;
  white-space: pre-wrap; word-break: break-word;
  margin: 12px 0 0;
}
.tr-output-text:empty::before {
  content: attr(placeholder); color: #9ca3af; font-style: italic;
}
.tr-output-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.tr-action-sep { width: 1px; height: 22px; background: #e5e7eb; margin: 0 2px; flex-shrink: 0; }
.tr-quota-pill {
  margin-left: auto; background: none; border: 1px solid #e5e7eb;
  border-radius: 999px; font-size: 11.5px; color: #6b7280;
  padding: 3px 10px; cursor: default; font-family: inherit; font-weight: 500;
}

/* ── Section wrappers ───────────────────────────────────────────────────── */
.tr-section { padding: 28px 0 0; }
.tr-section-title { font-size: 20px; font-weight: 700; color: #1a1a2e; margin-bottom: 6px; }
.tr-section-sub { font-size: 14px; color: #6b7280; margin-bottom: 20px; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.tr-sidebar {
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 112px;
}
.tr-sidebar-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.tr-sidebar-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #9ca3af; margin-bottom: 12px;
}
.tr-sidebar-empty { font-size: 12.5px; color: #9ca3af; font-style: italic; }
.tr-recent-list { display: flex; flex-direction: column; gap: 4px; }

/* Tips */
.tr-tips-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.tr-tip {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 12.5px; color: #374151; line-height: 1.4;
}
.tr-tip svg { color: #16a34a; flex-shrink: 0; margin-top: 1px; }
.tr-tip-rec {
  padding-top: 10px; border-top: 1px solid #f3f4f6;
  font-size: 11.5px; color: #9ca3af;
  display: flex; align-items: center; gap: 5px;
}
.tr-tip-rec svg { color: #2563eb; flex-shrink: 0; }
.tr-tip-rec strong { color: #374151; }

/* Quota widget */
.tr-quota-widget { padding: 14px 16px; }
.tr-quota-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tr-quota-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #9ca3af; }
.tr-quota-remaining { font-size: 12.5px; font-weight: 700; color: #2563eb; }
.tr-quota-bar-wrap { height: 5px; border-radius: 999px; background: #f3f4f6; overflow: hidden; }
.tr-quota-bar { height: 100%; border-radius: 999px; background: #2563eb; transition: width .4s ease; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.tr-footer {
  text-align: center; padding: 16px 24px; background: #fff;
  border-top: 1px solid #e5e7eb; font-size: 12px; color: #9ca3af;
  display: flex; justify-content: center; align-items: center;
  flex-wrap: wrap; gap: 4px 10px; flex-shrink: 0;
}
.tr-footer-link { color: #9ca3af; text-decoration: none; }
.tr-footer-link:hover { color: #2563eb; }
.tr-footer-sep { color: #e5e7eb; }

/* Keyboard focus visibility */
a:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid #1d4ed8;
  outline-offset: 2px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .tr-layout { grid-template-columns: 1fr 260px; padding: 20px 20px 40px; }
  .tr-tone-tab--more { display: block; }
}

@media (max-width: 860px) {
  .tr-layout { grid-template-columns: 1fr; }
  .tr-sidebar { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}

@media (max-width: 600px) {
  .tr-hero { padding: 28px 16px 20px; }
  .tr-hero-headline { font-size: 28px; }
  .tr-hero-sub { font-size: 14px; }
  .tr-layout { padding: 14px 14px 32px; gap: 12px; }
  .tr-nav-inner { padding: 0 14px; }
  .tr-nav-brand-name { display: none; }
  .tr-tone-bar-inner { padding: 0 14px; }
  .tr-sidebar { grid-template-columns: 1fr; }
}
