/* === CSS Variables === */
:root {
  --bg: #fafbfc;
  --bg-card: #ffffff;
  --bg-elevated: #f0f2f5;
  --text: #1a1a2e;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #334155;
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-light: #1e1b4b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

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

/* === Navbar === */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.logo-icon { font-size: 1.6rem; }
.nav-links { display: flex; gap: 24px; }
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--primary); }

.theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); }
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun,
:root:not([data-theme="dark"]) .icon-sun { display: none; }
[data-theme="light"] .icon-moon,
:root:not([data-theme="dark"]) .icon-moon { display: inline; }

/* === Hero === */
.hero {
  padding: 80px 0 48px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.highlight {
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 36px;
  line-height: 1.7;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === Tool Section === */
.tool-section {
  padding: 24px 0 64px;
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.drop-zone.drag-over {
  transform: scale(1.01);
}
.drop-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.drop-content h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.drop-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-large {
  padding: 14px 36px;
  font-size: 1.05rem;
  width: 100%;
  justify-content: center;
}
.btn-icon { font-size: 1.2rem; }

/* Controls */
.controls {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 160px;
}
.control-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-elevated);
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: var(--shadow-sm);
}
.select, .input {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
}
.select:focus, .input:focus { outline: none; border-color: var(--primary); }

/* Preview Area */
.preview-area { margin-top: 32px; }
.image-list { display: flex; flex-direction: column; gap: 12px; }
.image-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.image-preview {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg);
}
.image-info { flex: 1; min-width: 150px; }
.image-name {
  font-weight: 600;
  font-size: 0.9rem;
  word-break: break-all;
  margin-bottom: 4px;
}
.image-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.image-result {
  text-align: right;
  min-width: 120px;
}
.compression-saved {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--success);
}
.compression-detail {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.image-actions {
  display: flex;
  gap: 8px;
}
.btn-download {
  padding: 8px 16px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-download:hover { filter: brightness(1.1); }
.btn-remove {
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-remove:hover { border-color: var(--danger); color: var(--danger); }

/* === Features === */
.features-section {
  padding: 80px 0;
}
.features-section h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 48px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.feature-icon { font-size: 2rem; margin-bottom: 16px; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.7; }

/* === Support === */
.support-section {
  padding: 0 0 80px;
}
.support-card {
  background: linear-gradient(135deg, var(--primary-light), var(--bg-card));
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
}
.support-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.support-card p {
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 28px;
}
.support-options {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.btn-support {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
}
.btn-kofi {
  background: #ff5e5b;
  color: white;
}
.btn-kofi:hover { background: #e54e4b; transform: translateY(-1px); }
.btn-github {
  background: #24292e;
  color: white;
}
.btn-github:hover { background: #1a1f23; transform: translateY(-1px); }
.support-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Share Buttons */
.share-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.share-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.btn-share {
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--bg);
}
.btn-share:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-twitter:hover { background: #1d9bf0; color: white; border-color: #1d9bf0; }
.btn-reddit:hover { background: #ff4500; color: white; border-color: #ff4500; }
.btn-hn:hover { background: #ff6600; color: white; border-color: #ff6600; }

/* === Footer === */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}
.footer p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* === Toast === */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

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

/* === Responsive === */
@media (max-width: 768px) {
  .hero { padding: 48px 0 32px; }
  .hero-stats { gap: 24px; }
  .tool-card { padding: 24px 16px; }
  .drop-zone { padding: 40px 16px; }
  .controls { flex-direction: column; }
  .control-group { min-width: 100%; }
  .image-item { flex-direction: column; align-items: flex-start; }
  .image-result { text-align: left; }
  .features-grid { grid-template-columns: 1fr; }
  .support-card { padding: 32px 20px; }
  .navbar .nav-links { display: none; }
}
