/**
 * EB-005: Word and Character Counter Stylesheet
 * Responsive, accessible layout adhering strictly to tokens.css
 */

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-12);
}

/* Tool Header */
.tool-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto var(--space-8);
}

.tool-badge-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-1) var(--space-3);
  background-color: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

.tool-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-success);
}

.tool-title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  line-height: 1.2;
}

.tool-description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Primary Metric Cards Grid */
.metrics-hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 768px) {
  .metrics-hero-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  background-color: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast), border-color var(--duration-fast);
}

.metric-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
}

.metric-value {
  font-size: clamp(1.5rem, 2.5vw, 2.25rem);
  font-weight: 700;
  color: var(--brand-blue);
  line-height: 1.1;
  margin-bottom: var(--space-1);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* Secondary Meta Pills */
.secondary-pills-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.meta-pill {
  background-color: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}

.meta-pill strong {
  color: var(--text-primary);
}

/* Goal Tracker Card */
.goal-tracker-card {
  background-color: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.goal-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.goal-input {
  width: 90px;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  background-color: var(--surface-base);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  outline: none;
}

.goal-input:focus {
  border-color: var(--brand-blue);
}

.goal-progress-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.goal-progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--surface-base);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.goal-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--brand-blue);
  border-radius: var(--radius-full);
  transition: width var(--duration-fast) var(--ease-default);
}

.goal-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Main Workspace Dual Column */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: var(--space-6);
  margin-bottom: var(--space-10);
  align-items: start;
}

@media (max-width: 992px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* Editor Section */
.editor-card {
  background-color: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background-color: var(--surface-base);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.action-btn:hover {
  color: var(--text-primary);
  background-color: var(--surface-hover);
  border-color: var(--border-subtle);
}

.action-btn.active {
  color: var(--brand-blue);
  background-color: var(--brand-blue-subtle);
  border-color: var(--brand-blue);
}

.editor-textarea {
  width: 100%;
  min-height: 440px;
  padding: var(--space-4);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--surface-raised);
  border: none;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}

.editor-textarea:focus {
  background-color: var(--surface-base);
}

.editor-footer-status {
  padding: var(--space-2) var(--space-4);
  background-color: var(--surface-base);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Analytics Sidebar Tabs & Cards */
.analytics-card {
  background-color: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.analytics-nav {
  display: flex;
  background-color: var(--surface-base);
  border-bottom: 1px solid var(--border-subtle);
}

.analytics-tab {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all var(--duration-fast);
}

.analytics-tab:hover {
  color: var(--text-primary);
}

.analytics-tab.active {
  color: var(--brand-blue);
  border-bottom-color: var(--brand-blue);
  background-color: var(--surface-raised);
}

.tab-pane {
  display: none;
  padding: var(--space-4);
  animation: fadeIn var(--duration-fast) ease;
}

.tab-pane.active {
  display: block;
}

/* Readability Widgets */
.readability-score-box {
  background-color: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  margin-bottom: var(--space-4);
}

.readability-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-success);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.readability-grade {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.readability-desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.time-estimates-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.time-estimate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background-color: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
}

.time-estimate-item strong {
  color: var(--text-primary);
}

/* Keyword Density Table */
.density-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.density-tabs {
  display: flex;
  gap: 4px;
}

.density-tab-btn {
  padding: 2px 8px;
  font-size: var(--text-xs);
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.density-tab-btn.active {
  background: var(--brand-blue-subtle);
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.density-table-wrap {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.density-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  text-align: left;
}

.density-table th, .density-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.density-table th {
  background-color: var(--surface-base);
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.density-table tr:hover {
  background-color: var(--surface-hover);
}

/* Platform Limits List */
.platform-limits-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.platform-item {
  background-color: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.platform-header {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.platform-header span:first-child {
  color: var(--text-primary);
}

.platform-header span:last-child {
  color: var(--text-muted);
}

.platform-progress-bg {
  width: 100%;
  height: 6px;
  background-color: var(--surface-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.platform-progress-fill {
  height: 100%;
  background-color: var(--brand-blue);
  border-radius: var(--radius-full);
  transition: width var(--duration-fast);
}

.platform-progress-fill.exceeded {
  background-color: var(--color-error);
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--duration-normal) var(--ease-default);
  pointer-events: none;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
