/* ════════════════════════════════════════════
   PRINTCRAFT – designer.css
   ════════════════════════════════════════════ */

.designer-body {
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gray-100);
}

/* ─── Top Bar ────────────────────────────────── */
.designer-topbar {
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  gap: 1rem;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  z-index: 100;
}
.designer-topbar__left,
.designer-topbar__center,
.designer-topbar__right { display: flex; align-items: center; gap: .4rem; }
.designer-topbar__left { flex: 0 0 auto; }
.designer-topbar__center { flex: 1; justify-content: center; }
.designer-topbar__right { flex: 0 0 auto; gap: .6rem; }

.designer-logo { display: flex; align-items: center; margin-right: .5rem; flex-shrink: 0; }

.designer-filename {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--gray-500);
  font-size: .85rem;
}
.designer-filename__input {
  border: none;
  outline: none;
  font-size: .95rem;
  font-weight: 600;
  color: var(--gray-900);
  width: 160px;
  padding: .25rem .4rem;
  border-radius: 4px;
  transition: background var(--transition);
}
.designer-filename__input:focus { background: var(--gray-100); }

/* Toolbar buttons */
.tb-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  font-size: .9rem;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.tb-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.tb-btn:disabled { opacity: .35; pointer-events: none; }
.tb-sep { width: 1px; height: 24px; background: var(--gray-200); margin: 0 .2rem; }
.tb-zoom {
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-700);
  min-width: 42px;
  text-align: center;
}

/* Download group */
.download-group { display: flex; position: relative; }
.download-group .btn--primary { border-radius: 6px 0 0 6px; }
.download-arrow { border-radius: 0 6px 6px 0; border-left: 1px solid rgba(255,255,255,.3); }
.download-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 500;
  display: none;
  overflow: hidden;
}
.download-dropdown.open { display: block; }
.download-dropdown button {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .65rem 1rem;
  font-size: .87rem;
  color: var(--gray-700);
  text-align: left;
  transition: background var(--transition);
}
.download-dropdown button:hover { background: var(--gray-50); }
.download-dropdown button i { width: 16px; color: var(--gray-500); }
.dropdown-sep { height: 1px; background: var(--gray-200); margin: .25rem 0; }
.dropdown-primary { color: var(--red) !important; font-weight: 600; }
.dropdown-primary i { color: var(--red) !important; }

/* ─── Main Layout ─────────────────────────────── */
.designer-main {
  flex: 1;
  display: grid;
  grid-template-columns: 56px 280px 1fr 260px;
  overflow: hidden;
}

/* designer-left spans the first 2 columns (tabs + panel) */
.designer-left {
  grid-column: span 2;
}

/* ─── Left Panel ──────────────────────────────── */
.left-tabs {
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .5rem 0;
  gap: .2rem;
}
.left-tab {
  width: 48px;
  height: 54px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--gray-500);
  font-size: .75rem;
  transition: all var(--transition);
  padding: 0 4px;
}
.left-tab i    { font-size: 1rem; }
.left-tab span { font-size: .6rem; text-align: center; line-height: 1.1; }
.left-tab:hover { background: var(--gray-100); color: var(--gray-800); }
.left-tab.active { background: #ffe3e3; color: var(--red); }

.designer-left {
  display: grid;
  grid-template-columns: 56px 1fr;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  overflow: hidden;
}

.left-panel {
  display: none;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
.left-panel.active { display: flex; }

.panel-header {
  padding: 1rem 1rem .75rem;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.panel-header h3 { font-size: .95rem; font-weight: 700; margin-bottom: .5rem; }
.panel-search {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--gray-100);
  border-radius: 6px;
  padding: .35rem .6rem;
  font-size: .8rem;
  color: var(--gray-500);
}
.panel-search input {
  background: none;
  border: none;
  outline: none;
  font-size: .82rem;
  width: 100%;
}

.panel-sub { padding: .75rem 1rem; }
.panel-sub h4 { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-500); margin-bottom: .5rem; }

/* Templates */
.template-cats {
  display: flex;
  gap: .35rem;
  padding: .6rem .75rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.template-cats::-webkit-scrollbar { display: none; }
.tcat {
  padding: .3rem .7rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
  white-space: nowrap;
  transition: all var(--transition);
}
.tcat.active, .tcat:hover { background: var(--red); color: var(--white); border-color: var(--red); }

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  padding: .75rem;
}
.template-thumb {
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--gray-200);
  cursor: pointer;
  transition: all var(--transition);
  aspect-ratio: 16/10;
  position: relative;
}
.template-thumb:hover { border-color: var(--red); box-shadow: 0 4px 12px rgba(230,57,70,.2); }
.template-thumb img { width: 100%; height: 100%; object-fit: cover; }
.template-thumb__label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
  color: var(--white);
  font-size: .65rem;
  font-weight: 600;
  padding: .4rem .4rem .3rem;
}

/* Elements */
.elements-section { padding: .75rem; }
.elements-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .4rem;
  margin-bottom: .75rem;
}
.icon-grid .el-btn { font-size: .9rem; color: var(--gray-700); }
.el-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1.5px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  color: var(--gray-700);
  transition: all var(--transition);
  font-size: .75rem;
}
.el-btn svg { width: 70%; height: 70%; }
.el-btn:hover { border-color: var(--red); color: var(--red); background: #ffe3e3; }

/* Text */
.text-styles { padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.text-style-btn {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  text-align: left;
  padding: .75rem;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  transition: all var(--transition);
}
.text-style-btn:hover { border-color: var(--red); background: #ffe3e3; }
.text-style-btn small { font-size: .7rem; color: var(--gray-500); }

.font-list { display: flex; flex-direction: column; gap: .35rem; }
.font-btn {
  padding: .55rem .75rem;
  border-radius: 6px;
  border: 1.5px solid var(--gray-200);
  font-size: .85rem;
  text-align: left;
  transition: all var(--transition);
}
.font-btn:hover { border-color: var(--red); color: var(--red); }

/* Photos */
.upload-area {
  margin: .75rem;
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--gray-500);
}
.upload-area:hover { border-color: var(--red); color: var(--red); }
.upload-area i    { font-size: 1.75rem; margin-bottom: .4rem; }
.upload-area p    { font-size: .85rem; font-weight: 600; margin-bottom: .15rem; }
.upload-area span { font-size: .72rem; }

.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
}
.photo-thumb {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition);
}
.photo-thumb:hover { border-color: var(--red); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Background */
.bg-colors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .4rem;
  margin-bottom: .75rem;
}
.bg-color-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.bg-color-btn:hover { transform: scale(1.1); border-color: var(--gray-400); }
.bg-color-custom {
  grid-column: span 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem .5rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
}
.bg-color-custom label { font-size: .78rem; color: var(--gray-600); display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.bg-color-custom input[type="color"] { width: 28px; height: 28px; border: none; background: none; cursor: pointer; border-radius: 4px; }

.bg-gradients, .bg-patterns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  margin-bottom: .75rem;
}
.bg-gradient-btn, .bg-pattern-btn {
  width: 100%;
  height: 40px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.bg-gradient-btn:hover, .bg-pattern-btn:hover { border-color: var(--red); transform: scale(1.03); }

/* Layers */
.layers-list { padding: .5rem; }
.layer-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  border-radius: 6px;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-size: .82rem;
  transition: all var(--transition);
  margin-bottom: .25rem;
}
.layer-item:hover    { background: var(--gray-50); }
.layer-item.selected { background: #ffe3e3; border-color: var(--red); }
.layer-item i        { font-size: .8rem; color: var(--gray-500); }
.layer-item__name    { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-vis {
  font-size: .75rem;
  color: var(--gray-400);
  transition: color var(--transition);
}
.layer-vis:hover { color: var(--gray-700); }

/* ─── Canvas Area ──────────────────────────────── */
.designer-canvas-area {
  background: #d4d4d4;
  background-image:
    linear-gradient(45deg, #bebebe 25%, transparent 25%),
    linear-gradient(-45deg, #bebebe 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #bebebe 75%),
    linear-gradient(-45deg, transparent 75%, #bebebe 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.canvas-wrapper {
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  transition: transform .2s ease;
}

/* ─── Right Panel ─────────────────────────────── */
.designer-right {
  background: var(--white);
  border-left: 1px solid var(--gray-200);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}

.props-header {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.props-header h3 { font-size: .9rem; font-weight: 700; }

.props-section { padding: .75rem; }
.prop-group {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-100);
}
.prop-group:last-child { border-bottom: none; }
.prop-group h4 {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  margin-bottom: .6rem;
}

.prop-row {
  display: flex;
  gap: .5rem;
  margin-bottom: .5rem;
  align-items: center;
}
.prop-row label {
  display: flex;
  flex-direction: column;
  font-size: .72rem;
  color: var(--gray-600);
  font-weight: 600;
  gap: .2rem;
  flex: 1;
}
.prop-row input[type="number"],
.prop-row select {
  width: 100%;
  padding: .35rem .5rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 5px;
  font-size: .82rem;
  outline: none;
  transition: border-color var(--transition);
}
.prop-row input[type="number"]:focus,
.prop-row select:focus { border-color: var(--red); }
.prop-row input[type="range"] { width: 100%; accent-color: var(--red); }

/* Style buttons (bold, italic, etc.) */
.style-btn {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 1.5px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  color: var(--gray-600);
  transition: all var(--transition);
}
.style-btn:hover, .style-btn.active { background: var(--red); color: var(--white); border-color: var(--red); }

/* Format list */
.format-list { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.format-btn {
  padding: .55rem .75rem;
  border-radius: 6px;
  border: 1.5px solid var(--gray-200);
  font-size: .8rem;
  text-align: left;
  transition: all var(--transition);
  color: var(--gray-700);
}
.format-btn:hover, .format-btn.active { border-color: var(--red); background: #ffe3e3; color: var(--red-dark); font-weight: 600; }

.custom-size h4 { font-size: .75rem; font-weight: 700; color: var(--gray-600); margin-bottom: .5rem; }
.size-inputs {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.size-inputs label { font-size: .72rem; color: var(--gray-600); }
.size-inputs input {
  width: 62px;
  padding: .35rem .4rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 5px;
  font-size: .82rem;
  outline: none;
}
.size-inputs span { color: var(--gray-500); font-size: .9rem; }

/* Color section */
.prop-color-row { margin-bottom: .6rem; }
.color-preview-group { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.color-label {
  display: flex;
  flex-direction: column;
  font-size: .72rem;
  color: var(--gray-600);
  font-weight: 600;
  gap: .25rem;
}
.color-label input[type="color"] {
  width: 36px;
  height: 32px;
  border: 1.5px solid var(--gray-200);
  border-radius: 5px;
  cursor: pointer;
  padding: 1px;
}
.color-presets {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.color-dot:hover { transform: scale(1.2); border-color: var(--gray-400); }

/* Arrange */
.arrange-btns, .align-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .3rem;
  margin-bottom: .4rem;
}
.arrange-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: .4rem .2rem;
  border-radius: 5px;
  border: 1.5px solid var(--gray-200);
  font-size: .6rem;
  color: var(--gray-600);
  transition: all var(--transition);
}
.arrange-btn:hover { border-color: var(--red); color: var(--red); background: #ffe3e3; }
.arrange-btn i { font-size: .8rem; }

.no-selection-msg {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
}
.no-selection-msg i { font-size: 2rem; display: block; margin-bottom: .75rem; }
.no-selection-msg p { font-size: .82rem; }

/* ─── Order Summary (Print Modal) ─────────────── */
.order-summary { background: var(--gray-50); border-radius: 8px; padding: .75rem 1rem; margin-top: 1rem; }
.order-summary__row { display: flex; justify-content: space-between; font-size: .88rem; padding: .25rem 0; }
.order-summary__row.total { border-top: 1px solid var(--gray-200); margin-top: .3rem; padding-top: .5rem; font-weight: 700; font-size: 1rem; }

/* ─── Preview Modal ───────────────────────────── */
.preview-modal-inner {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 700px;
  width: calc(100vw - 4rem);
  position: relative;
  text-align: center;
}
.preview-modal-inner h3 { margin-bottom: 1rem; }
.preview-modal-inner img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 1rem;
}
.preview-actions { display: flex; gap: .75rem; justify-content: center; }

/* ─── Responsive ──────────────────────────────── */
@media (max-width: 1200px) {
  .designer-main { grid-template-columns: 56px 240px 1fr 240px; }
}
@media (max-width: 960px) {
  .designer-main { grid-template-columns: 56px 220px 1fr; }
  .designer-right { display: none; }
}
@media (max-width: 700px) {
  .designer-topbar__center { display: none; }
  .designer-main { grid-template-columns: 56px 200px 1fr; }
}
