/* ── hyprint-v11.css — Print Design Studio ───────────────────────────────── */

/* ── Layout shell ─────────────────────────────────────────────────────────── */
.hp-shell {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 48px);
  overflow: hidden;
  background: var(--bg-deep, #020607);
  color: var(--text, #e2fff0);
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 13px;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.hp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg-card, rgba(6,15,9,.92));
  border-bottom: 1px solid var(--border, rgba(0,255,163,.12));
  backdrop-filter: blur(12px);
  z-index: 10;
  flex-shrink: 0;
}

.hp-toolbar-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.hp-toolbar-sep {
  width: 1px;
  height: 22px;
  background: var(--border, rgba(0,255,163,.12));
  margin: 0 4px;
  flex-shrink: 0;
}

.hp-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(0,255,163,.12));
  background: var(--bg-surface, rgba(10,25,15,.7));
  color: var(--text, #e2fff0);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
  line-height: 1;
  user-select: none;
}
.hp-btn:hover {
  background: rgba(0,255,163,.1);
  border-color: var(--accent);
}
.hp-btn:active { transform: scale(.96); }
.hp-btn iconify-icon { font-size: 14px; }

.hp-btn-primary {
  background: var(--accent);
  color: #020607;
  border-color: var(--accent);
  font-weight: 600;
}
.hp-btn-primary:hover { background: #00d488; border-color: #00d488; }

.hp-btn-blue {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
  font-weight: 600;
}
.hp-btn-blue:hover { background: #2563eb; border-color: #2563eb; }

.hp-btn-ai {
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
  border-color: #7c3aed;
  font-weight: 600;
}
.hp-btn-ai:hover { opacity: .9; }

.hp-btn-danger {
  background: rgba(239,68,68,.15);
  color: #ef4444;
  border-color: rgba(239,68,68,.3);
}
.hp-btn-danger:hover { background: rgba(239,68,68,.25); }

.hp-btn-icon {
  padding: 5px 7px;
}

.hp-btn-sm {
  padding: 3px 7px;
  font-size: 11px;
}

.hp-btn-active {
  background: rgba(0,255,163,.15) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* Preset selector */
.hp-preset-select {
  padding: 4px 8px;
  background: var(--bg-surface, rgba(10,25,15,.7));
  border: 1px solid var(--border, rgba(0,255,163,.12));
  border-radius: 6px;
  color: var(--text, #e2fff0);
  font-size: 12px;
  cursor: pointer;
  max-width: 200px;
}
.hp-preset-select:focus { outline: none; border-color: #3b82f6; }

/* Canvas size display */
.hp-size-label {
  font-size: 11px;
  color: var(--muted, rgba(180,255,220,.5));
  padding: 4px 8px;
  white-space: nowrap;
}

/* ── Main body (sidebar + canvas + properties) ──────────────────────────────── */
.hp-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Left sidebar — templates ───────────────────────────────────────────────── */
.hp-sidebar {
  width: 180px;
  min-width: 140px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, rgba(6,15,9,.92));
  border-right: 1px solid var(--border, rgba(0,255,163,.12));
  overflow: hidden;
}

.hp-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, rgba(0,255,163,.12));
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted, rgba(180,255,220,.5));
  flex-shrink: 0;
}

.hp-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hp-sidebar-list::-webkit-scrollbar { width: 4px; }
.hp-sidebar-list::-webkit-scrollbar-track { background: transparent; }
.hp-sidebar-list::-webkit-scrollbar-thumb { background: var(--border, rgba(0,255,163,.15)); border-radius: 2px; }

.hp-template-card {
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(0,255,163,.1));
  background: var(--bg-surface, rgba(10,25,15,.5));
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hp-template-card:hover { background: rgba(0,255,163,.08); border-color: rgba(0,255,163,.25); }
.hp-template-card.active { background: rgba(59,130,246,.15); border-color: #3b82f6; }

.hp-template-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text, #e2fff0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-template-size {
  font-size: 10px;
  color: var(--muted, rgba(180,255,220,.5));
}

.hp-template-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.hp-no-templates {
  padding: 20px 10px;
  text-align: center;
  color: var(--muted, rgba(180,255,220,.4));
  font-size: 12px;
  line-height: 1.5;
}

/* ── Canvas area ──────────────────────────────────────────────────────────── */
.hp-canvas-area {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(0,255,163,.04) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(59,130,246,.04) 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(0,255,163,.03) 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0,255,163,.03) 20px),
    var(--bg-deep, #020607);
  position: relative;
  overflow: auto;
}

.hp-canvas-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  min-height: 100%;
  padding: 24px;
  box-sizing: border-box;
}

/* Paper shadow wrapping the Fabric canvas */
.hp-paper-shadow {
  position: relative;
  box-shadow:
    0 2px 8px rgba(0,0,0,.4),
    0 8px 32px rgba(0,0,0,.5),
    0 0 0 1px rgba(0,0,0,.3);
  flex-shrink: 0;
}

/* Guide overlays — positioned over paper */
.hp-guide-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 5;
}

.hp-guide-bleed {
  position: absolute;
  border: 2px dashed rgba(239,68,68,.6);
  pointer-events: none;
}

.hp-guide-safe {
  position: absolute;
  border: 1px dashed rgba(59,130,246,.5);
  pointer-events: none;
}

/* Guide legend */
.hp-guide-legend {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
  z-index: 6;
}
.hp-guide-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: rgba(255,255,255,.6);
  background: rgba(0,0,0,.5);
  padding: 2px 5px;
  border-radius: 3px;
}
.hp-legend-line {
  width: 14px; height: 2px;
}
.hp-legend-line.bleed { background: rgba(239,68,68,.8); }
.hp-legend-line.safe  { background: rgba(59,130,246,.8); }

/* ── Right properties panel ────────────────────────────────────────────────── */
.hp-props {
  width: 220px;
  min-width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, rgba(6,15,9,.92));
  border-left: 1px solid var(--border, rgba(0,255,163,.12));
  overflow: hidden;
}

.hp-props-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, rgba(0,255,163,.12));
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted, rgba(180,255,220,.5));
  flex-shrink: 0;
}

.hp-props-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hp-props-body::-webkit-scrollbar { width: 4px; }
.hp-props-body::-webkit-scrollbar-track { background: transparent; }
.hp-props-body::-webkit-scrollbar-thumb { background: var(--border, rgba(0,255,163,.15)); border-radius: 2px; }

.hp-prop-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hp-prop-group-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted, rgba(180,255,220,.5));
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border, rgba(0,255,163,.08));
}

.hp-prop-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hp-prop-label {
  font-size: 11px;
  color: var(--muted, rgba(180,255,220,.6));
  min-width: 30px;
  flex-shrink: 0;
}

.hp-prop-label-full {
  font-size: 11px;
  color: var(--muted, rgba(180,255,220,.6));
  margin-bottom: 3px;
}

.hp-input {
  flex: 1;
  padding: 4px 7px;
  background: var(--bg-surface, rgba(10,25,15,.6));
  border: 1px solid var(--border, rgba(0,255,163,.12));
  border-radius: 5px;
  color: var(--text, #e2fff0);
  font-size: 12px;
  min-width: 0;
}
.hp-input:focus { outline: none; border-color: #3b82f6; }
.hp-input[type="number"] { -moz-appearance: textfield; }
.hp-input[type="number"]::-webkit-outer-spin-button,
.hp-input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.hp-input-full {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px;
  background: var(--bg-surface, rgba(10,25,15,.6));
  border: 1px solid var(--border, rgba(0,255,163,.12));
  border-radius: 5px;
  color: var(--text, #e2fff0);
  font-size: 12px;
}
.hp-input-full:focus { outline: none; border-color: #3b82f6; }

.hp-color-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hp-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border, rgba(0,255,163,.2));
  cursor: pointer;
  flex-shrink: 0;
}

.hp-color-input {
  width: 44px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border, rgba(0,255,163,.12));
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

.hp-select {
  flex: 1;
  padding: 4px 6px;
  background: var(--bg-surface, rgba(10,25,15,.6));
  border: 1px solid var(--border, rgba(0,255,163,.12));
  border-radius: 5px;
  color: var(--text, #e2fff0);
  font-size: 12px;
  cursor: pointer;
  min-width: 0;
}
.hp-select:focus { outline: none; border-color: #3b82f6; }

.hp-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 3px;
  background: var(--border, rgba(0,255,163,.15));
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.hp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.hp-slider-val {
  font-size: 11px;
  color: var(--muted, rgba(180,255,220,.6));
  min-width: 28px;
  text-align: right;
}

.hp-font-btn-row {
  display: flex;
  gap: 4px;
}

.hp-font-btn {
  flex: 1;
  padding: 4px;
  text-align: center;
  background: var(--bg-surface, rgba(10,25,15,.6));
  border: 1px solid var(--border, rgba(0,255,163,.12));
  border-radius: 4px;
  color: var(--text, #e2fff0);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}
.hp-font-btn:hover { background: rgba(0,255,163,.1); }
.hp-font-btn.active { background: rgba(59,130,246,.2); border-color: #3b82f6; }

.hp-no-selection {
  padding: 24px 10px;
  text-align: center;
  color: var(--muted, rgba(180,255,220,.35));
  font-size: 12px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.hp-no-selection iconify-icon { font-size: 28px; opacity: .35; }

.hp-prop-divider {
  height: 1px;
  background: var(--border, rgba(0,255,163,.08));
  margin: 4px 0;
}

/* ── Slide-in panels (AI image, AI layout) ───────────────────────────────── */
.hp-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 900;
  display: none;
}
.hp-panel-overlay.open { display: block; }

.hp-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 95vw;
  background: var(--bg-card, rgba(6,15,9,.97));
  border-left: 1px solid var(--border, rgba(0,255,163,.15));
  backdrop-filter: blur(20px);
  z-index: 901;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.16,1,.3,1);
}
.hp-panel.open { transform: translateX(0); }

.hp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, rgba(0,255,163,.12));
  flex-shrink: 0;
}
.hp-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #e2fff0);
}
.hp-panel-subtitle {
  font-size: 11px;
  color: var(--muted, rgba(180,255,220,.5));
  margin-top: 2px;
}

.hp-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hp-panel-body::-webkit-scrollbar { width: 4px; }
.hp-panel-body::-webkit-scrollbar-track { background: transparent; }
.hp-panel-body::-webkit-scrollbar-thumb { background: var(--border, rgba(0,255,163,.15)); border-radius: 2px; }

.hp-panel-label {
  font-size: 12px;
  color: var(--muted, rgba(180,255,220,.7));
  margin-bottom: 4px;
  font-weight: 500;
}

.hp-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  background: var(--bg-surface, rgba(10,25,15,.6));
  border: 1px solid var(--border, rgba(0,255,163,.15));
  border-radius: 8px;
  color: var(--text, #e2fff0);
  font-size: 13px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}
.hp-textarea:focus { outline: none; border-color: #7c3aed; }

.hp-ai-generate-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.hp-ai-generate-btn:hover { opacity: .9; }
.hp-ai-generate-btn:active { opacity: .8; }
.hp-ai-generate-btn:disabled { opacity: .5; cursor: not-allowed; }

.hp-ai-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}

.hp-ai-result-img {
  width: 110px;
  height: 74px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s, transform .15s;
}
.hp-ai-result-img:hover { border-color: #3b82f6; transform: scale(1.04); }

.hp-layout-suggestion {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--bg-surface, rgba(10,25,15,.5));
  border: 1px solid var(--border, rgba(0,255,163,.1));
  border-radius: 6px;
}
.hp-suggestion-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #3b82f6;
}
.hp-suggestion-text {
  font-size: 12px;
  color: var(--text, #e2fff0);
  line-height: 1.4;
}
.hp-suggestion-meta {
  font-size: 10px;
  color: var(--muted, rgba(180,255,220,.5));
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Add All button */
.hp-add-all-btn {
  width: 100%;
  padding: 9px;
  border-radius: 7px;
  background: rgba(59,130,246,.15);
  border: 1px solid #3b82f6;
  color: #3b82f6;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.hp-add-all-btn:hover { background: rgba(59,130,246,.25); }

/* ── Toast notifications ──────────────────────────────────────────────────── */
#hp-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.hp-toast {
  padding: 9px 18px;
  border-radius: 8px;
  background: var(--bg-card, rgba(6,15,9,.95));
  border: 1px solid var(--border, rgba(0,255,163,.2));
  color: var(--text, #e2fff0);
  font-size: 13px;
  backdrop-filter: blur(12px);
  animation: hp-toast-in .25s ease;
  pointer-events: none;
  white-space: nowrap;
}
.hp-toast.error { border-color: rgba(239,68,68,.4); color: #fca5a5; }
.hp-toast.success { border-color: rgba(0,255,163,.3); }

@keyframes hp-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading overlay ──────────────────────────────────────────────────────── */
#hp-loading {
  position: fixed;
  inset: 0;
  background: rgba(2,6,7,.7);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(4px);
}
#hp-loading.visible { display: flex; }
.hp-loading-ring {
  width: 44px; height: 44px;
  border: 3px solid rgba(0,255,163,.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: hp-spin 1s linear infinite;
}
.hp-loading-text { font-size: 14px; color: var(--muted, rgba(180,255,220,.7)); }
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* ── Custom size modal ───────────────────────────────────────────────────────── */
.hp-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 950;
  display: none;
  align-items: center;
  justify-content: center;
}
.hp-modal-bg.open { display: flex; }
.hp-modal {
  background: var(--bg-card, rgba(6,15,9,.97));
  border: 1px solid var(--border, rgba(0,255,163,.15));
  border-radius: 14px;
  padding: 20px 24px;
  min-width: 300px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(20px);
}
.hp-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #e2fff0);
}
.hp-modal-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hp-modal-label { font-size: 12px; color: var(--muted, rgba(180,255,220,.6)); min-width: 70px; }
.hp-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Zoom indicator ───────────────────────────────────────────────────────── */
.hp-zoom-indicator {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 11px;
  color: var(--muted, rgba(180,255,220,.4));
  background: rgba(2,6,7,.6);
  padding: 3px 7px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}

/* ── Responsive tweaks ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hp-sidebar { display: none; }
  .hp-props { width: 180px; }
}

@media (max-width: 640px) {
  .hp-props { display: none; }
  .hp-toolbar { gap: 2px; }
  .hp-btn { padding: 4px 7px; font-size: 11px; }
  .hp-btn span { display: none; }
}
