/* ═══════════════════════════════════════════════
   Caça-Palavras WordPress Plugin — Stylesheet
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Courier+Prime:wght@400;700&display=swap');

/* ── Variables ── */
:root {
  --cp-primary:   #2563eb;
  --cp-primary-d: #1d4ed8;
  --cp-accent:    #f59e0b;
  --cp-success:   #10b981;
  --cp-danger:    #ef4444;
  --cp-bg:        #f0f4ff;
  --cp-surface:   #ffffff;
  --cp-border:    #dde3f0;
  --cp-text:      #1e293b;
  --cp-muted:     #64748b;
  --cp-radius:    12px;
  --cp-shadow:    0 4px 24px rgba(37,99,235,.10);
  --cp-cell:      32px;
  --cp-font:      'Nunito', sans-serif;
  --cp-mono:      'Courier Prime', monospace;
}

/* ── Layout wrapper ── */
.cp-wrapper {
  font-family: var(--cp-font);
  color: var(--cp-text);
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* ══ PANEL ══ */
.cp-panel {
  background: var(--cp-surface);
  border-radius: var(--cp-radius);
  box-shadow: var(--cp-shadow);
  padding: 28px;
  flex: 0 0 340px;
  min-width: 280px;
  border: 1.5px solid var(--cp-border);
}

.cp-panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.cp-panel__icon { font-size: 1.8rem; }
.cp-panel__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--cp-primary);
  line-height: 1.2;
}

/* Form elements */
.cp-form__group { margin-bottom: 18px; }
.cp-form__row   { display: flex; gap: 12px; }
.cp-form__group--half { flex: 1; }

.cp-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--cp-muted);
  margin-bottom: 6px;
}
.cp-hint { font-weight: 400; text-transform: none; }

.cp-input,
.cp-textarea,
.cp-select {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--cp-font);
  font-size: .93rem;
  padding: 9px 12px;
  border: 1.5px solid var(--cp-border);
  border-radius: 8px;
  background: var(--cp-bg);
  color: var(--cp-text);
  transition: border-color .2s;
  outline: none;
  resize: vertical;
}
.cp-input:focus,
.cp-textarea:focus,
.cp-select:focus { border-color: var(--cp-primary); }

.cp-word-count {
  font-size: .78rem;
  color: var(--cp-muted);
  text-align: right;
  margin-top: 4px;
}

/* Checkboxes */
.cp-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  cursor: pointer;
  user-select: none;
}
.cp-check input { accent-color: var(--cp-primary); cursor: pointer; }

/* Buttons */
.cp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.cp-btn {
  font-family: var(--cp-font);
  font-weight: 700;
  font-size: .88rem;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform .1s, box-shadow .2s, opacity .2s;
  white-space: nowrap;
}
.cp-btn:hover  { transform: translateY(-1px); }
.cp-btn:active { transform: translateY(0); }

.cp-btn--primary {
  background: var(--cp-primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(37,99,235,.35);
}
.cp-btn--primary:hover { background: var(--cp-primary-d); }

.cp-btn--secondary {
  background: var(--cp-accent);
  color: #1e293b;
  box-shadow: 0 3px 10px rgba(245,158,11,.25);
}
.cp-btn--ghost {
  background: transparent;
  color: var(--cp-muted);
  border: 1.5px solid var(--cp-border);
}
.cp-btn--hint {
  background: #f1f5f9;
  color: var(--cp-text);
  border: 1.5px solid var(--cp-border);
  margin-top: 12px;
  width: 100%;
  font-size: .85rem;
}

/* ══ GAME AREA ══ */
.cp-game {
  flex: 1;
  min-width: 280px;
  background: var(--cp-surface);
  border-radius: var(--cp-radius);
  box-shadow: var(--cp-shadow);
  padding: 28px;
  border: 1.5px solid var(--cp-border);
  position: relative;
}

.cp-game__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.cp-game__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--cp-primary);
}
.cp-stats { display: flex; gap: 16px; align-items: center; }
.cp-stat  { font-size: .88rem; font-weight: 600; color: var(--cp-muted); }
.cp-timer { font-family: var(--cp-mono); color: var(--cp-primary); font-size: .95rem; }

.cp-game__body {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

/* Grid */
.cp-grid-wrapper { overflow-x: auto; }
.cp-grid {
  display: inline-grid;
  gap: 2px;
  user-select: none;
  cursor: crosshair;
}
.cp-cell {
  width:  var(--cp-cell);
  height: var(--cp-cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cp-mono);
  font-weight: 700;
  font-size: .9rem;
  border-radius: 5px;
  background: var(--cp-bg);
  color: var(--cp-text);
  transition: background .12s, color .12s;
  position: relative;
  z-index: 1;
}
.cp-cell:hover            { background: #dbeafe; }
.cp-cell.is-selecting     { background: var(--cp-accent) !important; color: #fff !important; }
.cp-cell.is-found         { background: var(--cp-success); color: #fff; }
.cp-cell.is-hint          { background: #fbbf24; color: #fff; animation: cp-blink .5s 3; }

@keyframes cp-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: .4; }
}

/* Word list */
.cp-wordlist { min-width: 140px; }
.cp-wordlist__title {
  margin: 0 0 10px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--cp-muted);
}
.cp-wordlist__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cp-wordlist__list li {
  font-weight: 700;
  font-size: .88rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--cp-bg);
  border: 1.5px solid var(--cp-border);
  color: var(--cp-text);
  transition: all .2s;
  white-space: nowrap;
}
.cp-wordlist__list li.is-done {
  background: var(--cp-success);
  border-color: var(--cp-success);
  color: #fff;
  text-decoration: line-through;
}

/* Victory overlay */
.cp-victory {
  position: absolute;
  inset: 0;
  background: rgba(240,244,255,.92);
  border-radius: var(--cp-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: cp-fadein .4s ease;
}
@keyframes cp-fadein { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }

.cp-victory__box {
  text-align: center;
  padding: 40px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(37,99,235,.18);
}
.cp-victory__emoji { font-size: 3.5rem; margin-bottom: 12px; }
.cp-victory__box h3 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--cp-primary);
}
.cp-victory__box p { color: var(--cp-muted); margin: 0 0 20px; }

/* ── Error / info messages ── */
.cp-message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.cp-message--error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.cp-message--warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

/* ── Print: a impressão é gerada em janela separada (ver caca-palavras.js) ── */
@media print { body { display: none !important; } }

/* ── Responsive ── */
@media (max-width: 700px) {
  .cp-wrapper { flex-direction: column; padding: 12px 8px; }
  .cp-panel, .cp-game { flex: unset; min-width: unset; padding: 18px; }
  :root { --cp-cell: 26px; }
  .cp-cell { font-size: .75rem; }
  .cp-form__row { flex-direction: column; }
}
