/* ════════ WORD & CHARACTER COUNTER STYLES ════════ */

:root {
  --tool-indigo: #6366f1;
  --tool-indigo-hover: #4f46e5;
  --tool-indigo-soft: rgba(99, 102, 241, 0.08);
  --tool-indigo-glow: rgba(99, 102, 241, 0.2);
  --warning-amber: #f59e0b;
  --warning-amber-glow: rgba(245, 158, 11, 0.2);
  --danger-red: #ef4444;
  --danger-red-glow: rgba(239, 68, 68, 0.2);
}

body.light {
  --tool-indigo: #4f46e5;
  --tool-indigo-hover: #3730a3;
  --tool-indigo-soft: rgba(79, 70, 229, 0.08);
  --tool-indigo-glow: rgba(79, 70, 229, 0.2);
  --warning-amber: #d97706;
  --warning-amber-glow: rgba(217, 119, 6, 0.25);
  --danger-red: #dc2626;
  --danger-red-glow: rgba(220, 38, 38, 0.25);
}

/* ─── CONTAINER UI STANDARD WIDTH ─── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

/* ─── LAYOUT GRID RATIO OVERRIDE ─── */
.tool-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

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

/* ─── UNIFIED EDITOR CARD WRAPPER ─── */
.editor-box-wrapper {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.editor-box-wrapper:focus-within {
  border-color: var(--tool-indigo-glow);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 0 3px var(--tool-indigo-soft);
}

body.light .editor-box-wrapper {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

body.light .editor-box-wrapper:focus-within {
  border-color: var(--tool-indigo);
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.08), 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ─── TOOLBAR BUTTONS ─── */
.textarea-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.light .textarea-toolbar {
  background: #f8fafc;
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: 'Figtree', sans-serif;
}

.toolbar-btn:hover {
  background: var(--tool-indigo-soft);
  border-color: var(--tool-indigo-glow);
  color: var(--tool-indigo);
  transform: translateY(-1px);
}

body.light .toolbar-btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

body.light .toolbar-btn:hover {
  background: var(--tool-indigo-soft);
  border-color: var(--tool-indigo);
  color: var(--tool-indigo);
}

.toolbar-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent !important;
  color: var(--text-3) !important;
  border-color: transparent !important;
  transform: none !important;
}

/* ─── TEXTAREA INPUT STYLES ─── */
#text-input {
  width: 100%;
  min-height: 280px;
  padding: 18px 20px;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Figtree', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}

body.light #text-input {
  color: #0f172a;
}

#text-input::placeholder {
  color: var(--text-3);
}

body.light #text-input::placeholder {
  color: #94a3b8;
}

/* ─── STATUS BAR ─── */
.text-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-family: 'Figtree', sans-serif;
  font-weight: 600;
}

body.light .text-status-bar {
  background: #f8fafc;
  border-top-color: rgba(15, 23, 42, 0.08);
}

.status-badge-item {
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body.light .status-badge-item {
  color: #64748b;
}

.status-badge-item.privacy-badge {
  color: var(--tool-indigo);
  background: var(--tool-indigo-soft);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--tool-indigo-glow);
}

body.light .status-badge-item.privacy-badge {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.2);
}

/* ─── METRIC CARD GRID ─── */
.metrics-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

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

.counter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  box-sizing: border-box;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.counter-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
}

.counter-title {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.counter-value {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

body.light .counter-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.02);
}

body.light .counter-card:hover {
  background: #ffffff;
  border-color: rgba(79, 70, 229, 0.3);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.08);
}

body.light .counter-title {
  color: #64748b;
}

body.light .counter-value {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ─── PLATFORM LIMITS PROGRESS BARS ─── */
.limit-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.limit-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.limit-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

body.light .limit-info {
  color: #334155;
}

.limit-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.limit-tracker {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
}

body.light .limit-tracker {
  color: #64748b;
}

.limit-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

body.light .limit-bar-container {
  background: rgba(15, 23, 42, 0.06);
}

.limit-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--tool-indigo), #818cf8);
  box-shadow: 0 0 8px var(--tool-indigo-glow);
  transition: width 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.limit-progress-bar.warning {
  background: linear-gradient(90deg, var(--warning-amber), #fbbf24);
  box-shadow: 0 0 8px var(--warning-amber-glow);
}

.limit-progress-bar.danger {
  background: linear-gradient(90deg, var(--danger-red), #f87171);
  box-shadow: 0 0 8px var(--danger-red-glow);
}

/* ─── FILE LOAD & DROP ZONE ─── */
.file-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.drop-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--tool-indigo-soft);
  border: 1px solid var(--tool-indigo-glow);
  color: var(--tool-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.file-drop-zone:hover .drop-icon-box {
  transform: scale(1.08);
}

.file-drop-zone:hover, .file-drop-zone.dragover {
  border-color: var(--tool-indigo);
  background: rgba(99, 102, 241, 0.04);
}

body.light .file-drop-zone {
  border-color: rgba(15, 23, 42, 0.12);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

body.light .file-drop-zone:hover, body.light .file-drop-zone.dragover {
  border-color: var(--tool-indigo);
  background: rgba(79, 70, 229, 0.04);
}

/* ─── DENSITY & SCORING COMPONENT VIEWS ─── */
.density-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.density-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
}

.density-label {
  width: 54px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.light .density-label {
  color: #334155;
}

.density-bar-wrapper {
  flex-grow: 1;
  height: 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

body.light .density-bar-wrapper {
  background: rgba(15, 23, 42, 0.05);
}

.density-bar-fill {
  height: 100%;
  background: var(--tool-indigo-soft);
  border-right: 2px solid var(--tool-indigo);
  border-radius: 4px;
}

.density-value {
  width: 48px;
  text-align: right;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  flex-shrink: 0;
}

body.light .density-value {
  color: #0f172a;
}

/* ─── READABILITY SCORING CARD ─── */
.readability-scores {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.readability-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

body.light .readability-metric {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.readability-metric-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

body.light .readability-metric-name {
  color: #475569;
}

.readability-metric-score-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.readability-score-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
}

body.light .readability-score-num {
  color: #0f172a;
}

.readability-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge-easy {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #34d399;
}

body.light .badge-easy {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.3);
  color: #059669;
}

.badge-med {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #f59e0b;
}

body.light .badge-med {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.3);
  color: #d97706;
}

.badge-hard {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

body.light .badge-hard {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  color: #dc2626;
}

/* ─── FIND & REPLACE DRAWER ─── */
.find-replace-drawer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px;
}

.find-replace-drawer.open {
  max-height: 160px;
  padding: 16px;
}

body.light .find-replace-drawer {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.08);
}

.find-replace-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

@media (max-width: 640px) {
  .find-replace-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ─── GRID LAYOUT SPACING OVERRIDES ─── */
.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  width: 100%;
}

.toolbox-btn {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  font-family: 'Figtree', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.toolbox-btn:hover {
  border-color: var(--tool-indigo-glow);
  background: var(--tool-indigo-soft);
  color: var(--tool-indigo);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

body.light .toolbox-btn {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

body.light .toolbox-btn:hover {
  background: var(--tool-indigo-soft);
  border-color: var(--tool-indigo);
  color: var(--tool-indigo);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

/* Sidebar selectors overrides */
.switch-row,
.switch-row span,
.fg label,
.lbl-text,
#volume-label,
select,
option {
  font-family: 'Figtree', sans-serif !important;
}

/* ─── TOGGLE SWITCH & CHECKBOX SIZE OVERRIDES ─── */
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--tool-indigo);
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 34px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.switch input:checked + .switch-slider {
  background-color: var(--tool-indigo);
  border-color: var(--tool-indigo);
}

.switch input:checked + .switch-slider:before {
  transform: translateX(22px);
}

body.light .switch-slider {
  background-color: rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.15);
}

body.light .switch input:checked + .switch-slider {
  background-color: var(--tool-indigo);
  border-color: var(--tool-indigo);
}
