/* CSS Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color Palette - Indigo/Purple/Cyan (Dark Theme) */
  --color-bg: #0a0a0f;
  --color-surface: #11111a;
  --color-surface-2: #1a1a26;
  --color-surface-3: #222233;
  --color-border: #2a2a3a;
  --color-border-light: #3a3a4a;
  
  --color-primary: #6366f1;
  --color-primary-light: #818cf8;
  --color-primary-dark: #4f46e5;
  --color-secondary: #06b6d4;
  --color-secondary-light: #22d3ee;
  --color-accent: #a855f7;
  --color-accent-light: #c084fc;
  
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-text-light: #f8fafc;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

:root[data-theme="light"] {
  /* Light Theme Colors */
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-2: #f1f5f9;
  --color-surface-3: #e2e8f0;
  --color-border: #cbd5e1;
  --color-border-light: #94a3b8;
  
  --color-primary: #6366f1;
  --color-primary-light: #818cf8;
  --color-primary-dark: #4f46e5;
  --color-secondary: #06b6d4;
  --color-secondary-light: #22d3ee;
  --color-accent: #a855f7;
  --color-accent-light: #c084fc;
  
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-text-light: #0f172a;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  z-index: -1;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle at center, var(--color-primary), transparent 70%);
  top: -200px;
  right: -200px;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle at center, var(--color-accent), transparent 70%);
  bottom: -150px;
  left: -150px;
}

.bg-glow-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle at center, var(--color-secondary), transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

:root[data-theme="light"] .bg-glow {
  opacity: 0.08;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(10, 10, 15, 0.8);
  border-bottom: 1px solid var(--color-border);
}

:root[data-theme="light"] .header {
  background: rgba(248, 250, 252, 0.8);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-search {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

#toolSearch {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.95rem;
  transition: all var(--transition-base);
}

#toolSearch:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
  background: var(--color-surface-2);
}

.search-shortcut {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.25rem 0.5rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--color-text-muted);
  user-select: none;
}

/* Theme Toggle */
.theme-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.theme-toggle:hover {
  background: var(--color-surface-2);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.theme-icon {
  position: absolute;
  transition: all var(--transition-base);
}

.theme-icon.sun {
  opacity: 0;
  transform: rotate(90deg);
}

.theme-icon.moon {
  opacity: 1;
  transform: rotate(0);
}

:root[data-theme="light"] .theme-icon.sun {
  opacity: 1;
  transform: rotate(0);
}

:root[data-theme="light"] .theme-icon.moon {
  opacity: 0;
  transform: rotate(-90deg);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  margin-left: 0.5rem;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Tools Grid */
.tools-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(99, 102, 241, 0.05), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.tool-card-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

.tool-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-light);
}

.tool-card-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Tool Panel */
.tool-panel {
  max-width: 1000px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  animation: fadeIn 0.3s ease;
}

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

.tool-panel-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.back-btn:hover {
  background: var(--color-surface-2);
  border-color: var(--color-primary);
}

.tool-panel-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text-light);
}

.tool-panel-body {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.tool-section {
  margin-bottom: 2rem;
}

.tool-section:last-child {
  margin-bottom: 0;
}

.tool-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text-light);
}

.tool-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tool-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.tool-input, .tool-textarea, .tool-select {
  padding: 0.875rem 1rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: 'JetBrains Mono', monospace;
  transition: all var(--transition-fast);
}

.tool-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.tool-input:focus, .tool-textarea:focus, .tool-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tool-button {
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.tool-button:active {
  transform: translateY(0);
}

.tool-button-secondary {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.tool-button-secondary:hover {
  background: var(--color-surface-3);
  border-color: var(--color-primary);
}

.button-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.tool-output {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  position: relative;
}

.tool-output.empty {
  color: var(--color-text-muted);
  font-style: italic;
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.375rem 0.75rem;
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background: var(--color-surface);
  border-color: var(--color-primary);
}

.tool-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tool-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.tool-option-label {
  font-size: 0.875rem;
  color: var(--color-text);
}

/* QR Code Container */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

#qrCanvas {
  background: white;
  border-radius: var(--radius-md);
  padding: 1rem;
}

/* Color Picker */
.color-picker-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.color-picker {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
}

.color-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface-2);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

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

/* Responsive */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .header-search {
    max-width: 100%;
  }
  
  .hero {
    padding: 3rem 1rem;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem 3rem;
  }
  
  .tool-panel {
    padding: 0 1rem;
  }
  
  .tool-panel-body {
    padding: 1.5rem;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .tool-button {
    width: 100%;
    justify-content: center;
  }
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.pulse {
  animation: pulse 2s infinite;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-light);
}
