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

/* Anchor font-size inside the WordPress widget so rem values are predictable
   regardless of the active theme. Has no effect in standalone mode. */
.cnesc-wrap { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}

/* ===== App container ===== */
.app {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Header ===== */
.app-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c3e50;
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 2px solid #dce1e8;
}

/* ===== Editor ===== */
.editor-section label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

#text {
  width: 100%;
  min-height: 140px;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #c4cad4;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#text:focus {
  outline: none;
  border-color: #5b9bd5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.25);
}
.cnesc-wrap .editor-section label { font-size: 2rem; }
.cnesc-wrap #text { font-size: 2rem; }

/* ===== Misspelled words ===== */
.misspelled {
  background: #fee;
  border-bottom: 2px solid #d40000;
  border-radius: 2px;
  cursor: pointer;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-version {
  margin-left: auto;
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
}

.btn {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: #3578e5;
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #2a62c4; }

.btn-secondary {
  background: #e4e6eb;
  color: #333;
}
.btn-secondary:hover:not(:disabled) { background: #d0d3da; }

/* ===== Status indicator ===== */
.status {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  vertical-align: middle;
  border-radius: 50%;
  flex-shrink: 0;
}
.status.pending { background: #cfcfcf; }
.status.ok      { background: #2ecc71; }
.status.err     { background: #e74c3c; }

/* ===== Suggestion menu ===== */
#suggestion-menu {
  position: fixed;
  display: none;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
  padding: 4px;
  z-index: 1000;
  min-width: 180px;
}
#suggestion-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #1a1a1a;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 1rem;
  cursor: pointer;
}
#suggestion-menu button:hover { background: #eef3ff; }

/* ===== Debug output ===== */
#out {
  display: none;
  white-space: pre-wrap;
  font-size: 0.8rem;
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
}

/* ===== Footer ===== */
.app-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
  font-size: 0.8rem;
  color: #888;
  text-align: center;
  min-height: 48px;
}
