/* --- CSS Variables & Reset --- */
:root {
  --bg-body: #0f1115;
  --bg-card: #181b21;
  --bg-input: #0a0c0e;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --accent-primary: #a855f7;
  /* Purple 500 */
  --accent-hover: #9333ea;
  /* Purple 600 */
  --accent-glow: rgba(168, 85, 247, 0.2);
  --border-color: #2d3748;
  --success-color: #10b981;
  --error-color: #ef4444;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-md: 12px;
  --radius-sm: 6px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Layout & Typography --- */
header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(to bottom, #13151a, var(--bg-body));
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

main {
  flex: 1;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* --- Stats Bar --- */
.stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-item span {
  color: var(--accent-primary);
  font-weight: 700;
}

/* --- Text Input Area --- */
.input-wrapper {
  position: relative;
  margin-bottom: 2rem;
}

textarea {
  width: 100%;
  min-height: 250px;
  background-color: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 1.25rem;
  font-family: 'Courier New', Courier, monospace;
  /* Monospace for editing tools */
  font-size: 1rem;
  resize: vertical;
  transition: var(--transition);
}

textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

textarea::placeholder {
  color: #4b5563;
}

/* --- Quick Actions Toolbar --- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
  justify-content: space-between;
  align-items: center;
}

.tool-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

/* Primary Button Style */
.btn-primary {
  background-color: var(--accent-primary);
  color: white;
  padding: 0.6rem 1.2rem;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

/* Secondary Button Style */
.btn-secondary {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1rem;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  background-color: #23272f;
}

.btn-secondary.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* --- Tool Grid --- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* --- QR Code Section --- */
.qr-section {
  background: linear-gradient(145deg, var(--bg-card), #13151a);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}

.qr-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), #d8b4fe);
}

.qr-wrapper {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  display: inline-block;
  margin: 1.5rem auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  min-height: 180px;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-placeholder {
  color: #666;
  font-size: 0.9rem;
  text-align: center;
}

/* --- SEO & Content Sections --- */
.content-section {
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
}

.content-section h2 {
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.content-section h2::before {
  content: '#';
  color: var(--accent-primary);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.feature-block h3 {
  color: var(--text-main);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.feature-block p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

ul.feature-list {
  list-style: none;
}

ul.feature-list li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

ul.feature-list li::before {
  content: '•';
  color: var(--accent-primary);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer a {
  color: var(--accent-primary);
  text-decoration: none;
}

/* --- Toast Notification --- */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toast {
  background-color: var(--bg-card);
  color: var(--text-main);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease-out forwards;
  min-width: 250px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toast.error {
  border-left-color: var(--error-color);
}

.toast.success {
  border-left-color: var(--success-color);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  
  to {
    opacity: 0;
  }
}

/* --- Responsive Tweaks --- */
@media (max-width: 600px) {
  h1 {
    font-size: 1.5rem;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .tool-group {
    flex-direction: column;
    width: 100%;
  }
  
  button {
    width: 100%;
    justify-content: center;
  }
  
  .input-wrapper {
    margin-bottom: 1rem;
  }
}