/* ==========================================================================
   ToolNova Design System: Modern Glassmorphism, CSS Variables, Responsive
   ========================================================================== */

:root {
  /* Dark Mode Palette (Default) */
  --bg-main: #0b0f19;
  --bg-surface: rgba(18, 24, 38, 0.7);
  --bg-surface-hover: rgba(30, 41, 59, 0.8);
  --bg-card: rgba(23, 32, 51, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --accent: #38bdf8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  --glass-blur: blur(16px);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.3);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --bg-surface-hover: rgba(241, 245, 249, 0.95);
  --bg-card: rgba(255, 255, 255, 0.75);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient Animated Glow Accents */
.bg-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}
.bg-glow-1 { top: -100px; left: -100px; background: #6366f1; }
.bg-glow-2 { bottom: -100px; right: -100px; background: #ec4899; }

/* Glassmorphic Utilities */
.glass {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
}

/* Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1.5rem;
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.brand-icon {
  color: var(--primary);
  font-size: 1.8rem;
}
.brand-text span {
  color: var(--primary);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}
.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
}

.icon-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.icon-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

/* Layout */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}
.view.active {
  display: block;
}

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

/* Hero Section */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  max-width: 750px;
  margin: 0 auto;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 0.85rem;
}
.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

/* Search Bar */
.search-box {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}
.search-icon {
  color: var(--text-dim);
}
.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
.clear-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
}

/* Category Filters */
.categories-wrapper {
  margin: 2rem 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.categories-wrapper::-webkit-scrollbar { display: none; }

.categories-scroll {
  display: flex;
  gap: 0.5rem;
  min-width: max-content;
}
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.cat-pill.active, .cat-pill:hover {
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Tools Grid */
.tool-section {
  margin-bottom: 2.5rem;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}
.section-icon {
  color: var(--primary);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.tool-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg);
}
.tool-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.tool-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
}
.tool-fav-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition);
}
.tool-fav-btn.active {
  color: var(--warning);
}
.tool-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.tool-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.tool-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* Tool Dynamic View Container */
.tool-header {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.tool-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.tool-active-icon {
  font-size: 2.2rem;
  color: var(--primary);
}
.tool-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}
.tool-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tool-container {
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  min-height: 400px;
}

/* Generic Tool Form Elements */
.tool-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 768px) {
  .tool-grid-2 { grid-template-columns: 1fr; }
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.2rem;
}
.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.tool-input, .tool-textarea, .tool-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}
.tool-textarea {
  min-height: 160px;
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
}
.tool-input:focus, .tool-textarea:focus, .tool-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.file-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.01);
}
.file-dropzone:hover, .file-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}
.dropzone-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  border-radius: var(--radius-lg);
}
.empty-state span {
  font-size: 3rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

/* Ads Placeholders */
.ad-slot {
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  position: relative;
  text-align: center;
  border: 1px dashed var(--border-color);
  background: rgba(0, 0, 0, 0.05);
}
.ad-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ad-placeholder-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 1.25rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast-icon { color: var(--success); }

.hidden { display: none !important; }