@import url("/letterhead-generator/assets/css/letterhead-studio.v1.0.0.css");

:root {
  --brand: #155e75;
  --brand-dark: #164e63;
  --navy: #172b3a;
  --letter-blue: #e8f4f7;
}

.studio-header { grid-template-columns: 210px minmax(190px, 1fr) auto auto; }
.studio-shell { grid-template-columns: 280px minmax(520px, 1fr) 390px; }
.canvas-stage { min-height: 760px; }
.canvas-paper::after { border-color: rgba(21, 94, 117, .44); }
.inspector-panel { padding-bottom: 46px; }
.header-links { gap: 13px; }
.header-links a { font-size: .72rem; }

.library-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 12px 0; padding: 4px; border-radius: 10px; background: #edf2f5; }
.library-tabs button { min-height: 34px; border: 0; border-radius: 7px; color: #647282; background: transparent; font-size: .73rem; font-weight: 800; }
.library-tabs button.is-active { color: var(--brand-dark); background: #fff; box-shadow: 0 1px 4px rgba(20, 39, 56, .12); }
.letter-type-list { display: grid; gap: 7px; padding-bottom: 22px; }
.letter-type-card { width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px; border: 1px solid #dbe3e9; border-radius: 11px; color: #253847; background: #fff; text-align: left; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.letter-type-card:hover { transform: translateY(-1px); border-color: #9fb2c0; box-shadow: var(--small-shadow); }
.letter-type-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(21, 94, 117, .13); }
.letter-type-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--brand-dark); background: var(--letter-blue); font-size: .68rem; font-weight: 900; letter-spacing: .02em; }
.letter-type-card strong, .letter-type-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.letter-type-card strong { font-size: .75rem; }
.letter-type-card small { margin-top: 2px; color: var(--muted); font-size: .62rem; }
.letter-type-card > span:last-child { color: #8a98a6; font-size: 1rem; }
.library-empty { padding: 26px 10px; color: var(--muted); text-align: center; font-size: .8rem; }

.template-card canvas { aspect-ratio: 1 / 1.414; }
.template-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-button { flex: 0 0 auto; }
.page-indicator { min-width: 55px; height: 32px; padding: 0 8px; border: 1px solid #d5dee7; border-radius: 7px; color: #475467; background: #fff; font-size: .7rem; font-weight: 800; }
.page-indicator:hover, .zoom-value:hover { border-color: #9fb0c0; }
.toolbar-group select#letterFormat { max-width: 125px; }

.format-toolbar { display: flex; gap: 5px; margin-top: 14px; padding: 6px; border: 1px solid #dce4ea; border-radius: 10px; background: #f8fafb; }
.format-toolbar button { min-width: 36px; height: 32px; padding: 0 8px; border: 0; border-radius: 7px; color: #5a6876; background: transparent; font-size: .75rem; font-weight: 850; }
.format-toolbar button:hover, .format-toolbar button.is-active { color: var(--brand-dark); background: #e6f2f5; }
.field-help { margin: -4px 0 12px; color: #768493; font-size: .66rem; line-height: 1.45; }
.field textarea#letterBody { min-height: 260px; font-family: inherit; }
.field > span b#wordCount { color: #667085; font-weight: 700; }
.research-card { margin-top: 18px; padding: 14px; border-left: 4px solid #c9811e; border-radius: 10px; color: #65410f; background: #fff8e9; }
.research-card strong { display: block; font-size: .76rem; }
.research-card p { margin: 4px 0 0; font-size: .7rem; }
.upload-row { margin-bottom: 11px; }

.preview-pages { max-height: 68vh; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; gap: 22px; padding: 24px; overflow: auto; background: #e9eef3; }
.preview-page { display: grid; gap: 7px; justify-items: center; }
.preview-page canvas { display: block; width: 100%; height: auto; background: #fff; box-shadow: var(--shadow); }
.preview-page span { color: #526170; font-size: .69rem; font-weight: 800; }
.format-zip { color: #fff; background: #7c3f95; }

.guide-hero { background: linear-gradient(135deg, #f0f8fa, #f8fafc 54%, #fff7e8); }
.answer-grid article > span { color: var(--brand-dark); background: var(--letter-blue); }
.responsible-note { background: #eef7f8; }

@media (max-width: 1440px) {
  .studio-header { grid-template-columns: 200px minmax(170px, 1fr) auto; }
  .header-links { display: none; }
  .studio-shell { grid-template-columns: 245px minmax(480px, 1fr) 355px; }
}

@media (max-width: 1160px) {
  .studio-shell { grid-template-columns: 225px minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; max-height: none; position: static; border-top: 1px solid var(--line); border-left: 0; }
  .inspector-body { height: auto; max-height: 780px; }
  .inspector-panel { max-width: 820px; margin: 0 auto; }
  .canvas-stage { min-height: 660px; }
}

@media (max-width: 760px) {
  .studio-header { grid-template-columns: 152px minmax(0, 1fr); }
  .studio-shell { display: block; }
  .template-sidebar { padding-bottom: 12px; }
  .letter-type-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .letter-type-card { grid-template-columns: 31px minmax(0, 1fr); padding: 8px; }
  .letter-type-card > span:last-child { display: none; }
  .letter-type-card:nth-child(n+9) { display: none; }
  .canvas-stage { min-height: 520px; }
  .canvas-toolbar { grid-template-columns: 1fr auto; }
  .toolbar-group:first-child { gap: 5px; }
  .toolbar-group:first-child > label { display: none; }
  .toolbar-group select { max-width: 105px; padding-right: 21px; }
  .toolbar-group select#letterFormat { max-width: 112px; }
  .toolbar-end .toolbar-check, .toolbar-end #zoomOutButton, .toolbar-end #zoomInButton, .toolbar-end #fitButton { display: none; }
  .preview-pages { grid-template-columns: 1fr; padding: 17px; }
}

@media (max-width: 520px) {
  .letter-type-list { grid-template-columns: 1fr; }
  .letter-type-card:nth-child(n+7) { display: none; }
  .canvas-toolbar { display: flex; }
  .toolbar-group:first-child select#letterFormat { max-width: 96px; }
  .page-indicator { min-width: 48px; }
}

@media print {
  .preview-pages { display: block; }
}
