/* ── AMBIENT GLOW ── */
.editor-ambient {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.editor-ambient::before {
  content: '';
  position: absolute; top: -20%; left: -5%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,0,127,0.05) 0%, transparent 70%);
  border-radius: 50%;
  animation: edDrift1 18s ease-in-out infinite alternate;
}
.editor-ambient::after {
  content: '';
  position: absolute; bottom: -20%; right: -5%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,238,252,0.04) 0%, transparent 70%);
  border-radius: 50%;
  animation: edDrift2 22s ease-in-out infinite alternate;
}
@keyframes edDrift1 { from { transform: translate(0,0); } to { transform: translate(60px,40px); } }
@keyframes edDrift2 { from { transform: translate(0,0); } to { transform: translate(-50px,-60px); } }

/* ── BODY & WRAPPER ── */
body {
  font-family: 'Space Grotesk', sans-serif;
  padding-top: 72px;
  min-height: 100vh;
}

.editor-wrap {
  width: 90%;
  max-width: 800px;
  margin: 2rem auto 4rem;
  position: relative;
  z-index: 1;
}

/* ── PAGE TITLE ── */
.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  color: var(--on-surface, #f8f5fd);
  margin: 0 0 0.5rem;
}

.gradient-text {
  background: linear-gradient(90deg, #FF007F, #00eefc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255,0,127,0.3));
}

.description {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(248,245,253,0.4);
  margin: 0 0 2rem;
}

/* ── SECTIONS ── */
.input-section,
.results-section,
.editor-tips,
.social-share,
.advanced-options {
  margin-bottom: 1.5rem;
}

/* ── ADVANCED OPTIONS ── */
.advanced-options {
  background: rgba(37,37,44,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}

.advanced-options h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(248,245,253,0.5);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toggle-btn {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  color: #FF007F;
  cursor: pointer;
  font-weight: 700;
  display: inline-block;
}
.toggle-btn:hover { opacity: 0.75; }

/* Prevent pseudo-element conflicts from other stylesheets */
#toggle-advanced::before,
#toggle-advanced::after,
.toggle-btn::before,
.toggle-btn::after {
  content: none !important;
  display: none !important;
}

.tooltip {
  position: relative;
  display: inline-block;
  font-size: 0.78rem;
  color: rgba(248,245,253,0.3);
  cursor: help;
}
.tooltip:hover::after {
  content: attr(title);
  position: absolute;
  background: rgba(14,14,19,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(248,245,253,0.8);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
  z-index: 10;
  left: 50%;
  transform: translateX(-50%);
  bottom: 130%;
}

#advanced-content {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-group label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(248,245,253,0.35);
  margin-bottom: 5px;
}

.option-group select,
.option-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  background: rgba(14,14,19,0.6);
  color: var(--on-surface, #f8f5fd);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.option-group select:focus,
.option-group textarea:focus { border-color: rgba(255,0,127,0.4); }

.option-group select {
  height: 36px;
  cursor: pointer;
}

.option-group textarea {
  height: 72px;
  resize: vertical;
}

/* ── MAIN TEXTAREA ── */
#article-input {
  width: 100%;
  height: 160px;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.75rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
  background: rgba(37,37,44,0.5);
  backdrop-filter: blur(20px);
  color: var(--on-surface, #f8f5fd);
  outline: none;
  transition: border-color 0.2s;
}
#article-input:focus { border-color: rgba(255,0,127,0.4); }
#article-input::placeholder { color: rgba(248,245,253,0.2); }

/* ── WORD COUNT ── */
.count-display {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(248,245,253,0.25);
  text-align: right;
  margin-top: 4px;
  margin-bottom: 0.75rem;
}

/* ── INPUT CONTROLS ── */
.input-controls {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.file-upload { flex: 1; }
#file-upload { display: none; }

.file-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  color: rgba(248,245,253,0.7);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  box-sizing: border-box;
}
.file-upload-btn:hover {
  border-color: rgba(255,0,127,0.3);
  color: var(--on-surface, #f8f5fd);
  background: rgba(255,0,127,0.06);
}

#file-chosen {
  font-size: 0.68rem;
  color: rgba(248,245,253,0.25);
  display: block;
  margin-top: 5px;
  word-break: break-all;
}

.analyze-btn {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, #FF007F, #cc0066);
  border: none;
  border-radius: 9999px;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 0 20px rgba(255,0,127,0.3);
  white-space: nowrap;
}
.analyze-btn:hover { transform: scale(1.02); box-shadow: 0 0 28px rgba(255,0,127,0.45); }
.analyze-btn:active { transform: scale(0.98); }
.analyze-btn:disabled {
  background: rgba(255,255,255,0.06);
  color: rgba(248,245,253,0.25);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ── LOADING ── */
#loading {
  display: none;
  text-align: center;
  padding: 2rem;
  background: rgba(37,37,44,0.5);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 0.75rem;
  margin-top: 1rem;
}

#loading-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(248,245,253,0.6);
  margin: 0.75rem 0 1rem;
  font-style: italic;
}

.spinner {
  border: 3px solid rgba(255,255,255,0.08);
  border-top: 3px solid #FF007F;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#progress-bar {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border-radius: 9999px;
  margin-top: 1rem;
  overflow: hidden;
  height: 4px;
}
#progress {
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, #FF007F, #00eefc);
  transition: width 0.5s ease-in-out;
  border-radius: 9999px;
}

/* ── RESULTS ── */
.results-section {
  background: rgba(37,37,44,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.results-section h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(248,245,253,0.4);
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,0,127,0.2);
}

#analysis-results > div {
  background: rgba(14,14,19,0.5);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 0.6rem;
}

#analysis-results h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(248,245,253,0.4);
  margin: 0 0 0.75rem;
}

#analysis-results div,
#analysis-results p,
.analysis-section div {
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(248,245,253,0.75);
}

#edited-version {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  background: rgba(14,14,19,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 1rem;
  border-radius: 0.5rem;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.85rem;
  line-height: 1.65;
  color: rgba(248,245,253,0.8);
}

#readability-metrics p {
  margin: 6px 0;
  padding: 8px 12px;
  background: rgba(255,0,127,0.05);
  border: 1px solid rgba(255,0,127,0.1);
  border-radius: 6px;
  font-size: 0.82rem;
  color: rgba(248,245,253,0.7);
}
#readability-metrics p:nth-child(even) {
  background: rgba(0,238,252,0.04);
  border-color: rgba(0,238,252,0.1);
}

/* ── BUTTONS ── */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  color: rgba(248,245,253,0.6);
  padding: 6px 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: border-color 0.2s, color 0.2s;
}
.copy-btn:hover { border-color: rgba(0,238,252,0.4); color: #00eefc; }

.download-options {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.download-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  color: rgba(248,245,253,0.6);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.download-btn:hover:not(:disabled) {
  border-color: rgba(255,0,127,0.4);
  color: var(--on-surface, #f8f5fd);
  background: rgba(255,0,127,0.06);
}
.download-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.new-analysis-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.5rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9999px;
  color: rgba(248,245,253,0.6);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  margin-top: 1.25rem;
  transition: border-color 0.2s, color 0.2s;
}
.new-analysis-btn:hover { border-color: rgba(255,0,127,0.4); color: #FF007F; }

.reset-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.5rem;
  color: rgba(248,245,253,0.4);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: border-color 0.2s, color 0.2s;
}
.reset-btn:hover { border-color: rgba(255,0,127,0.3); color: rgba(248,245,253,0.7); }

/* ── EDITOR TIPS ── */
.editor-tips {
  background: rgba(0,238,252,0.04);
  border: 1px solid rgba(0,238,252,0.12);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
}

.editor-tips h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #00eefc;
  margin: 0 0 0.75rem;
}

.editor-tips ul {
  padding-left: 1.25rem;
  margin: 0;
}
.editor-tips li {
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(248,245,253,0.5);
  margin-bottom: 0.4rem;
}

/* ── SOCIAL SHARE ── */
.social-share {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.share-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(248,245,253,0.4);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.share-btn[data-platform="twitter"]:hover { border-color: #1da1f2; color: #1da1f2; background: rgba(29,161,242,0.08); }
.share-btn[data-platform="facebook"]:hover { border-color: #4267b2; color: #4267b2; background: rgba(66,103,178,0.08); }
.share-btn[data-platform="linkedin"]:hover { border-color: #0077b5; color: #0077b5; background: rgba(0,119,181,0.08); }

/* ── FOCUS ACCESSIBILITY ── */
.file-upload-btn:focus,
.analyze-btn:focus,
.download-btn:focus,
.copy-btn:focus,
.new-analysis-btn:focus,
.reset-btn:focus,
.share-btn:focus {
  outline: 2px solid rgba(255,0,127,0.5);
  outline-offset: 2px;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .input-controls { flex-direction: column; }
  .file-upload, .analyze-btn { width: 100%; }
  .download-options { flex-direction: column; }
  .tooltip:hover::after { white-space: normal; width: 200px; }
}
