/* === Pro CSS with Advanced Animations & Colourful Dashboard === */
:root {
  --primary: #5b21b6;
  --secondary: #06b6d4;
  --error: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --bg: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
  --shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: #111827;
  min-height: 100vh;
  padding: 20px;
}
.container { max-width: 1400px; margin: 0 auto; }
.header {
  text-align: center;
  padding: 2.5rem 2rem;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  border-radius: 20px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
  animation: slideDown 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
.header h1 { font-size: 2.8rem; font-weight: 700; }
.header p { opacity: 0.95; margin-top: 10px; font-size: 1.1rem; font-weight: 300; }

/* Colourful Professional Dashboard */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.stat-card {
  background: white;
  padding: 25px;
  border-radius: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.stat-card:hover { 
  transform: translateY(-10px) scale(1.02); 
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15); 
}
.stat-value { font-size: 2.5rem; font-weight: 700; color: var(--primary); margin-bottom: 5px; }
.stat-label { font-size: 0.95rem; color: #6b7280; font-weight: 400; }

.main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
.editor, .results {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow);
  animation: slideUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.editor h2, .results h2 { margin-bottom: 20px; color: #111827; font-weight: 600; font-size: 1.4rem; }

.input-wrapper {
  position: relative;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}
.input-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.1); }
#highlight { 
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 18px; 
  pointer-events: none; white-space: pre-wrap; word-wrap: break-word; font: inherit; 
  color: transparent; z-index: 1; line-height: 1.7; 
}
#text-input {
  width: 100%; min-height: 320px; padding: 18px; border: none; font-size: 16px; line-height: 1.7; 
  resize: vertical; background: transparent; z-index: 2; position: relative;
}
#text-input:focus { outline: none; }

.highlight { padding: 0 3px; border-radius: 4px; transition: all 0.2s; }
.error { background: rgba(220, 38, 38, 0.15); border-bottom: 2px solid var(--error); animation: shake 0.5s ease-in-out; }
.warning { background: rgba(217, 119, 6, 0.15); border-bottom: 2px solid var(--warning); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

.controls { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; }
.btn {
  padding: 14px 24px; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; 
  display: flex; align-items: center; gap: 10px; font-size: 15px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #4c1d95; transform: translateY(-2px); box-shadow: 0 10px 20px rgba(91, 33, 182, 0.3); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; transform: translateY(-2px); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; transform: translateY(-2px); }

.legend {
  display: flex; gap: 25px; font-size: 0.95rem; color: #6b7280; margin-bottom: 20px;
}
.legend span { display: flex; align-items: center; gap: 8px; }
.color { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }
.color.error { background: var(--error); }
.color.warning { background: var(--warning); }

.results-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; 
  padding-bottom: 15px; border-bottom: 1px solid #e5e7eb;
}
.btn-download { background: var(--secondary); color: white; padding: 12px 20px; font-size: 14px; }
.btn-download:hover { background: #0e7490; transform: translateY(-2px); }

.score-circle {
  display: flex; align-items: center; gap: 25px; margin-bottom: 30px; padding: 25px; 
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb); border-radius: 16px;
}
.circle {
  width: 100px; height: 100px; border-radius: 50%; display: flex; align-items: center; justify-content: center; 
  font-weight: bold; font-size: 1.5rem; position: relative;
  background: conic-gradient(var(--error) 0deg, var(--warning) 90deg, var(--success) 180deg, var(--success) 360deg);
  animation: spin 3s linear infinite paused;
}
.circle.animate { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.circle::before { content: ''; position: absolute; width: 82px; height: 82px; background: white; border-radius: 50%; }
.circle span { z-index: 1; color: #111827; }

.info-box { 
  background: #f9fafb; padding: 20px; border-radius: 14px; margin-bottom: 25px; 
  border-left: 5px solid var(--primary); box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
#tone-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.tone-tag { 
  background: linear-gradient(135deg, var(--primary), #7c3aed); color: white; 
  padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 500;
}

#issue-list { list-style: none; max-height: 400px; overflow-y: auto; }
#issue-list li {
  padding: 16px; margin-bottom: 12px; background: #f9fafb; border-radius: 12px; 
  border-left: 5px solid var(--error); cursor: pointer; transition: all 0.3s ease;
}
#issue-list li.warning { border-left-color: var(--warning); }
#issue-list li:hover { transform: translateX(8px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); background: #f3f4f6; }
#issue-list li strong { color: #111827; }
.suggestion { color: var(--success); font-weight: 600; display: block; margin-top: 8px; }

.export-buttons { display: flex; gap: 12px; margin-top: 25px; }
.export-buttons button { 
  flex: 1; padding: 12px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 10px; cursor: pointer; 
  font-size: 0.9rem; font-weight: 500; transition: all 0.3s;
}
.export-buttons button:hover { background: #e5e7eb; transform: translateY(-1px); }

.loading { text-align: center; padding: 50px; }
.spinner {
  width: 50px; height: 50px; border: 4px solid #f3f4f6; border-top: 4px solid var(--primary); 
  border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px;
}
.hidden { display: none !important; }

@media (max-width: 768px) { 
  .main { grid-template-columns: 1fr; gap: 20px; } 
  .header h1 { font-size: 2.2rem; }
  .controls { flex-direction: column; }
  .dashboard { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}