/* =========================================================
   Blizlab UI – shared styles for all tools
   ======================================================= */

:root {
  --blue: #0099cc;
  --yellow: #ffcc33;
  --white: #fdfdf9;
  --bg-soft: #f5f7fb;
  --text-main: #1a1a1a;
  --text-muted: #6b7280;
  --border-subtle: rgba(15, 23, 42, 0.08);

  --card-radius: 18px;

  --checker-a: #e2e6f0;
  --checker-b: #cdd4e3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-soft);
  color: var(--text-main);
}

/* HEADER -------------------------------------------------- */

.page-header {
  background: var(--blue);
  color: var(--white);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
}

.logo-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #1a1a1a;
}

.brand-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand-subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
}

.lang-toggle {
  display: flex;
  gap: 6px;
}

.lang-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: transparent;
  color: var(--white);
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  min-width: 38px;
}

.lang-btn.active {
  background: var(--yellow);
  color: #111827;
  border-color: var(--yellow);
  font-weight: 600;
}

/* MAIN LAYOUT --------------------------------------------- */

.page-main {
  max-width: 1180px;
  margin: 26px auto 40px;
  padding: 0 16px;
}

.app-shell {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  padding: 16px 18px 18px;
  border: 1px solid rgba(15, 23, 42, 0.04);
}

/* Model info bar (top pill) */
.model-bar {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 204, 51, 0.16),
    rgba(255, 255, 255, 0.98)
  );
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.model-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  margin-right: 8px;
  color: #92400e;
  font-size: 0.78rem;
}

.model-note-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-btn {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  font-size: 0.78rem;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.model-btn:hover {
  border-color: var(--blue);
}

.model-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.25);
  background: #e5e7eb;
}

.model-dot.ok {
  background: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.5),
    0 0 6px rgba(34, 197, 94, 0.8);
}

/* Page tool title row */

.app-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-inline: 4px;
  margin-bottom: 12px;
  margin-top: 4px;
}

/* Remembered preference */
.tool-title-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 2.8rem;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.01em;
}

.tool-title-pill svg {
  width: 45px;
  height: 45px;
  flex-shrink: 0;
  color: var(--yellow);
  transform: translateY(4px);
}

.tool-title-pill span {
  line-height: 1;
}

.status-pill {
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.09);
  background: #f9fafb;
  color: var(--text-muted);
  max-width: 340px;
  text-align: right;
}

/* Two-column layout (controls + canvas) */

.app-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 14px;
  margin-top: 6px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.canvas-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 360px;
}

/* CARDS --------------------------------------------------- */

.card {
  background: #ffffff;
  border-radius: var(--card-radius);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px 12px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.card-title {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.fake-input {
  border-radius: 999px;
  border: 1px dashed rgba(15, 23, 42, 0.2);
  background: #f9fafb;
  padding: 7px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.fake-input:hover {
  border-style: solid;
  border-color: var(--blue);
  background: #ffffff;
}

.primary-btn {
  border-radius: 999px;
  border: none;
  background: var(--blue);
  color: #ffffff;
  font-weight: 600;
  padding: 7px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 9px 20px rgba(0, 153, 204, 0.35);
  white-space: nowrap;
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.primary-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.full-width-btn {
  width: 100%;
  justify-content: center;
}

.image-filename {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.card-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

/* TOOLS / BRUSH ------------------------------------------ */

.brush-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0 2px;
}

.brush-value {
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
}

.pill-toggle {
  display: flex;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  overflow: hidden;
  margin: 6px 0;
}

.pill-toggle button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
}

.pill-toggle button.active {
  background: rgba(0, 153, 204, 0.08);
  color: #0369a1;
  font-weight: 600;
}

.undo-redo-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.secondary-btn {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #f9fafb;
  font-size: 0.8rem;
  padding: 6px 0;
  cursor: pointer;
}

.secondary-btn:hover {
  border-color: var(--blue);
  background: #ffffff;
}

/* CANVAS -------------------------------------------------- */

.canvas-wrap {
  flex: 1;
  min-height: 320px;
  background: repeating-conic-gradient(
      var(--checker-a) 0% 25%,
      var(--checker-b) 0% 50%
    )
    50% / 24px 24px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.canvas-wrap.hide-cursor canvas {
  cursor: none;
}

canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: transparent;
  image-rendering: auto;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16);
}

/* Generic overlay message under canvas */
.overlay-msg {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 90%;
  text-align: center;
}

.canvas-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 4px;
}

/* FOOTER -------------------------------------------------- */

.page-footer {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 8px 10px 24px;
}

/* RESPONSIVE --------------------------------------------- */

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .canvas-panel {
    min-height: 260px;
  }
}