﻿/* ================================================================
   Editor page — clean, modern dark UI
   ================================================================ */

/* ---- Layout ---- */
.editor-layout {
  display: flex;
  height: calc(100vh - 64px);
  overflow: hidden;
  background: #0a1628;
}

.editor-side {
  width: 300px;
  flex-shrink: 0;
  background: #0f1724;
  border-right: 1px solid rgba(255,255,255,0.04);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(2,6,23,0.6) inset;
}

.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px;
  gap: 10px;
}

/* ---- Panels ---- */
.panel {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 11px;
}

.panel-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-bottom: 8px;
}

/* ---- Upload area ---- */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 16px 10px;
  border: 1.5px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  text-align: center;
  color: rgba(255,255,255,0.35);
}

.upload-area:hover {
  border-color: rgba(16,185,129,0.45);
  background: rgba(16,185,129,0.04);
  color: rgba(16,185,129,0.8);
}

.upload-area svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.upload-area span {
  font-size: 12px;
  font-weight: 500;
}

#file-name {
  font-size: 11.5px;
  color: rgba(255,255,255,0.4);
  text-align: center;
  margin-top: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Editor Buttons ---- */
.eb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.04);
  width: 100%;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.1;
  min-height: 40px;
  box-sizing: border-box;
  background: rgba(255,255,255,0.02);
  color: #fff;
}

.eb-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(2,6,23,0.5); }
.eb-btn:active { transform: translateY(0); opacity: 0.95; }

.eb-btn svg {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.eb-btn > span { display:inline-block; vertical-align:middle; }

.eb-primary {
  background: linear-gradient(90deg, #10b981 0%, #ff7a00 100%);
  color: #fff;
  box-shadow: 0 10px 30px rgba(16,185,129,0.12);
  border: 1px solid rgba(255,255,255,0.04);
}

.eb-primary:hover { opacity: 0.98; transform: translateY(-2px); }

.eb-ghost {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  color: #c9d5e0;
}

.eb-ghost:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.btn-row {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.btn-row .eb-btn { flex: 1; }

/* ---- Tool chips ---- */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.tool-chip {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  color: #b8c7d3;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s, color 0.14s, border-color 0.14s, transform 0.12s, box-shadow 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 38px;
  display:flex;
  align-items:center;
}

.tool-chip:hover {
  background: rgba(16,185,129,0.06);
  border-color: rgba(16,185,129,0.28);
  color: #10b981;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(2,6,23,0.45);
}

/* ---- Text tool form ---- */
.form-row {
  display: flex;
  gap: 7px;
  margin-bottom: 7px;
  align-items: flex-end;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.form-field > label {
  font-size: 10.5px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.form-field input,
.form-field select,
.form-field textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 6px;
  padding: 5px 7px;
  color: #e6eef6;
  font-size: 12.5px;
  width: 100%;
  box-sizing: border-box;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: rgba(16,185,129,0.4);
}

.form-field textarea {
  resize: vertical;
}

/* ---- Toolbar ---- */
#editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 9px;
  gap: 6px;
  flex-shrink: 0;
}

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

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.78);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.12s;
  white-space: nowrap;
  min-height:36px;
}

.tb-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-color: rgba(255,255,255,0.08);
  transform: translateY(-2px);
}

.tb-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.tb-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  flex-shrink: 0;
}

#page-indicator,
#zoom-display {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  padding: 0 5px;
  white-space: nowrap;
  min-width: 54px;
  text-align: center;
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.08);
  margin: 0 3px;
  flex-shrink: 0;
}

/* ---- PDF canvas area ---- */
#pdf-wrapper {
  flex: 1;
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  background: #0a1220;
  border: 1px solid rgba(255,255,255,0.05);
}

#pdf-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
}

#pdf-canvas {
  display: block;
}

#pdf-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 30;
  pointer-events: auto;
}

/* ---- Text overlays ---- */
.pdf-text-overlay {
  position: absolute;
  background: rgba(0,0,0,0.24);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 6px 8px;
  min-width: 48px;
  white-space: pre-wrap;
  cursor: move;
  color: #fff;
  backdrop-filter: blur(2px);
}

.pdf-text-overlay:hover {
  background: rgba(255,255,255,0.03);
}

.selected-overlay {
  border-color: rgba(255,122,0,0.65);
  box-shadow: 0 0 0 2px rgba(255,122,0,0.15);
}

.pdf-text-overlay[contenteditable="true"]:focus {
  outline: 1px solid rgba(16,185,129,0.5);
}

/* ---- Overlay handles ---- */
.overlay-handle {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  font-size: 10px;
}

.overlay-handle.rotate-handle {
  right: -12px;
  top: -12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,122,0,0.14);
  border: 1px solid rgba(255,122,0,0.36);
  color: #ff7a00;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.overlay-handle.resize-handle {
  right: -8px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.12);
  cursor: nwse-resize;
  color: rgba(255,255,255,0.7);
}

/* ---- Overlay action toolbar ---- */
#overlay-tools {
  position: fixed;
  z-index: 9999;
  background: #1a2435;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 5px;
  display: flex;
  gap: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

#overlay-tools .small-btn {
  padding: 5px 8px;
  border-radius: 5px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #c9d5e0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}

#overlay-tools .small-btn:hover {
  background: rgba(255,122,0,0.15);
  color: #ff7a00;
  border-color: rgba(255,122,0,0.3);
}

/* ---- Thumbnails ---- */
#thumbnails {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.thumb-canvas {
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: border-color 0.15s;
  width: 100%;
  height: auto;
}

.thumb-canvas:hover {
  border-color: rgba(16,185,129,0.4);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .editor-layout { flex-direction: column; height: auto; overflow: visible; }
  .editor-side { width: 100%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .editor-main { padding: 8px; }
  #pdf-wrapper { height: 60vh; }
}
