/* SmartBrainApps Tools - Shared Styles
   Matches existing site design: Inter font, Indigo primary, Fuchsia accent, slate dark mode */

:root {
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-300: #a5b4fc;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-800: #3730a3;
  --primary-900: #312e81;
  --accent-400: #e879f9;
  --accent-500: #d946ef;
  --accent-600: #c026d3;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-hover: #a5b4fc;
  --shadow: rgba(99, 102, 241, 0.08);
  --shadow-lg: rgba(99, 102, 241, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.2);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --bg-card: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --border-hover: #818cf8;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-lg: rgba(0, 0, 0, 0.5);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(51, 65, 85, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --bg-alt: #1e293b;
    --bg-card: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --border-hover: #818cf8;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(51, 65, 85, 0.3);
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font: inherit; }

/* Typography */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-title {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

/* Glass Effect */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

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

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.125rem;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav a {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--primary-600);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  transition: background var(--transition);
}

.btn-icon:hover { background: var(--bg-alt); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-600);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--primary-700);
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

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

.btn-secondary:hover {
  border-color: var(--primary-300);
  box-shadow: 0 4px 12px var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
}

.btn-ghost:hover { color: var(--primary-600); background: var(--primary-50); }

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }

.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; transform: translateY(-1px); }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px var(--shadow);
  transform: translateY(-2px);
}

.card-flat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* Tool Cards */
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-decoration: none;
}

.tool-card:hover {
  border-color: var(--primary-300);
  box-shadow: 0 12px 40px var(--shadow);
  transform: translateY(-3px);
}

.tool-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
}

.tool-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

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

.tool-card-badges {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-free { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-fast { background: rgba(99, 102, 241, 0.1); color: var(--primary-500); }
.badge-browser { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-new { background: rgba(236, 72, 153, 0.1); color: #ec4899; }

/* Category Cards */
.category-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-decoration: none;
}

.category-card:hover {
  border-color: var(--primary-300);
  box-shadow: 0 8px 30px var(--shadow);
  transform: translateY(-2px);
}

.category-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 1rem;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--bg) 50%, rgba(217, 70, 239, 0.05) 100%);
  z-index: -1;
}

[data-theme="dark"] .hero::before,
@media (prefers-color-scheme: dark) { .hero::before {
  background: linear-gradient(135deg, rgba(99,102,241,0.05) 0%, var(--bg) 50%, rgba(217,70,239,0.03) 100%);
}}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  line-height: 1.1;
}

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

/* Search */
.search-container {
  max-width: 560px;
  margin: 0 auto 3rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  border-radius: 50px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  box-shadow: 0 4px 20px var(--shadow);
}

.search-input:focus {
  border-color: var(--primary-400);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.search-input::placeholder { color: var(--text-light); }

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

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  background: var(--bg-alt);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-400);
  background: rgba(99, 102, 241, 0.03);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.upload-zone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary-100), var(--primary-50));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-500);
}

[data-theme="dark"] .upload-zone-icon {
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.1));
}

.upload-zone-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.upload-zone-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.upload-zone-formats {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Tool Workspace */
.tool-workspace {
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}

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

.tool-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.tool-header p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-light);
}

.breadcrumbs a { color: var(--text-muted); transition: color var(--transition); }
.breadcrumbs a:hover { color: var(--primary-600); }
.breadcrumbs .sep { color: var(--text-light); }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* Preview Container */
.preview-container {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  overflow: hidden;
  position: relative;
}

.preview-container img,
.preview-container canvas {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

/* Controls Panel */
.controls-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.control-group {
  margin-bottom: 1.25rem;
}

.control-group:last-child { margin-bottom: 0; }

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.control-value {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Range Slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  transition: background var(--transition);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-500);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Select */
.form-select {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.form-select:focus { border-color: var(--primary-400); }

/* Input */
.form-input {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus { border-color: var(--primary-400); }

/* Textarea */
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  resize: vertical;
  min-height: 120px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  transition: border-color var(--transition);
}

.form-textarea:focus { border-color: var(--primary-400); }

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

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideInRight 0.3s ease-out;
  max-width: 360px;
}

.toast-success { border-left: 3px solid #10b981; }
.toast-error { border-left: 3px solid #ef4444; }
.toast-info { border-left: 3px solid var(--primary-500); }

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

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-alt) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 3rem 1rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: 80rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-brand p { color: var(--text-muted); font-size: 0.875rem; margin-top: 1rem; }

.footer-links h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 1rem;
}

.footer-links ul { list-style: none; }

.footer-links li { margin-bottom: 0.5rem; }

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--primary-600); }

.footer-bottom {
  max-width: 80rem;
  margin: 2rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-light);
}

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

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

/* Responsive */
@media (max-width: 768px) {
  .header-nav { display: none; }
  .hero { padding: 3rem 1rem; }
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .tool-workspace { padding: 1rem; }
  .section-title { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .categories-grid { grid-template-columns: 1fr; }
}

/* Utility */
.container { max-width: 80rem; margin: 0 auto; padding: 0 1rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Tab System */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-600); border-bottom-color: var(--primary-600); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-backdrop.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.3s;
}

.modal-backdrop.active .modal { transform: scale(1); }

/* Progress Bar */
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
  transition: width 0.3s;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* Ad Placeholder */
.ad-placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.75rem;
  background: var(--bg-alt);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* Color squares for gradients */
.gradient-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.gradient-purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.gradient-pink { background: linear-gradient(135deg, #ec4899, #d946ef); }
.gradient-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.gradient-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.gradient-green { background: linear-gradient(135deg, #10b981, #059669); }
.gradient-amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.gradient-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.gradient-orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.gradient-teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }
