/* ==========================================================================
   Gears & Tools (gearsandtools.com) - Design System & Modern Styling
   ========================================================================== */

:root {
  /* Color Palette - Dark Mode Default */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-surface: #1f293d;
  --bg-surface-hover: #2d374d;
  --bg-glass: rgba(31, 41, 61, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  /* Accent Colors */
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.25);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.25);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.25);
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;

  /* Typography */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout & Shadows */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.15);
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --border-color: rgba(0, 0, 0, 0.08);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Glows */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  animation: pulseGlow 12s infinite alternate ease-in-out;
}

.glow-orb-1 {
  width: 550px;
  height: 550px;
  background: var(--accent-amber);
  top: -120px;
  right: -100px;
}

.glow-orb-2 {
  width: 600px;
  height: 600px;
  background: var(--accent-cyan);
  bottom: -150px;
  left: -150px;
  animation-delay: -6s;
}

@keyframes pulseGlow {
  0% { transform: scale(1) translate(0, 0); opacity: 0.25; }
  100% { transform: scale(1.15) translate(30px, 30px); opacity: 0.45; }
}

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

/* Header & Nav */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  transition: var(--transition);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand-logo svg {
  color: var(--accent-amber);
  filter: drop-shadow(0 0 8px var(--accent-amber-glow));
  animation: rotateGear 20s linear infinite;
}

@keyframes rotateGear {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.brand-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .nav-menu {
    display: none;
  }
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background: var(--bg-surface);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.domain-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.domain-pill:hover {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
  background: var(--bg-surface-hover);
}

.theme-toggle-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  transform: scale(1.05);
}

/* Breadcrumb Navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--accent-amber);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Hero Section */
.hero {
  padding: 3.5rem 0 2.5rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero-title span {
  background: linear-gradient(135deg, var(--accent-amber) 0%, #fbbf24 50%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 2.5rem;
}

/* Featured Tools Grid with Clean Buttons */
.tool-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
  margin-bottom: 4rem;
}

.hub-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.hub-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--card-accent, var(--accent-amber));
  opacity: 0.8;
  transition: var(--transition);
}

.hub-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}

.hub-card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--card-accent, var(--accent-amber));
  margin-bottom: 1.25rem;
}

.hub-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.hub-card-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  flex-grow: 1;
}

/* Clean Button Styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.2;
}

.btn-amber {
  background: var(--accent-amber);
  color: #000000;
  box-shadow: 0 4px 14px var(--accent-amber-glow);
}

.btn-amber:hover {
  background: #f59e0b;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-cyan {
  background: var(--accent-cyan);
  color: #000000;
  box-shadow: 0 4px 14px var(--accent-cyan-glow);
}

.btn-cyan:hover {
  background: #06b6d4;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-purple {
  background: var(--accent-purple);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-purple-glow);
}

.btn-purple:hover {
  background: #7c3aed;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-blue {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-blue-glow);
}

.btn-blue:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
}

.btn-full {
  width: 100%;
}

/* Dedicated Tool Workspaces */
.tool-page-header {
  margin-bottom: 2rem;
  text-align: center;
}

.tool-page-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.tool-page-desc {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 650px;
  margin: 0 auto;
}

.tool-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 3rem;
}

/* Common Form Elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.85rem 1.15rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.form-textarea {
  resize: vertical;
  min-height: 160px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

/* Stats Badges Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1rem 0.75rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 0.25rem;
}

.result-display {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--accent-amber);
  display: flex;
  align-items: center;
  justify-content: space-between;
  word-break: break-all;
}

/* Code Box & Math Output Panels */
.code-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

.step-card {
  background: var(--bg-surface);
  border-left: 4px solid var(--accent-purple);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.step-title {
  font-weight: 700;
  color: var(--accent-purple);
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.step-body {
  font-size: 0.95rem;
  color: var(--text-main);
}

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

.toast {
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--accent-amber);
  box-shadow: var(--shadow-md);
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Footer */
.footer {
  margin-top: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand {
  max-width: 340px;
}

.footer-links {
  display: flex;
  gap: 3rem;
}

.footer-col h4 {
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.footer-col a:hover {
  color: var(--accent-amber);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
}

.footer-bottom a {
  color: var(--accent-amber);
  text-decoration: none;
  font-weight: 600;
}
