/* ============================================================
   글자수 세기 (Geuljasusegi) Tool-First UI Styles
   Reusing existing color system: --bg, --paper, --ink, --line, etc.
============================================================ */

.counter-tool-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

/* Stat Cards Dashboard */
.stat-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-metric-card {
  background: var(--paper);
  border: 2.2px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: 4px 4px 0 rgba(55,39,51,.10);
  transition: transform .22s var(--bounce), box-shadow .22s var(--bounce);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 rgba(55,39,51,.13);
}

.stat-metric-card.highlight {
  background: linear-gradient(135deg, var(--paper) 60%, var(--wash));
  border-color: var(--line);
}

.stat-metric-card.accent {
  background: linear-gradient(135deg, var(--paper) 60%, var(--paper-tint));
}

.stat-metric-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-badge {
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--sun);
  color: var(--ink);
  font-weight: 950;
}

.stat-metric-num {
  font-family: var(--mono);
  font-size: clamp(24px, 2.5vw, 34px);
  font-weight: 950;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-metric-num .unit {
  font-size: 14px;
  font-weight: 850;
  margin-left: 3px;
  color: var(--muted);
}

.stat-metric-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1.5px dashed rgba(55,39,51,.14);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 750;
}

.stat-metric-sub span strong {
  color: var(--ink);
  font-family: var(--mono);
}

/* Editor Section */
.counter-editor-box {
  background: var(--paper);
  border: 2.2px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Target & Progress bar */
.counter-target-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 2px dashed rgba(55,39,51,.15);
}

.target-selector-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 850;
  color: var(--ink);
}

.target-select {
  appearance: none;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 7px 32px 7px 12px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 850;
  color: var(--ink);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23372733' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  box-shadow: 2px 2px 0 rgba(55,39,51,.1);
}

.target-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
  max-width: 440px;
}

.progress-track {
  flex-grow: 1;
  height: 14px;
  background: var(--soft);
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--mint);
  border-radius: 999px;
  transition: width .2s ease, background-color .2s ease;
}

.progress-fill.warning {
  background: var(--sun);
}

.progress-fill.danger {
  background: var(--peach);
}

.progress-stats {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
}

/* Textarea input */
.editor-textarea-wrap {
  position: relative;
  width: 100%;
}

.main-counter-textarea {
  width: 100%;
  min-height: 280px;
  padding: 16px 18px;
  background: #fffdfc;
  border: 2px solid rgba(55,39,51,.22);
  border-radius: 18px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  resize: vertical;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.main-counter-textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(154,128,255,.18);
}

.main-counter-textarea::placeholder {
  color: #a894a2;
}

/* Action Toolbar */
.counter-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.act-btn {
  appearance: none;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(55,39,51,.12);
  transition: transform .18s var(--bounce), box-shadow .18s var(--bounce), background-color .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.act-btn:hover {
  transform: translate(-1px, -2px);
  box-shadow: 4px 5px 0 rgba(55,39,51,.14);
  background: #fff;
}

.act-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(55,39,51,.12);
}

.act-btn.primary {
  background: var(--sun);
}

.act-btn.primary:hover {
  background: var(--cream);
}

.act-btn.clean {
  background: var(--lavender);
}

.act-btn.clean:hover {
  background: #dcd0ff;
}

.act-btn.danger {
  background: var(--wash);
  color: #a12b2b;
}

.act-btn.danger:hover {
  background: #ffe3e3;
}

/* Security Trust Badge */
.security-trust-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(78,223,166,.14);
  border: 1.8px solid var(--line);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 800;
  color: #124128;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 940px) {
  .stat-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .stat-dashboard {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .counter-target-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .target-progress-wrap {
    max-width: 100%;
  }
  .action-buttons-group {
    width: 100%;
    justify-content: stretch;
  }
  .action-buttons-group .act-btn {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }
  .main-counter-textarea {
    min-height: 220px;
    font-size: 15px;
  }
}
