/* Counter page */

button,
textarea {
  font: inherit;
}

.page-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.breadcrumb a {
  color: var(--primary-hover);
  font-weight: 600;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Counter */

.counter-section {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.counter-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.heading-icon {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.heading-icon img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.counter-heading h1 {
  color: #0a174e;
  font-family: "Basic", serif;
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  line-height: 1.2;
}

.counter-heading p {
  max-width: 760px;
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-family: "Nunito Sans", serif;
}

.counter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 1.5rem;
  padding: 1.5rem;
}

/* Text editor */

.editor-area,
.results-area {
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.textarea-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
}

.textarea-header label {
  color: #0a174e;
  font-weight: 700;
}

.textarea-header span {
  color: var(--primary-hover);
  font-size: 0.8rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 400px;
  resize: vertical;
  padding: 1rem;
  color: #0a174e;
  background: #ffffff;
  border: 1px solid #b7d8ca;
  border-radius: 10px;
  outline: none;
  line-height: 1.65;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

textarea::placeholder {
  color: #8da69e;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.textarea-help {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    background-color 0.15s ease;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.primary-button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.secondary-button {
  color: #0a174e;
  background: #ffffff;
  border: 1px solid #b7d8ca;
}

.secondary-button:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.action-message {
  min-height: 22px;
  margin-top: 0.75rem;
  color: var(--primary-hover);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Results */

.results-area {
  align-self: start;
}

.results-area h2 {
  margin-bottom: 1rem;
  color: #0a174e;
  font-family: "Basic", serif;
  font-size: 1.3rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.result-card {
  padding: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.result-card span {
  display: block;
  min-height: 36px;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.result-card strong {
  display: block;
  color: #0a174e;
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.reading-box {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.reading-box div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.reading-box span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.reading-box strong {
  color: #0a174e;
  font-size: 0.85rem;
  text-align: right;
}

.limit-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.limit-box.exceeded {
  background: #fef2f2;
  border-color: #fecaca;
}

.limit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.limit-header span {
  color: #0a174e;
  font-size: 0.85rem;
  font-weight: 700;
}

.limit-header strong {
  color: var(--primary-hover);
  font-size: 0.85rem;
}

.limit-box.exceeded .limit-header strong {
  color: #b91c1c;
}

.progress-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  margin-top: 0.75rem;
  background: #dcebe5;
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.2s ease;
}

.limit-box.exceeded .progress-bar {
  background: #b91c1c;
}

.limit-box p {
  margin-top: 0.65rem;
  color: var(--primary-hover);
  font-size: 0.78rem;
  font-weight: 600;
}

.limit-box.exceeded p {
  color: #b91c1c;
}

/* Responsive */

@media (max-width: 900px) {
  .counter-layout {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 330px;
  }
}

@media (max-width: 680px) {
  .page-container {
    padding: 1rem 0.75rem 3rem;
  }

  .counter-heading {
    align-items: flex-start;
    padding: 1.1rem;
  }

  .heading-icon {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .heading-icon img {
    width: 34px;
    height: 34px;
  }

  .counter-layout {
    padding: 0.9rem;
  }

  .editor-area,
  .results-area {
    padding: 1rem;
  }

  textarea {
    min-height: 300px;
  }

  .button-group {
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}