/* style.css — Parichay Resume Viewer */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:wght@500;600&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink: #1a1a2e;
  --ink-mid: #3d3d5c;
  --ink-soft: #8888aa;
  --paper: #f7f6f2;
  --paper-2: #eeecea;
  --paper-3: #e5e3dd;
  --gold: #c9a84c;
  --gold-lt: #f0dfa0;
  --gold-dk: #9a7830;
  --white: #ffffff;
  --danger: #e05252;
  --sidebar: 260px;
  --topbar: 52px;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(26, 26, 46, 0.1);
  --shadow-lg: 0 8px 40px rgba(26, 26, 46, 0.16);
  --ai-accent: #4f8ef7;
  --ai-light: #e8f0fe;
}

html,
body {
  height: 100%;
  width: 100%;
  font-family: "Inter", sans-serif;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar);
  min-width: var(--sidebar);
  background: var(--ink);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.sidebar-brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-brand h1 {
  font-family: "Playfair Display", serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--gold-lt);
  letter-spacing: 0.02em;
}
.sidebar-brand span {
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}

.sidebar-upload {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.upload-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  background: var(--gold);
  color: var(--ink);
  border: none;
  border-radius: var(--radius);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.18s,
    transform 0.1s;
  letter-spacing: 0.02em;
}
.upload-btn:hover {
  background: var(--gold-lt);
}
.upload-btn:active {
  transform: scale(0.97);
}

/* ── API KEY ── */
.sidebar-api {
  padding: 10px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.api-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}
.api-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.api-input {
  width: 100%;
  padding: 7px 30px 7px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  font-family: "Inter", sans-serif;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.8);
  outline: none;
  transition: border-color 0.15s;
}
.api-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}
.api-input:focus {
  border-color: var(--gold);
}
.api-eye {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}
.api-eye:hover {
  color: var(--gold);
}
.api-status {
  font-size: 10px;
  color: var(--ink-soft);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.api-status.ok {
  color: #5cb85c;
}
.api-status.err {
  color: var(--danger);
}

.sidebar-label {
  padding: 14px 16px 6px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#resume-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 16px;
}
#resume-list::-webkit-scrollbar {
  width: 4px;
}
#resume-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* ── RESUME ITEMS ── */
.resume-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  margin-bottom: 2px;
}
.resume-item:hover {
  background: rgba(255, 255, 255, 0.07);
}
.resume-item.active {
  background: rgba(201, 168, 76, 0.15);
}
.resume-item.active .ri-name {
  color: var(--gold-lt);
}
.ri-icon {
  width: 32px;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.resume-item.active .ri-icon {
  background: rgba(201, 168, 76, 0.2);
  border-color: rgba(201, 168, 76, 0.3);
}
.ri-info {
  flex: 1;
  min-width: 0;
}
.ri-name {
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.ri-meta {
  font-size: 10.5px;
  color: var(--ink-soft);
  margin-top: 1px;
  display: block;
}
.ri-delete {
  opacity: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(224, 82, 82, 0.15);
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.15s,
    background 0.15s;
  flex-shrink: 0;
}
.resume-item:hover .ri-delete {
  opacity: 1;
}
.ri-delete:hover {
  background: rgba(224, 82, 82, 0.35);
}

/* ── MAIN ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
}

/* ── TOPBAR ── */
#topbar {
  height: var(--topbar);
  background: var(--white);
  border-bottom: 1px solid var(--paper-3);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 18px;
  flex-shrink: 0;
}
#topbar-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#topbar-title span {
  color: var(--ink-soft);
  font-weight: 400;
}

/* ── VIEW TOGGLE ── */
#view-toggle {
  display: flex;
  align-items: center;
  background: var(--paper-2);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.vtoggle-btn {
  height: 26px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  font-family: "Inter", sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink-soft);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 5px;
}
.vtoggle-btn.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.vtoggle-btn svg {
  flex-shrink: 0;
}

/* ── VERSION TABS ── */
#version-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  overflow-x: auto;
  max-width: 420px;
}
#version-tabs::-webkit-scrollbar {
  height: 0;
}

.vtab {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--paper-3);
  background: var(--paper);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-mid);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.vtab:hover {
  border-color: var(--gold);
  color: var(--gold-dk);
}
.vtab.active {
  background: var(--ink);
  color: var(--gold-lt);
  border-color: var(--ink);
}

/* PDF version tab — subtle warm tint */
.vtab.vtab-pdf {
  border-color: rgba(201, 168, 76, 0.35);
}
.vtab.vtab-pdf.active {
  background: var(--ink);
  color: var(--gold-lt);
}

/* HTML/AI version tab — subtle blue tint */
.vtab.vtab-html {
  border-color: rgba(79, 142, 247, 0.3);
  color: var(--ai-accent);
}
.vtab.vtab-html:hover {
  border-color: var(--ai-accent);
  background: var(--ai-light);
}
.vtab.vtab-html.active {
  background: var(--ai-accent);
  color: #fff;
  border-color: var(--ai-accent);
}

.vtab-add {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  border: 1px dashed var(--paper-3);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.vtab-add:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.topbar-sep {
  width: 1px;
  height: 24px;
  background: var(--paper-3);
  flex-shrink: 0;
}

/* ── ZOOM ── */
#zoom-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.zoom-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--paper-3);
  background: var(--paper);
  border-radius: 5px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mid);
  transition: all 0.15s;
}
.zoom-btn:hover {
  border-color: var(--gold);
  color: var(--gold-dk);
}
#zoom-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-mid);
  min-width: 42px;
  text-align: center;
}

/* ── CONTENT ── */
#content-area {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ── LEFT PANEL (source / pdf) ── */
#pdf-panel {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: var(--paper-2);
  transition: flex 0.3s ease;
  position: relative;
}
#pdf-panel::-webkit-scrollbar {
  width: 8px;
}
#pdf-panel::-webkit-scrollbar-thumb {
  background: var(--paper-3);
  border-radius: 4px;
}

/* Panel header label strip */
.panel-label-bar {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 7px;
  background: var(--paper-3);
  border-bottom: 1px solid var(--paper-3);
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
}
.panel-label-bar .plb-version {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.panel-label-bar .plb-version.pdf-ver {
  background: rgba(201, 168, 76, 0.18);
  color: var(--gold-dk);
}
.panel-label-bar .plb-version.html-ver {
  background: rgba(79, 142, 247, 0.12);
  color: var(--ai-accent);
}
.panel-label-bar .plb-arrow {
  color: var(--ink-soft);
  opacity: 0.5;
  font-size: 13px;
}

/* The scrollable canvas area inside left panel */
#pdf-canvas-area {
  flex: 1;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 28px 80px;
  position: relative;
}
#pdf-canvas-area::-webkit-scrollbar {
  width: 8px;
}
#pdf-canvas-area::-webkit-scrollbar-thumb {
  background: var(--paper-3);
  border-radius: 4px;
}

/* Source HTML iframe inside left panel */
#source-iframe {
  width: 100%;
  flex: 1;
  border: none;
  display: none;
  background: var(--white);
}
#source-iframe.visible {
  display: block;
}

/* ── AI PANEL ── */
#ai-panel {
  width: 0;
  overflow: hidden;
  background: var(--white);
  border-left: 1px solid var(--paper-3);
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
}
#ai-panel.open {
  width: 45%;
  min-width: 500px;
}
#ai-panel-inner {
  flex: 1;
  overflow: auto;
  padding: 0;
  position: relative;
}
#ai-panel-inner::-webkit-scrollbar {
  width: 6px;
}
#ai-panel-inner::-webkit-scrollbar-thumb {
  background: var(--paper-3);
  border-radius: 4px;
}

/* ── AI IFRAME ── */
#ai-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── AI LOADING ── */
#ai-loading {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--white);
  z-index: 10;
}
#ai-loading.visible {
  display: flex;
}
.ai-spinner-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}
.ai-spinner-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--paper-3);
  border-top-color: var(--ai-accent);
  animation: spin 1s linear infinite;
  position: absolute;
  inset: 0;
}
.ai-spinner-inner {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: var(--gold);
  animation: spin 0.7s linear infinite reverse;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.ai-loading-label {
  font-family: "Playfair Display", serif;
  font-size: 15px;
  color: var(--ink-mid);
  font-weight: 500;
  text-align: center;
}
.ai-loading-sub {
  font-size: 11.5px;
  color: var(--ink-soft);
  text-align: center;
  max-width: 220px;
  line-height: 1.6;
}
.ai-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.ai-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.ai-step.done {
  color: #5cb85c;
}
.ai-step.active {
  color: var(--ai-accent);
}
.ai-step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--paper-3);
  flex-shrink: 0;
  transition: background 0.3s;
}
.ai-step.done .ai-step-dot {
  background: #5cb85c;
}
.ai-step.active .ai-step-dot {
  background: var(--ai-accent);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.5);
  }
}

/* ── FAB GROUP ── */
#fab-group {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 100;
}
#fab-group.visible {
  display: flex;
}
#fab-edit,
#fab-ai {
  position: static;
  height: 42px;
  padding: 0 18px;
  border-radius: 40px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.02em;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    opacity 0.2s;
}
#fab-edit {
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold);
  border: 1px solid rgba(201, 168, 76, 0.4);
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.1);
}
#fab-edit:hover {
  background: rgba(201, 168, 76, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(201, 168, 76, 0.22);
}
#fab-ai {
  background: linear-gradient(135deg, #4f8ef7, #3a6fd4);
  color: #fff;
  border: none;
  box-shadow: 0 4px 18px rgba(79, 142, 247, 0.4);
}
#fab-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(79, 142, 247, 0.55);
}
#fab-ai:disabled,
#fab-edit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── AI PANEL HEADER ── */
#ai-panel-header {
  height: 44px;
  border-bottom: 1px solid var(--paper-3);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  flex-shrink: 0;
  background: var(--white);
}
#ai-panel-header h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-badge {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--ai-light);
  color: var(--ai-accent);
  flex-shrink: 0;
}
.ai-close-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: var(--paper);
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: all 0.15s;
  flex-shrink: 0;
}
.ai-close-btn:hover {
  background: var(--paper-3);
  color: var(--danger);
}
.ai-regen-btn {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--paper-3);
  background: var(--paper);
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-mid);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ai-regen-btn:hover {
  border-color: var(--ai-accent);
  color: var(--ai-accent);
}

/* ── EMPTY STATE ── */
#empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
}
.es-ring {
  width: 100px;
  height: 100px;
  border: 2px dashed var(--paper-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}
.es-text {
  text-align: center;
}
.es-text h2 {
  font-family: "Playfair Display", serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--ink-mid);
  margin-bottom: 6px;
}
.es-text p {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.es-upload-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: 40px;
  font-size: 12px;
  color: var(--ink-soft);
  pointer-events: all;
  cursor: pointer;
  transition: all 0.15s;
}
.es-upload-hint:hover {
  border-color: var(--gold);
  color: var(--gold-dk);
}

/* ── DRAG OVERLAY ── */
#drag-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(201, 168, 76, 0.08);
  border: 3px dashed var(--gold);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
#drag-overlay.visible {
  display: flex;
}
#drag-overlay p {
  font-family: "Playfair Display", serif;
  font-size: 20px;
  color: var(--gold-dk);
  font-weight: 500;
}

/* ── PDF PAGES ── */
.pdf-page-wrapper {
  margin-bottom: 18px;
  background: var(--white);
  border-radius: var(--radius);
  overflow: visible;
  box-shadow: var(--shadow);
  position: relative;
  width: max-content;
}
.pdf-page-wrapper:hover {
  box-shadow: var(--shadow-lg);
}
.page-num-badge {
  position: absolute;
  bottom: 8px;
  right: 10px;
  background: rgba(26, 26, 46, 0.55);
  backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, 0.75);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  pointer-events: none;
}

/* ── PDF LOADER ── */
#pdf-loader {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
#pdf-loader.visible {
  display: flex;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--paper-3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
#pdf-loader p {
  font-size: 12px;
  color: var(--ink-soft);
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: rgba(255, 255, 255, 0.9);
  padding: 9px 18px;
  border-radius: 40px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── EDIT PANEL ── */
#edit-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 340px;
  height: 100%;
  background: var(--bg-main, #15151e);
  border-left: 1px solid #2a2a3a;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
#edit-panel.open {
  right: 0;
}
.ep-header {
  padding: 18px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ep-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #e8e8f0;
}
.ep-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #8888aa;
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.ep-close-btn:hover {
  background: #2a2a3a;
}
.ep-tabs {
  display: flex;
  margin: 14px 16px 0;
  border-bottom: 1px solid #2a2a3a;
  flex-shrink: 0;
}
.ep-tab {
  flex: 1;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 400;
  color: #8888aa;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: 0.15s;
}
.ep-tab.active {
  color: #4f8ef7;
  border-bottom-color: #4f8ef7;
  font-weight: 500;
}
.ep-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ep-body.hidden {
  display: none;
}
.ep-label {
  font-size: 11px;
  color: #8888aa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.ep-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ep-chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid #2a2a3a;
  background: #1e1e2e;
  color: #8888aa;
  cursor: pointer;
  transition: 0.12s;
  user-select: none;
}
.ep-chip:hover {
  border-color: #4f8ef7;
  color: #4f8ef7;
}
.ep-chip.selected {
  background: rgba(79, 142, 247, 0.12);
  border-color: #4f8ef7;
  color: #4f8ef7;
}
.ep-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  background: #1e1e2e;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #e8e8f0;
  font-family: inherit;
  line-height: 1.55;
}
.ep-textarea:focus {
  outline: none;
  border-color: #4f8ef7;
}
.ep-textarea::placeholder {
  color: #555577;
}
.ep-btn {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  background: #4f8ef7;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ep-btn:hover {
  background: #3d7ee6;
}
.ep-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ep-divider {
  border: none;
  border-top: 1px solid #2a2a3a;
  margin: 0;
}
.ep-hint {
  font-size: 11px;
  color: #555577;
  line-height: 1.5;
}

/* ── Download button on ALL version tabs ── */
.vtab-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 3px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  transition:
    opacity 0.15s,
    color 0.15s,
    background 0.15s;
  vertical-align: middle;
  flex-shrink: 0;
}
.vtab-download:hover {
  opacity: 1;
  color: #4f8ef7;
  background: rgba(79, 142, 247, 0.15);
}
.vtab-download:active {
  transform: scale(0.88);
}
.vtab-download.downloading {
  opacity: 1;
  color: #c9a84c;
  pointer-events: none;
  animation: dl-pulse 0.8s ease-in-out infinite alternate;
}
@keyframes dl-pulse {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 1;
  }
}
/* ── Export PDF button in AI panel header ── */
.ai-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  border: 1px solid rgba(79, 200, 130, 0.45);
  border-radius: 4px;
  color: #3db87a;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ai-export-btn:hover {
  background: rgba(79, 200, 130, 0.12);
  border-color: rgba(79, 200, 130, 0.7);
}
.ai-export-btn:active {
  transform: scale(0.96);
}
.ai-export-btn.exporting {
  opacity: 0.6;
  pointer-events: none;
  animation: dl-pulse 0.8s ease-in-out infinite alternate;
}

/* Give all tabs a little extra right-padding so the icon fits cleanly */
button.vtab {
  padding-right: 4px;
  gap: 3px;
}

/* ── Beautify tab styles ── */
.ep-beautify-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 12px 14px;
  background: linear-gradient(
    135deg,
    rgba(79, 142, 247, 0.07) 0%,
    rgba(138, 90, 220, 0.07) 100%
  );
  border: 1px solid rgba(79, 142, 247, 0.18);
  border-radius: 10px;
  margin-bottom: 14px;
  text-align: center;
}
.ep-beautify-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7 0%, #8a5adc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ep-beautify-hero h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg, #e8e8ff);
  letter-spacing: -0.01em;
}
.ep-beautify-hero p {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-soft, #8888aa);
  line-height: 1.55;
  max-width: 240px;
}
.ep-beautify-styles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.ep-style-card {
  border: 1.5px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 10px 10px 8px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
}
.ep-style-card:hover {
  border-color: rgba(79, 142, 247, 0.45);
  background: rgba(79, 142, 247, 0.06);
}
.ep-style-card.selected {
  border-color: #4f8ef7;
  background: rgba(79, 142, 247, 0.1);
}
.ep-style-card.selected::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 10px;
  color: #4f8ef7;
  font-weight: 700;
}
.ep-style-card-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg, #dde);
  margin-bottom: 3px;
}
.ep-style-card-desc {
  font-size: 10.5px;
  color: var(--ink-soft, #8888aa);
  line-height: 1.4;
}
.ep-style-swatch {
  display: flex;
  gap: 3px;
  margin-bottom: 7px;
}
.ep-style-swatch span {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.ep-beautify-options {
  margin-bottom: 14px;
}
.ep-beautify-options .ep-label {
  margin-bottom: 7px;
}
.ep-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.ep-option-row:last-child {
  border-bottom: none;
}
.ep-option-label {
  font-size: 11.5px;
  color: var(--ink-soft, #aaaacc);
}
.ep-option-toggle {
  width: 30px;
  height: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ep-option-toggle.on {
  background: #4f8ef7;
}
.ep-option-toggle::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}
.ep-option-toggle.on::after {
  transform: translateX(14px);
}
.ep-beautify-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #4f8ef7 0%, #8a5adc 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.01em;
  transition:
    opacity 0.15s,
    transform 0.1s;
  margin-bottom: 10px;
}
.ep-beautify-btn:hover {
  opacity: 0.9;
}
.ep-beautify-btn:active {
  transform: scale(0.98);
}
.ep-beautify-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ── Image attachment UI (Modify tab) ── */
.ep-img-attach-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ep-img-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 500;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: var(--ink-soft, #aaaacc);
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ep-img-attach-btn:hover {
  border-color: rgba(79, 142, 247, 0.5);
  color: #4f8ef7;
  background: rgba(79, 142, 247, 0.07);
}
.ep-img-preview-wrap {
  display: none;
  position: relative;
  flex-shrink: 0;
}
.ep-img-preview-wrap.visible {
  display: inline-flex;
}
.ep-img-preview {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: block;
}
.ep-img-remove-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e05252;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  transition:
    background 0.15s,
    transform 0.1s;
}
.ep-img-remove-btn:hover {
  background: #c03030;
  transform: scale(1.1);
}
.ep-img-error {
  font-size: 10.5px;
  color: #e05252;
  margin-bottom: 8px;
  display: none;
}
.ep-img-error.visible {
  display: block;
}