/* Text Evaluator Custom Styles */

.evaluator-container {
  width: var(--container);
  margin: 40px auto 80px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 1100px) {
  .evaluator-container {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 20px;
  }
}

.evaluator-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-large);
  background: var(--gradient-card);
  backdrop-filter: blur(26px) saturate(180%);
  box-shadow: var(--shadow-card);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.evaluator-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

/* Header actions inside card */
.card-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.sample-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sample-select {
  background: rgba(10, 15, 30, 0.7);
  color: var(--ink);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-small);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.sample-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(46, 229, 157, 0.2);
}

/* Editor styling */
.editor-wrapper {
  position: relative;
  width: 100%;
}

.text-editor {
  width: 100%;
  min-height: 280px;
  max-height: 500px;
  background: rgba(3, 8, 18, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-medium);
  padding: 16px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.8;
  resize: vertical;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-editor:focus {
  border-color: var(--primary);
  background: rgba(3, 8, 18, 0.65);
  box-shadow: var(--shadow-glow);
}

.editor-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.7rem;
  flex-wrap: wrap;
  gap: 10px;
}

.editor-stats {
  display: flex;
  gap: 16px;
}

.editor-stat-item strong {
  color: var(--primary);
}

.editor-actions {
  display: flex;
  gap: 10px;
}

.editor-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--ink);
  border-radius: var(--radius-small);
  padding: 6px 12px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.editor-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.editor-btn.btn-clear:hover {
  background: rgba(255, 95, 143, 0.15);
  border-color: rgba(255, 95, 143, 0.3);
  color: var(--rose);
}

/* Dynamic scoring panel */
.score-dashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.radial-score-container {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.radial-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.radial-bg-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 10;
}

.radial-progress-circle {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 502; /* 2 * PI * r where r = 80 */
  stroke-dashoffset: 502;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 8px rgba(46, 229, 157, 0.4));
}

.radial-score-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.radial-score-value {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 15px rgba(46, 229, 157, 0.2));
}

.radial-score-max {
  font-size: 0.7rem;
  color: var(--faint);
  margin-top: 4px;
}

.score-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  margin-top: -10px;
  border: 1px solid transparent;
}

.badge-excellent {
  background: rgba(46, 229, 157, 0.1);
  border-color: rgba(46, 229, 157, 0.3);
  color: var(--primary);
  box-shadow: 0 0 15px rgba(46, 229, 157, 0.15);
}

.badge-good {
  background: rgba(90, 167, 255, 0.1);
  border-color: rgba(90, 167, 255, 0.3);
  color: var(--ai-blue);
}

.badge-average {
  background: rgba(255, 209, 102, 0.1);
  border-color: rgba(255, 209, 102, 0.3);
  color: var(--gold);
}

.badge-poor {
  background: rgba(255, 95, 143, 0.1);
  border-color: rgba(255, 95, 143, 0.3);
  color: var(--rose);
}

/* Category progress bars */
.categories-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-score-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-title i {
  width: 16px;
  text-align: center;
}

.category-value {
  color: var(--primary);
}

.category-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.category-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  width: 0%;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Colored progress bars */
.fill-grammar { background: var(--ai-cyan); }
.fill-readability { background: var(--primary); }
.fill-style { background: var(--ai-purple); }
.fill-structure { background: var(--ai-blue); }
.fill-impact { background: var(--gold); }

/* Insights and Corrections Panel */
.insights-panel {
  grid-column: span 2;
  margin-top: 10px;
}

@media (max-width: 1100px) {
  .insights-panel {
    grid-column: span 1;
  }
}

.insights-tabs {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
  gap: 16px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.insights-tabs::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.insights-tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 10px 4px 12px;
  cursor: pointer;
  position: relative;
  transition: color 0.25s;
  white-space: nowrap;
}

.insights-tab-btn:hover {
  color: #fff;
}

.insights-tab-btn.active {
  color: var(--primary);
}

.insights-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(46, 229, 157, 0.5);
}

.insights-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 120px;
}

.empty-insights-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--faint);
  gap: 12px;
}

.empty-insights-state i {
  font-size: 2.2rem;
  color: rgba(255, 255, 255, 0.12);
}

.insight-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.02);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  transition: all 0.25s ease;
  animation: fadeIn 0.4s ease both;
}

.insight-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(-4px);
}

[dir="ltr"] .insight-card:hover {
  transform: translateX(4px);
}

.insight-info-side {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex: 1;
}

.insight-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-small);
  font-size: 0.82rem;
  flex-shrink: 0;
}

.insight-card.type-error .insight-icon {
  background: rgba(255, 95, 143, 0.12);
  color: var(--rose);
}

.insight-card.type-warning .insight-icon {
  background: rgba(255, 209, 102, 0.12);
  color: var(--gold);
}

.insight-card.type-info .insight-icon {
  background: rgba(90, 167, 255, 0.12);
  color: var(--ai-blue);
}

.insight-card.type-suggestion .insight-icon {
  background: rgba(46, 229, 157, 0.12);
  color: var(--primary);
}

.insight-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insight-title {
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
}

.insight-text-quote {
  font-size: 0.7rem;
  color: var(--muted);
  font-style: italic;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin: 4px 0;
  border-left: 2px solid var(--faint);
}

[dir="rtl"] .insight-text-quote {
  border-left: none;
  border-right: 2px solid var(--faint);
}

.insight-description {
  color: var(--muted);
  font-size: 0.72rem;
}

.insight-action-side {
  flex-shrink: 0;
}

.insight-fix-btn {
  background: rgba(46, 229, 157, 0.1);
  border: 1px solid rgba(46, 229, 157, 0.3);
  color: var(--primary);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.insight-fix-btn:hover {
  background: var(--gradient-primary);
  color: #03120c;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 229, 157, 0.2);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Custom Highlighted View Overlay */
.highlight-overlay-container {
  position: relative;
  width: 100%;
}

.highlighted-viewer {
  width: 100%;
  min-height: 280px;
  max-height: 500px;
  background: rgba(3, 8, 18, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-medium);
  padding: 16px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.8;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Underlines for specific issues */
.highlight-error {
  border-bottom: 2px dashed var(--rose);
  background: rgba(255, 95, 143, 0.08);
  cursor: help;
  position: relative;
}

.highlight-warning {
  border-bottom: 2px dashed var(--gold);
  background: rgba(255, 209, 102, 0.08);
  cursor: help;
  position: relative;
}

.highlight-info {
  border-bottom: 2px dashed var(--ai-blue);
  background: rgba(90, 167, 255, 0.08);
  cursor: help;
  position: relative;
}

/* Mode toggles for editor vs preview */
.mode-toggles {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.mode-toggle-btn {
  background: none;
  border: none;
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.25s ease;
}

.mode-toggle-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.text-editor-container {
  display: none;
}

.text-editor-container.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Print/Report layout styles */
.printable-report {
  display: none;
}
