/* ==========================================================================
   serat awra — Auth Modal & Drawer Account UI (Tahap 2)
   Semua token (--paper, --accent, --ink-*, --font-*) merujuk ke style.css.
   ========================================================================== */

/* ── Auth Modal backdrop ───────────────────────────────────────────────────── */
.auth-modal-backdrop {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 420;
  background: var(--backdrop);
  padding: 1rem;
}

.auth-modal-backdrop[hidden] {
  display: none;
}

/* ── Modal frame ───────────────────────────────────────────────────────────── */
.auth-modal-frame {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border: 1px solid var(--paper-border);
  border-radius: 2px;
  box-shadow: var(--shadow-deep);
}

.auth-modal-paper {
  padding: 2rem 2rem 1.5rem;
}

/* ── Modal header ──────────────────────────────────────────────────────────── */
.auth-modal-header {
  margin-bottom: 1.5rem;
}

.auth-modal-header .eyebrow {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth-modal-header h2 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--ink-deep);
  line-height: 1.25;
  margin: 0;
}

/* ── Tab bar ───────────────────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--paper-border);
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.6rem 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
  margin-bottom: -1px;
}

.auth-tab:hover {
  color: var(--ink-body);
}

.auth-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.auth-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Error banner dalam form ───────────────────────────────────────────────── */
.auth-form-error {
  padding: 0.65rem 0.875rem;
  margin-bottom: 1rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #7a1a1a;
  background: #fdf0f0;
  border: 1px solid #e8c4c4;
  border-radius: 2px;
}

:root[data-theme="dark"] .auth-form-error {
  color: #f4b8b8;
  background: rgba(140, 60, 60, 0.18);
  border-color: rgba(200, 100, 100, 0.3);
}

/* ── Field hint (teks panduan di bawah input) ──────────────────────────────── */
.field-hint {
  margin: 0.3rem 0 0;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* ── Password wrap + toggle ────────────────────────────────────────────────── */
.password-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.password-wrap input {
  flex: 1;
  padding-right: 6rem !important; /* ruang untuk tombol */
}

.password-toggle-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  padding: 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  border-left: 1px solid var(--paper-border);
  cursor: pointer;
  border-radius: 0 2px 2px 0;
  transition: background 0.12s;
}

.password-toggle-btn:hover {
  background: var(--paper-warm);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Form actions (dalam modal auth) ──────────────────────────────────────── */
.auth-form-actions {
  margin-top: 1.25rem;
}

/* ── Link switch "Daftar sekarang" / "Masuk di sini" ──────────────────────── */
.auth-switch-note {
  margin-top: 1rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  text-align: center;
}

.auth-switch-note .text-action-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

.auth-switch-note .text-action-link:hover {
  text-decoration-color: var(--accent);
}

/* ── Disclaimer bawah modal ────────────────────────────────────────────────── */
.auth-disclaimer {
  margin-top: 1.5rem;
  padding: 0.75rem 0.875rem;
  border-top: 1px solid var(--paper-border);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.auth-disclaimer p { margin: 0; }

/* ── Drawer: auth card ─────────────────────────────────────────────────────── */
.drawer-auth-card {
  /* Mewarisi .drawer-card — hanya tambah spacing dalam */
}

.drawer-auth-note {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink-muted);
  margin: 0 0 0.875rem;
}

.drawer-auth-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drawer-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drawer-user-welcome {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--ink-body);
  margin: 0;
}

.drawer-user-welcome strong {
  color: var(--accent);
}

/* ── Dark theme overrides ──────────────────────────────────────────────────── */
:root[data-theme="dark"] .auth-modal-header h2 {
  color: var(--ink-deep);
}

:root[data-theme="dark"] .auth-modal-frame {
  background: var(--paper);
  border-color: var(--paper-border);
}

/* ── Responsive: layar kecil ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-modal-frame {
    max-width: 100%;
    border-radius: 4px 4px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92dvh;
  }

  .auth-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .auth-modal-paper {
    padding: 1.5rem 1.25rem 2rem;
  }
}

/* ==========================================================================
   serat awra — Revision Trigger, Panel & Modal (Tahap 3)
   ========================================================================== */

/* ── Trigger Bar under section 6 ─────────────────────────────────────────── */
.revision-trigger-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.875rem 1rem;
  background: var(--paper-subtle);
  border: 1px solid var(--paper-border);
  border-radius: 2px;
}

.revision-trigger-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.revision-trigger-info .fact-label {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.revision-trigger-info .small-note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.btn-revision-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Revision History Panel ──────────────────────────────────────────────── */
.revision-history-panel {
  margin-top: 1rem;
  border: 1px solid var(--paper-border);
  border-radius: 2px;
  background: var(--paper);
  overflow: hidden;
}

.revision-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.875rem;
  background: var(--paper-subtle);
  border-bottom: 1px solid var(--paper-border);
}

.revision-history-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-deep);
}

.revision-history-title {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--ink-deep);
}

.revision-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  line-height: 1;
}

.revision-badge.is-zero {
  background: var(--paper-border);
  color: var(--ink-muted);
}

.btn-icon-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.btn-icon-subtle:hover {
  color: var(--ink-deep);
  background: var(--paper-border);
}

.btn-icon-subtle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.revision-list-container {
  padding: 0.75rem 0.875rem;
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.revision-empty-state {
  margin: 0;
  padding: 1.25rem 0.5rem;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* ── Revision Items in History ───────────────────────────────────────────── */
.revision-item {
  padding: 0.75rem;
  border: 1px solid var(--paper-border);
  border-radius: 2px;
  background: var(--paper);
  margin-bottom: 0.65rem;
  transition: border-color 0.15s var(--ease);
}

.revision-item:last-child {
  margin-bottom: 0;
}

.revision-item:hover {
  border-color: var(--accent);
}

.revision-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.revision-field-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  background: var(--paper-subtle);
  border: 1px solid var(--paper-border);
  border-radius: 2px;
  color: var(--accent);
  text-transform: capitalize;
}

.revision-item-meta {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.revision-author {
  font-weight: 500;
  color: var(--ink-body);
}

.revision-reason-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ink-body);
  margin: 0.35rem 0 0.5rem 0;
  padding-left: 0.6rem;
  border-left: 2px solid var(--accent);
}

.revision-diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
}

.revision-diff-col {
  padding: 0.4rem 0.5rem;
  border-radius: 2px;
  background: var(--paper-subtle);
  border: 1px solid var(--paper-border);
  overflow-wrap: break-word;
}

.revision-diff-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
  color: var(--ink-muted);
}

.revision-diff-old .revision-diff-val {
  color: var(--ink-muted);
  text-decoration: line-through;
}

.revision-diff-new .revision-diff-val {
  color: var(--ink-deep);
  font-weight: 500;
}

.revision-status-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: #fff8e1;
  color: #b78103;
  border: 1px solid #ffe082;
  margin-top: 0.4rem;
}

:root[data-theme="dark"] .revision-status-tag {
  background: #3e2723;
  color: #ffb74d;
  border-color: #5d4037;
}

/* ── Revision Modal Specifics ────────────────────────────────────────────── */
.revision-modal-frame {
  max-width: 520px;
}

.revision-modal-subtitle {
  margin: 0.35rem 0 0 0;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.revision-modal-subtitle strong {
  color: var(--ink-deep);
}

.rev-old-preview {
  padding: 0.5rem 0.65rem;
  background: var(--paper-subtle);
  border: 1px solid var(--paper-border);
  border-radius: 2px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ink-muted);
  max-height: 100px;
  overflow-y: auto;
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
}

.field-hint-row {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.revision-disclaimer {
  margin: 1rem 0;
  padding: 0.65rem 0.75rem;
  background: var(--paper-subtle);
  border-left: 2px solid var(--accent);
  border-radius: 0 2px 2px 0;
}

.revision-disclaimer p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

.revision-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

@media (max-width: 480px) {
  .revision-trigger-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .btn-revision-action {
    justify-content: center;
  }

  .revision-diff-grid {
    grid-template-columns: 1fr;
  }

  .revision-modal-actions {
    flex-direction: column-reverse;
  }

  .revision-modal-actions button {
    width: 100%;
    justify-content: center;
  }

  .memory-tabs-nav {
    flex-direction: column;
  }

  .memory-tab-btn {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Tahap 4: Tab Ingatan Komunitas & Personal Memory Tabs
   ========================================================================== */

.memory-tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--paper-border);
  padding-bottom: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.memory-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--paper-border);
  background: var(--paper-subtle);
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.memory-tab-btn:hover {
  background: var(--sand, rgba(0, 0, 0, 0.04));
  color: var(--ink-deep);
  border-color: var(--ink-muted);
}

.memory-tab-btn.active,
.memory-tab-btn[aria-selected="true"] {
  background: var(--paper);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.community-memory-box {
  margin-top: 0;
}

.community-memory-compose-form {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--paper-border);
}

.community-form-header {
  margin-bottom: 0.4rem;
}

.community-form-header label {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--ink-body);
}

.community-compose-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.6rem;
}

.community-login-prompt {
  padding: 1rem;
  background: var(--paper-subtle);
  border: 1px solid var(--paper-border);
  border-radius: 2px;
  text-align: center;
  margin-bottom: 1rem;
}

.community-login-text {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
}

.community-memories-archive {
  margin-top: 0.5rem;
}

.community-memories-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.community-memories-title {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-deep);
  margin: 0;
}

.community-memories-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.community-memory-item {
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--paper-border);
  border-radius: 2px;
  background: var(--paper);
  border-left: 3px solid var(--accent);
  transition: all 0.15s ease;
}

.community-memory-item:hover {
  border-color: var(--ink-muted);
  border-left-color: var(--accent);
}

.community-memory-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.community-memory-author {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

.community-memory-date {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  color: var(--ink-muted);
}

.community-memory-body {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink-body);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Email OTP & Password Recovery Styles ────────────────────────────────── */
.auth-panel-hint {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-muted);
  margin: 0 0 1.25rem 0;
}

.auth-panel-hint strong {
  color: var(--ink-deep);
  word-break: break-all;
}

.auth-otp-wrap {
  margin: 1.25rem 0;
}

.auth-otp-input {
  font-family: var(--font-mono, monospace);
  font-size: 1.75rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.35em !important;
  text-align: center !important;
  padding: 0.75rem 0.5rem !important;
  color: var(--ink-deep) !important;
  background: var(--paper-subtle) !important;
  border: 1px solid var(--paper-border) !important;
  border-radius: 2px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.auth-otp-input:focus {
  border-color: var(--accent) !important;
  outline: 2px solid var(--accent) !important;
  outline-offset: 1px !important;
}

.auth-otp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.auth-countdown {
  font-family: var(--font-mono, monospace);
  color: var(--ink-muted);
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.auth-countdown.is-expiring {
  color: #a83232;
  font-weight: 600;
}

.auth-resend-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  transition: opacity 0.15s ease;
}

.auth-resend-btn:disabled {
  color: var(--ink-muted);
  text-decoration: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.auth-forgot-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
}

.auth-info-banner {
  background: var(--paper-subtle);
  border: 1px solid var(--paper-border);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 2px;
  font-size: 0.8125rem;
  color: var(--ink-body);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.auth-success-message {
  color: #2b6e3f;
  background: #f0f7f2;
  border: 1px solid #c3e2cb;
  padding: 0.75rem 1rem;
  border-radius: 2px;
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.drawer-user-meta {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

.drawer-action-links {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.drawer-action-link {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

