/* ════════════════════════════════════════
   SIMULADOR DE CUADERNO — styles.css
   ════════════════════════════════════════ */

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

:root {
  --pb: #1a1a2e;
  --ps: #16213e;
  --pborder: rgba(255, 255, 255, 0.08);
  --acc: #4f8ef7;
  --acc-dim: rgba(79, 142, 247, 0.15);
  --tp: #f0f0f0;
  --tm: #8a9bb5;
  --track: #2a3550;
  --r: 10px;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0f111a;
  color: var(--tp);
  height: 100dvh;
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  overflow: hidden;
}

/* ── SHARED PANEL STYLES ── */
.ph {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--pborder);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ph h1 {
  font-size: 14px;
  font-weight: 600;
}
.ps {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--pborder) transparent;
}
.slabel {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tm);
  margin-bottom: 6px;
}

/* ── LEFT PANEL ── */
#panel-left {
  background: var(--pb);
  border-right: 1px solid var(--pborder);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Drop zone */
#drop-zone {
  border: 1.5px dashed var(--pborder);
  border-radius: var(--r);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
#drop-zone:hover,
#drop-zone.drag-over {
  background: var(--acc-dim);
  border-color: var(--acc);
}
#drop-zone .dzi {
  font-size: 22px;
}
#drop-zone span {
  font-size: 11px;
  color: var(--tm);
  display: block;
  margin-top: 3px;
}
#img-upload {
  display: none;
}

/* Sliders */
.srow {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sh {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sh label {
  font-size: 12px;
  color: var(--tm);
}
.sh .sv {
  font-size: 11px;
  font-weight: 700;
  color: var(--acc);
  min-width: 34px;
  text-align: right;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--track);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--acc);
  border: 2px solid #fff;
  cursor: pointer;
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--acc);
  border: 2px solid #fff;
  cursor: pointer;
}

/* Add box button */
#btn-add {
  width: 100%;
  padding: 10px;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    filter 0.15s,
    transform 0.1s;
}
#btn-add:hover {
  filter: brightness(1.1);
}
#btn-add:active {
  transform: scale(0.97);
}

/* Box list */
#box-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.box-item {
  background: var(--ps);
  border: 1.5px solid var(--pborder);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.15s;
}
.box-item:hover {
  border-color: rgba(79, 142, 247, 0.4);
}
.box-item.selected {
  border-color: var(--acc);
  background: var(--acc-dim);
}
.box-item-label {
  font-size: 12px;
  color: var(--tp);
}
.box-item-del {
  background: none;
  border: none;
  color: #e55;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.box-item-del:hover {
  opacity: 1;
}

/* Export / Reset buttons */
#btn-export {
  width: 100%;
  padding: 10px;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    filter 0.15s,
    transform 0.1s;
}
#btn-export:hover {
  filter: brightness(1.1);
}
#btn-export:active {
  transform: scale(0.97);
}

#btn-reset-all {
  width: 100%;
  padding: 8px;
  background: transparent;
  color: var(--tm);
  border: 1px solid var(--pborder);
  border-radius: var(--r);
  font-size: 12px;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}
#btn-reset-all:hover {
  color: var(--tp);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ── CENTER CANVAS ── */
#canvas-area {
  background: #1a1c24;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
  position: relative;
}

#empty-state {
  width: 560px;
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #252836;
  cursor: pointer;
  border-radius: 8px;
  border: 1.5px dashed var(--pborder);
}
#empty-state.hidden {
  display: none;
}
#empty-state .esi {
  font-size: 38px;
  opacity: 0.4;
}
#empty-state p {
  font-size: 14px;
  color: var(--tm);
}

#zoom-wrapper {
  transform-origin: top center;
  transition: transform 0.18s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: none;
  line-height: 0;
}
#zoom-wrapper.active {
  display: inline-block;
}

#workspace {
  position: relative;
  display: inline-block;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  line-height: 0;
}
#notebook-img {
  display: block;
  max-width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
#grid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
#grid-canvas.visible {
  opacity: 1;
}

/* Floating zoom bar */
#zoom-bar {
  position: fixed;
  bottom: 18px;
  left: calc(280px + (100vw - 560px) / 2);
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 4px;
  background: rgba(16, 22, 42, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--pborder);
  border-radius: 99px;
  padding: 4px 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
  z-index: 200;
  user-select: none;
}
#zoom-bar.visible {
  display: flex;
}
.zb-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--track);
  color: var(--tp);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.12s,
    transform 0.08s;
}
.zb-btn:hover {
  background: var(--acc);
}
.zb-btn:active {
  transform: scale(0.88);
}
#zoom-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--acc);
  min-width: 40px;
  text-align: center;
}
#zb-reset {
  font-size: 10px;
  height: 20px;
  border-radius: 5px;
  border: none;
  padding: 0 7px;
  background: transparent;
  color: var(--tm);
  cursor: pointer;
  transition: color 0.12s;
}
#zb-reset:hover {
  color: var(--tp);
}

/* ── RIGHT PANEL ── */
#panel-right {
  background: var(--pb);
  border-left: 1px solid var(--pborder);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#rp-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
}
#rp-empty .rpi {
  font-size: 32px;
  opacity: 0.3;
}
#rp-empty p {
  font-size: 12px;
  color: var(--tm);
}
#rp-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--pborder) transparent;
}
#rp-content.hidden {
  display: none;
}

/* Font grid */
.font-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.font-btn {
  background: var(--ps);
  border: 1.5px solid var(--pborder);
  border-radius: 7px;
  padding: 7px 8px;
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.15s,
    background 0.15s;
  color: var(--tp);
}
.font-btn:hover {
  border-color: rgba(79, 142, 247, 0.4);
}
.font-btn.active {
  border-color: var(--acc);
  background: var(--acc-dim);
}
.font-btn .fp {
  font-size: 16px;
  display: block;
  margin-bottom: 1px;
  line-height: 1.2;
}
.font-btn .fn {
  font-size: 9px;
  color: var(--tm);
  font-family: "Segoe UI", sans-serif;
}

/* Color dots */
.color-row {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.cdot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    transform 0.1s,
    border-color 0.1s;
}
.cdot:hover {
  transform: scale(1.1);
}
.cdot.active {
  border-color: #fff;
}
#rp-custom-color {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: none;
}
#rp-custom-color::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 50%;
}
#rp-custom-color::-webkit-color-swatch {
  border-radius: 50%;
  border: 2.5px solid transparent;
}

/* Toggles */
.trow {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.trow > label:first-child {
  font-size: 12px;
  color: var(--tm);
}
.tog {
  position: relative;
  width: 34px;
  height: 19px;
}
.tog input {
  opacity: 0;
  width: 0;
  height: 0;
}
.tog-track {
  position: absolute;
  inset: 0;
  background: var(--track);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s;
}
.tog-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.tog input:checked + .tog-track {
  background: var(--acc);
}
.tog input:checked + .tog-track::after {
  transform: translateX(15px);
}

/* Delete button in right panel */
#btn-delete-box {
  width: 100%;
  padding: 8px;
  background: #8b2020;
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 12px;
  cursor: pointer;
  transition: filter 0.15s;
}
#btn-delete-box:hover {
  filter: brightness(1.2);
}

/* ── TEXT BOXES ON CANVAS ── */
.txt-box {
  position: absolute;
  cursor: default;
  user-select: none;
}
.txt-box.selected .tb-toolbar {
  opacity: 1;
  pointer-events: auto;
}
.txt-box.selected .tb-border {
  outline: 1.5px dashed rgba(79, 142, 247, 0.7);
}
.tb-border {
  outline: 1.5px dashed transparent;
  outline-offset: 3px;
  transition: outline-color 0.15s;
}
.tb-toolbar {
  position: absolute;
  top: -34px;
  left: 0;
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 20;
}
.tb-btn {
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--pborder);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 8px;
  background: rgba(16, 22, 42, 0.92);
  color: var(--tp);
  white-space: nowrap;
  transition: background 0.12s;
}
.tb-btn:hover {
  background: var(--acc);
}
.tb-drag {
  width: 26px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tb-drag:active {
  cursor: grabbing;
}
.tb-textarea {
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  white-space: pre;
  cursor: text;
  padding: 0;
  display: block;
  caret-color: #ff6b6b;
  line-height: 1;
}
.tb-textarea:focus {
  outline: none;
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1e2a40;
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 12px;
  border-left: 3px solid var(--acc);
  transform: translateY(70px);
  opacity: 0;
  transition:
    transform 0.3s,
    opacity 0.3s;
  z-index: 9999;
  pointer-events: none;
}
#toast.show {
  transform: translateY(0);
  opacity: 1;
}
