/* ============================================
   Vaultool.com - Global Styles
   Modern, clean tool website design
   ============================================ */

/* CSS Custom Properties */
:root {
  --primary: #6366F1;
  --primary-dark: #4F46E5;
  --primary-light: #818CF8;
  --primary-50: #EEF2FF;
  --primary-100: #E0E7FF;
  --secondary: #8B5CF6;
  --accent: #06B6D4;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-secondary: #64748B;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --border-focus: #6366F1;
  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --error: #EF4444;
  --error-bg: #FEF2F2;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  --transition: 0.2s ease;
  --max-width: 1200px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

/* ============================================
   Header & Navigation
   ============================================ */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.9);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  outline: none;
  color: var(--text-secondary);
  font-size: 0.925rem;
  font-weight: 500;
  transition: color var(--transition), background-color var(--transition);
}

.nav a:hover,
.nav a.active {
  color: var(--primary);
  background: var(--primary-50);
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

.mobile-toggle svg {
  width: 24px;
  height: 24px;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #06B6D4 100%);
  padding: 80px 24px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 32px;
  line-height: 1.6;
}

.hero-search {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  outline: none;
  background: white;
  color: var(--text);
}

.hero-search input::placeholder {
  color: var(--text-light);
}

.hero-search .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 20px;
  height: 20px;
}

/* ============================================
   Main Content
   ============================================ */
.main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
}

/* Tool Page Layout */
.tool-page {
  max-width: 900px;
  margin: 0 auto;
}

.tool-header {
  margin-bottom: 32px;
}

.tool-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.tool-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ============================================
   Tool Cards Grid (Homepage)
   ============================================ */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-100);
  color: inherit;
}

.tool-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.5rem;
}

.tool-card-icon.blue { background: #EEF2FF; color: #6366F1; }
.tool-card-icon.green { background: #ECFDF5; color: #10B981; }
.tool-card-icon.purple { background: #F5F3FF; color: #8B5CF6; }
.tool-card-icon.orange { background: #FFF7ED; color: #F97316; }
.tool-card-icon.cyan { background: #ECFEFF; color: #06B6D4; }
.tool-card-icon.red { background: #FEF2F2; color: #EF4444; }
.tool-card-icon.yellow { background: #FEFCE8; color: #EAB308; }
.tool-card-icon.pink { background: #FDF2F8; color: #EC4899; }

.tool-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.tool-card .card-arrow {
  margin-top: 16px;
  color: var(--primary-light);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition);
}

.tool-card:hover .card-arrow {
  gap: 8px;
}

/* ============================================
   Tool Workspace (individual tool pages)
   ============================================ */
.tool-workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.925rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--primary-50);
  color: var(--primary);
  border: 1px solid var(--primary-100);
}

.btn-secondary:hover {
  background: var(--primary-100);
  color: var(--primary-dark);
}

.btn-outline {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: var(--primary-50);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  color: white;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #DC2626;
  color: white;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ============================================
   Form Elements
   ============================================ */
.input, .textarea, .select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: all var(--transition);
  outline: none;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-light);
}

.textarea {
  resize: vertical;
  min-height: 200px;
  line-height: 1.6;
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group {
  margin-bottom: 16px;
}

/* ============================================
   File Upload Area
   ============================================ */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-50);
}

.upload-area svg {
  width: 48px;
  height: 48px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.upload-area h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 4px;
}

.upload-area p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-area input[type="file"] {
  display: none;
}

/* ============================================
   Result Display
   ============================================ */
.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
}

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   Color Picker Specific
   ============================================ */
.color-preview {
  width: 100%;
  height: 120px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  transition: background-color 0.3s;
}

.color-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-inputs .form-group {
  margin-bottom: 0;
}

.color-palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition);
}

.color-swatch:hover {
  transform: scale(1.15);
}

/* ============================================
   Image Compressor Specific
   ============================================ */
.image-preview-area {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.image-preview-item {
  flex: 1;
  min-width: 250px;
}

.image-preview-item img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#e5e7eb 0% 25%, white 0% 50%) 50% / 20px 20px;
}

.image-preview-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-align: center;
}

.compression-stats {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.compression-stat {
  text-align: center;
  padding: 12px 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.compression-stat .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.compression-stat .label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ============================================
   Slider
   ============================================ */
.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.slider-container label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 100px;
}

.slider-container input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.slider-container .slider-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 40px;
  text-align: center;
}

/* ============================================
   Toggle / Switch
   ============================================ */
.toggle-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.toggle-btn {
  padding: 8px 16px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: inherit;
  border-right: 1px solid var(--border);
}

.toggle-btn:last-child {
  border-right: none;
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
}

.toggle-btn:hover:not(.active) {
  background: var(--bg);
}

/* ============================================
   Notification / Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: white;
  z-index: 1000;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s;
  box-shadow: var(--shadow-lg);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-info { background: var(--primary); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-copy {
  color: var(--text-light);
  font-size: 0.825rem;
}

/* ============================================
   Related Tools
   ============================================ */
.related-tools {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.related-tools h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.related-tool-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  color: var(--text);
  text-decoration: none;
}

.related-tool-link:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
  color: inherit;
}

.related-tool-link .icon {
  font-size: 1.25rem;
}

.related-tool-link span {
  font-weight: 500;
  font-size: 0.925rem;
}

/* ============================================
   Breadcrumb
   ============================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .separator {
  color: var(--text-light);
}

/* ============================================
   Features Section (Homepage)
   ============================================ */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.feature-item {
  text-align: center;
  padding: 24px;
}

.feature-item .icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-item p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ============================================
   Tool Area Container
   ============================================ */
.tool-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.tool-area textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  min-height: 150px;
  line-height: 1.6;
  outline: none;
  transition: border-color var(--transition);
}

.tool-area textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ============================================
   Stat Card (Word Counter)
   ============================================ */
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

/* Word Frequency */
.word-freq {
  margin-top: 20px;
}

.word-freq h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.freq-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================
   Upload Zone
   ============================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-50);
}

.upload-zone p {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.upload-zone small {
  color: var(--text-light);
}

/* ============================================
   Options Bar (Image Compressor)
   ============================================ */
.options-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.option-group select,
.option-group input[type="number"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

.slider {
  width: 120px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* Results Container */
.results {
  margin-top: 16px;
}

/* ============================================
   Editor Actions
   ============================================ */
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* ============================================
   Dual Pane Layout
   ============================================ */
.dual-pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.pane {
  display: flex;
  flex-direction: column;
}

.pane label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.pane textarea,
.pane pre,
.pane .json-output,
.pane .md-preview,
.pane > div:not(.editor-actions) {
  flex: 1;
  min-height: 280px;
  width: 100%;
}

/* ============================================
   Status Bar
   ============================================ */
.status-bar {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 12px;
}

.status-bar.success {
  background: var(--success-bg);
  color: var(--success);
}

.status-bar.error {
  background: var(--error-bg);
  color: var(--error);
}

.status-bar.info {
  background: var(--primary-50);
  color: var(--primary);
}

/* ============================================
   JSON Output
   ============================================ */
.json-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 300px;
  max-height: 500px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================
   Color Picker Section
   ============================================ */
.color-picker-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.color-preview-large {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: background-color 0.3s;
}

.color-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
}

.color-input-group input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--surface);
  outline: none;
}

.color-input-group input:focus {
  border-color: var(--border-focus);
}

.color-input-group .btn-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
}

/* Palette */
.palette-section {
  margin-top: 20px;
}

.palette-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.palette-row {
  display: flex;
  gap: 4px;
  border-radius: var(--radius);
  overflow: hidden;
  height: 48px;
}

.palette-row > div {
  flex: 1;
  cursor: pointer;
  transition: transform var(--transition);
  position: relative;
}

.palette-row > div:hover {
  transform: scaleY(1.2);
  z-index: 1;
}

.palette-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
}

.preset-colors h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

/* ============================================
   Markdown Preview
   ============================================ */
.md-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 300px;
  max-height: 500px;
  overflow: auto;
  line-height: 1.7;
}

.md-preview h1 { font-size: 1.75rem; margin-bottom: 12px; }
.md-preview h2 { font-size: 1.35rem; margin: 20px 0 10px; color: var(--primary); }
.md-preview h3 { font-size: 1.1rem; margin: 16px 0 8px; }
.md-preview code { background: var(--primary-50); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.9em; }
.md-preview strong { font-weight: 600; }
.md-preview blockquote { border-left: 3px solid var(--primary); padding-left: 16px; margin: 12px 0; color: var(--text-secondary); }
.md-preview ul { padding-left: 24px; margin: 8px 0; }
.md-preview li { margin-bottom: 4px; }
.md-preview hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .hero {
    padding: 48px 20px;
  }

  .nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
  }

  .nav.open {
    display: flex;
  }

  .mobile-toggle {
    display: block;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-workspace {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .color-inputs {
    grid-template-columns: 1fr;
  }

  .image-preview-area {
    flex-direction: column;
  }

  .tool-header h1 {
    font-size: 1.5rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .main {
    padding: 24px 16px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.65rem;
  }

  .tool-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .compression-stats {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }

/* Print styles */
@media print {
  .header, .footer, .nav, .mobile-toggle {
    display: none;
  }
  body {
    background: white;
  }
  .tool-workspace {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ============================================
   Tool Area (Tool Page Content Wrapper)
   ============================================ */
.tool-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.tool-area textarea,
.tool-area input[type="text"],
.tool-area input[type="number"],
.tool-area select {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.tool-area textarea {
  width: 100%;
  font-family: var(--font-mono);
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.tool-area textarea:focus,
.tool-area input[type="text"]:focus,
.tool-area input[type="number"]:focus,
.tool-area select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Editor Actions Bar */
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* Dual Pane Layout - textarea specific styles */
.pane textarea {
  width: 100%;
  height: 280px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--bg);
  resize: none;
  line-height: 1.6;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.pane textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Preview Area (for HTML preview) */
.preview-area {
  width: 100%;
  height: 280px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.7;
}

.preview-area h1,
.preview-area h2,
.preview-area h3 {
  margin: 1em 0 0.5em;
  color: #111;
}

.preview-area h1 {
  font-size: 1.8em;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.3em;
}

.preview-area h2 {
  font-size: 1.4em;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.2em;
}

.preview-area p {
  margin: 0.6em 0;
}

.preview-area code {
  background: #f3f4f6;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: #e11d48;
}

.preview-area pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1em 0;
}

.preview-area pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.preview-area blockquote {
  border-left: 4px solid #6366F1;
  padding: 0.5em 1em;
  margin: 1em 0;
  background: #f5f3ff;
  color: #555;
}

.preview-area ul,
.preview-area ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.preview-area table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.preview-area th,
.preview-area td {
  border: 1px solid #e5e7eb;
  padding: 0.5em 0.75rem;
  text-align: left;
}

.preview-area th {
  background: #f9fafb;
  font-weight: 600;
}

.preview-area a {
  color: #6366F1;
  text-decoration: underline;
}

.preview-area img {
  max-width: 100%;
  border-radius: 6px;
}

.preview-area hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 1.5em 0;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0 0.25rem;
}

.modal-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-body pre {
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.85rem;
  background: #f9fafb;
  padding: 1rem;
  border-radius: 8px;
  margin: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px 20px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: inherit;
  border-right: 1px solid var(--border);
}

.tab:last-child { border-right: none; }

.tab.active {
  background: var(--primary);
  color: white;
}

.tab:hover:not(.active) {
  background: var(--bg);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-50);
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.upload-zone small {
  color: var(--text-light);
  font-size: 0.8rem;
}

/* Options Bar (Image Compressor) */
.options-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.option-group input[type="number"],
.option-group select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

/* Slider (standalone) */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* Status Bar */
.status-bar {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 12px;
}

.status-bar.success {
  background: var(--success-bg);
  color: var(--success);
}

.status-bar.error {
  background: var(--error-bg);
  color: var(--error);
}

/* JSON Output */
.json-output {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 200px;
  max-height: 500px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Markdown Preview */
.md-preview {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  min-height: 200px;
  line-height: 1.7;
  color: var(--text);
  overflow: auto;
}

.md-preview h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 12px; }
.md-preview h2 { font-size: 1.35rem; font-weight: 600; margin: 20px 0 8px; }
.md-preview h3 { font-size: 1.1rem; font-weight: 600; margin: 16px 0 6px; }
.md-preview p { margin: 8px 0; }
.md-preview code {
  background: var(--primary-50);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875em;
}
.md-preview blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--text-secondary);
}
.md-preview ul, .md-preview ol { padding-left: 24px; margin: 8px 0; }
.md-preview li { margin: 4px 0; }
.md-preview hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Stat Cards (Word Counter) */
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

/* Word Frequency */
.word-freq { margin-top: 24px; }
.word-freq h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }

.freq-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.freq-tags span {
  display: inline-block;
  padding: 6px 14px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Color Picker Section */
.color-picker-section { margin-bottom: 32px; }

.color-preview-large {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  transition: background-color 0.3s;
}

.color-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
}

.color-input-group input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--bg);
  outline: none;
}

.color-input-group input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Palette */
.palette-section { margin-top: 24px; }
.palette-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }

.palette-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.palette-row .swatch {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.palette-row .swatch:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.palette-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
}

.preset-colors h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }

/* Results Container (Image Compressor) */
.results { margin-top: 20px; }

/* Responsive for new components */
@media (max-width: 768px) {
  .tool-area { padding: 20px; }
  .dual-pane { grid-template-columns: 1fr; }
  .editor-actions .btn { width: 100%; justify-content: center; }
  .options-bar { flex-direction: column; align-items: stretch; }
  .palette-row .swatch { width: 36px; height: 36px; }
  .freq-tags span { font-size: 0.8rem; padding: 4px 10px; }
}

@media (max-width: 480px) {
  .color-input-group { flex-wrap: wrap; }
  .color-input-group label { min-width: 100%; }
}

/* ============================================
   Dark Mode
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F172A;
    --surface: #1E293B;
    --text: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-light: #64748B;
    --border: #334155;
    --border-focus: #818CF8;
    --primary-50: #1E1B4B;
    --primary-100: #312E81;
    --success-bg: #064E3B;
    --warning-bg: #451A03;
    --error-bg: #450A0A;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.3);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.3), 0 1px 2px -1px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.4), 0 8px 10px -6px rgba(0,0,0,0.4);
  }

  .header {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
  }

  .hero-search input {
    background: #F8FAFC;
    color: #1E293B;
  }

  .hero-search input::placeholder {
    color: #94A3B8;
  }

  .image-preview-item img {
    background: repeating-conic-gradient(#334155 0% 25%, #1E293B 0% 50%) 50% / 20px 20px;
  }

  .toast {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5);
  }

  .slider-container input[type="range"]::-webkit-slider-thumb {
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  }
}

/* ============================================
   Accessibility & UX
   ============================================ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ============================================
   Feedback Module (Web3Forms)
   ============================================ */

.feedback-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  z-index: 90;
  transition: transform 0.2s, box-shadow 0.2s;
}

.feedback-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.feedback-modal .modal-content {
  max-width: 480px;
}

.feedback-form .form-group {
  margin-bottom: 16px;
}

.feedback-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.feedback-form input,
.feedback-form textarea,
.feedback-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--text);
}

.feedback-form input:focus,
.feedback-form textarea:focus,
.feedback-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.feedback-form textarea {
  min-height: 100px;
  resize: vertical;
}

.feedback-form .form-row {
  display: flex;
  gap: 12px;
}

.feedback-form .form-row > div {
  flex: 1;
}

.feedback-success {
  text-align: center;
  padding: 40px 20px;
}

.feedback-success .feedback-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.feedback-success h3 {
  margin: 0 0 8px;
  color: var(--success);
}

.feedback-success p {
  color: var(--text-secondary);
  margin: 0;
}

@media (max-width: 768px) {
  .feedback-btn {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .feedback-form .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* Smooth scroll for anchor links */
html {
  scroll-behavior: smooth;
}

/* Selection color */
::selection {
  background: var(--primary-light);
  color: white;
}

/* Touch-friendly targets on mobile */
@media (max-width: 768px) {
  .btn {
    min-height: 44px;
  }

  .nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .pw-option, .ts-option {
    padding: 14px 0;
  }
}
/* Language Switcher Button */
.lang-btn {
  padding: 6px 14px !important;
  border-radius: 20px !important;
  background: rgba(255,255,255,0.12) !important;
  color: inherit !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  border: 1px solid rgba(255,255,255,0.25) !important;
  transition: background 0.2s, border-color 0.2s !important;
  text-decoration: none !important;
  cursor: pointer;
}

.lang-btn:hover {
  background: rgba(255,255,255,0.25) !important;
  border-color: rgba(255,255,255,0.4) !important;
}