/* Online lövhə (/lovhe, js/pages/lovhe.html, js/whiteboard.js) — tam ekran lövhə, yuxarıda alət zolağı. */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

.wb-body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #eef2f7;
  color: #17283f;
  overflow: hidden;
}

/* ------------------------------------------------------------------ giriş qapısı */

.wb-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #16345f, #0e2442);
}

.wb-gate-card {
  max-width: 380px;
  padding: 32px 28px;
  border-radius: 16px;
  background: #fff;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.wb-gate-card h1 { margin: 12px 0 8px; font-size: 22px; color: #16345f; }
.wb-gate-card p { margin: 0 0 20px; color: #4d5f78; line-height: 1.5; }

.wb-gate-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 10px;
  background: #16345f;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

/* ------------------------------------------------------------------ alət zolağı */

.wb-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.wb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 14px;
  background: #16345f;
  border-bottom: 3px solid #a18025;
  color: #fff;
  user-select: none;
}

.wb-brand { display: flex; align-items: center; margin-right: 4px; }
.wb-brand img { display: block; height: 30px; width: auto; }

.wb-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.wb-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dbe6f5;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.wb-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wb-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.wb-btn:focus-visible { outline: 2px solid #f1d27a; outline-offset: 1px; }
.wb-btn.is-active { background: #fff; color: #16345f; }
.wb-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }

.wb-colors { gap: 4px; padding: 5px 7px; }

/* fəza fiqurları menyusu */
.wb-solid-wrap { position: relative; }

.wb-solid-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: 360px;
  max-height: calc(100vh - 90px);
  padding: 8px;
  overflow-y: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(10, 25, 50, 0.3);
}

.wb-solid-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #17283f;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.wb-solid-item canvas { flex: none; width: 56px; height: 48px; }
.wb-solid-item:hover { background: #eef3fa; }
.wb-solid-item.is-active { border-color: #a18025; background: #fbf6e6; }

/* endirmə menyusu (PNG / PDF / Word) */
.wb-export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  display: grid;
  gap: 2px;
  width: 210px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(10, 25, 50, 0.3);
}

.wb-export-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #17283f;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.wb-export-item:hover, .wb-export-item:focus-visible { background: #eef3fa; outline: none; }
.wb-export-item span { display: grid; font-weight: 600; }
.wb-export-item small { font-size: 12px; font-weight: 400; color: #5b6b82; }

.wb-export-tag {
  flex: none;
  width: 38px;
  padding: 4px 0;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  text-align: center;
}

.tag-png { background: #16a34a; }
.tag-pdf { background: #dc2626; }
.tag-doc { background: #2563eb; }

.wb-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
}

.wb-swatch.is-active { border-color: #f1d27a; box-shadow: 0 0 0 2px #16345f, 0 0 0 4px #f1d27a; }

.wb-color-input {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.wb-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wb-size-dot {
  display: inline-block;
  min-width: 4px;
  min-height: 4px;
  border-radius: 50%;
  background: #fff;
}

.wb-size input { width: 110px; accent-color: #f1d27a; }

.wb-select {
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.wb-select option { color: #17283f; }

.wb-pages {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.wb-page-label { min-width: 52px; text-align: center; font-size: 14px; font-weight: 600; color: #fff; }

/* ------------------------------------------------------------------ lövhə */

.wb-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
}

.wb-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#wbPreview, #wbPdfCanvas { pointer-events: none; }

/* PDF açılarkən */
.wb-busy {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(14, 36, 66, 0.35);
}

.wb-busy-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-radius: 12px;
  background: #fff;
  color: #16345f;
  font-weight: 600;
  box-shadow: 0 14px 40px rgba(10, 25, 50, 0.3);
}

.wb-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #dbe6f5;
  border-top-color: #a18025;
  border-radius: 50%;
  animation: wb-spin 0.8s linear infinite;
}

@keyframes wb-spin { to { transform: rotate(360deg); } }

.wb-stage.tool-pen, .wb-stage.tool-marker, .wb-stage.tool-line, .wb-stage.tool-arrow,
.wb-stage.tool-rect, .wb-stage.tool-ellipse, .wb-stage.tool-solid { cursor: crosshair; }
.wb-stage.tool-text { cursor: text; }
.wb-stage.tool-eraser { cursor: cell; }
.wb-stage.tool-hand, .wb-stage.is-hand { cursor: grab; }
.wb-stage.is-panning { cursor: grabbing; }

.wb-zoom-label {
  min-width: 52px;
  height: 36px;
  padding: 0 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wb-zoom-label:hover { background: rgba(255, 255, 255, 0.14); }
.wb-zoom-label:focus-visible { outline: 2px solid #f1d27a; outline-offset: 1px; }

.bg-white { background-color: #ffffff; }
.bg-grid {
  background-color: #ffffff;
  background-image:
    linear-gradient(#e3e9f2 1px, transparent 1px),
    linear-gradient(90deg, #e3e9f2 1px, transparent 1px);
  background-size: 28px 28px;
}
.bg-lines {
  background-color: #ffffff;
  background-image: linear-gradient(#dfe6f0 1px, transparent 1px);
  background-size: 100% 36px;
}
.bg-dots {
  background-color: #ffffff;
  background-image: radial-gradient(#c3cedd 1.3px, transparent 1.4px);
  background-size: 28px 28px;
}
.bg-chalk { background-color: #2f4f3a; }
.bg-dark { background-color: #1c2128; }

.wb-text-input {
  position: absolute;
  z-index: 2;
  min-width: 40px;
  margin: 0;
  padding: 0;
  border: 1px dashed #4a7bd0;
  background: rgba(255, 255, 255, 0.85);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.25;
  resize: none;
  overflow: hidden;
  outline: none;
  white-space: pre;
}

.bg-chalk .wb-text-input, .bg-dark .wb-text-input { background: rgba(0, 0, 0, 0.35); }

@media (max-width: 720px) {
  .wb-toolbar { gap: 6px 8px; padding: 6px 8px; }
  .wb-brand { display: none; }
  .wb-size input { width: 80px; }
  .wb-pages { margin-left: 0; }
}

/* Səhifələr arası keçid animasiyası — css/style.css-dəki «keçid animasiyaları» bloku ilə eyni (hər iki səhifə qaydanı daşımalıdır). */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: page-out 0.2s cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: page-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes page-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes page-in { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
