/* ==========================================================================
   Files Craft — Modern, Responsive, Lightweight Stylesheet
   Mobile-first, dependency-free CSS with Dark/Light Mode & search
   ========================================================================== */

/* --- CSS Variables & Design Tokens (Light Theme Default) --- */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --secondary: #059669;
  --secondary-hover: #047857;
  --secondary-light: #ecfdf5;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: #fef2f2;
  --warning: #d97706;
  
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --header-bg: #ffffff;
  --header-border: #e2e8f0;
  --footer-bg: #0f172a;
  --footer-text: #94a3b8;
  --card-bg: #ffffff;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-dropzone: 0 12px 24px -6px rgba(37, 99, 235, 0.12);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --container-max: 1140px;
}

/* --- Dark Theme Variables --- */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: #1e3a8a;
  --secondary: #10b981;
  --secondary-hover: #34d399;
  --secondary-light: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-hover: #f87171;
  --danger-light: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  
  --bg: #0b0f19;
  --surface: #111827;
  --surface-subtle: #1f2937;
  --border: #374151;
  --border-focus: #60a5fa;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  
  --header-bg: #111827;
  --header-border: #1f2937;
  --footer-bg: #070a12;
  --footer-text: #9ca3af;
  --card-bg: #111827;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-dropzone: 0 12px 24px -6px rgba(59, 130, 246, 0.2);
}

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

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

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.main-content {
  flex: 1 0 auto;
  padding-bottom: 3.5rem;
}

/* --- Header & Navigation --- */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  gap: 1rem;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.4rem;
}

.brand-text strong {
  color: var(--primary);
}

/* Header Right Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Header Search Bar */
.header-search-wrap {
  position: relative;
  display: none;
}

@media (min-width: 768px) {
  .header-search-wrap {
    display: block;
    width: 220px;
  }
}

@media (min-width: 1024px) {
  .header-search-wrap {
    width: 280px;
  }
}

.header-search-input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 2.25rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.header-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: var(--surface);
}

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

/* Header Search Live Dropdown */
.header-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
}

@media (max-width: 900px) {
  .header-search-dropdown {
    left: auto;
    right: 0;
    width: 300px;
  }
}

.header-search-dropdown.is-open {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  text-decoration: none;
  transition: var(--transition);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover, .search-result-item.is-selected {
  background: var(--surface-subtle);
  color: var(--primary);
}

.search-result-icon {
  font-size: 1.25rem;
  width: 34px;
  height: 34px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.search-result-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.search-result-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-badge {
  font-size: 0.6875rem;
  padding: 0.15rem 0.45rem;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-weight: 600;
  flex-shrink: 0;
  text-transform: capitalize;
}

.search-highlight {
  background: rgba(37, 99, 235, 0.18);
  color: var(--primary);
  font-weight: 700;
  padding: 0 0.15rem;
  border-radius: var(--radius-sm);
}

.search-no-results {
  padding: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Day / Night Mode Pill Switch (Matching Mockup) */
.theme-switch-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 145px;
  height: 40px;
  padding: 3px;
  border-radius: var(--radius-full);
  background: #cbd5e1;
  border: 1.5px solid #94a3b8;
  cursor: pointer;
  outline: none;
  user-select: none;
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease, box-shadow 0.2s ease;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.theme-switch-pill:hover {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

/* White Circle Thumb */
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease;
  z-index: 2;
}

/* Sun and Moon Icons inside Thumb */
.switch-thumb svg {
  width: 19px;
  height: 19px;
  stroke: #1e293b;
  color: #1e293b;
  transition: opacity 0.2s ease;
}

.icon-sun {
  display: block;
}

.icon-moon {
  display: none;
}

/* Text Labels */
.switch-label-day, .switch-label-night {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 1;
  pointer-events: none;
  white-space: nowrap;
}

.switch-label-day {
  color: #0f172a;
  margin-left: auto;
  margin-right: 14px;
  display: block;
}

.switch-label-night {
  color: #ffffff;
  margin-right: auto;
  margin-left: 14px;
  display: none;
}

/* Dark Mode State ([data-theme="dark"]) */
[data-theme="dark"] .theme-switch-pill {
  background: #000000;
  border-color: #334155;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .switch-thumb {
  transform: translateX(103px);
  background: #ffffff;
}

[data-theme="dark"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: block;
  stroke: #000000;
  color: #000000;
}

[data-theme="dark"] .switch-label-day {
  display: none;
}

[data-theme="dark"] .switch-label-night {
  display: block;
}

/* Responsive compact style on narrow screens */
@media (max-width: 480px) {
  .theme-switch-pill {
    width: 66px;
    height: 34px;
  }
  .switch-label-day, .switch-label-night {
    display: none !important;
  }
  .switch-thumb {
    top: 2px;
    left: 2px;
    width: 28px;
    height: 28px;
  }
  .switch-thumb svg {
    width: 16px;
    height: 16px;
  }
  [data-theme="dark"] .switch-thumb {
    transform: translateX(32px);
  }
}

.mobile-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.hamburger-bar {
  width: 100%;
  height: 2.5px;
  background-color: var(--text-main);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.site-nav {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.25rem;
}

.site-nav.is-open {
  display: block;
}

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

.nav-link {
  display: block;
  padding: 0.625rem 0.875rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

@media (min-width: 860px) {
  .mobile-menu-toggle {
    display: none;
  }
  
  .site-nav {
    display: block;
    position: static;
    background: transparent;
    border-bottom: none;
    box-shadow: none;
    padding: 0;
  }
  
  .nav-list {
    flex-direction: row;
    gap: 0.25rem;
  }
  
  .nav-link {
    padding: 0.4rem 0.65rem;
    font-size: 0.84rem;
    font-weight: 600;
    min-height: auto;
    white-space: nowrap;
  }
}

/* --- Privacy Notice Bar --- */
.site-notice-bar {
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.8125rem;
  text-align: center;
  padding: 0.4rem 1rem;
}

.notice-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  margin-right: 0.35rem;
}

/* --- Ad Slots Placeholders --- */
.ad-slot {
  margin: 1.5rem auto;
  text-align: center;
}

.ad-placeholder {
  min-height: 90px;
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  position: relative;
}

.ad-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

/* --- Hero Section & Banner Search --- */
.hero-section {
  text-align: center;
  padding: 2.5rem 1.25rem 1.5rem;
  max-width: 820px;
  margin: 0 auto;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin-bottom: 0.875rem;
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 2.5rem;
  }
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

/* Banner Search Input */
.banner-search-box {
  max-width: 600px;
  margin: 1.5rem auto 0;
  position: relative;
}

.banner-search-input {
  width: 100%;
  padding: 0.875rem 1.25rem 0.875rem 3rem;
  font-size: 1.05rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.banner-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

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

/* Category Filter Pills */
.category-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.75rem 0 1rem;
}

.category-filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.category-filter-btn:hover, .category-filter-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* --- Tool Cards Grid --- */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0 3rem;
}

@media (min-width: 640px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tool-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  text-decoration: none;
  color: inherit;
}

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

.tool-card-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

.tool-card:hover .tool-card-icon {
  background: var(--primary);
  color: #ffffff;
}

.tool-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.tool-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.tool-card-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

/* --- Tool Workspace & Drop Zone --- */
.tool-workspace {
  max-width: 820px;
  margin: 0 auto 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

@media (max-width: 600px) {
  .tool-workspace {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }
}

.drop-zone {
  border: 2px dashed #93c5fd;
  background: var(--surface-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background-color: var(--primary-light);
  box-shadow: var(--shadow-dropzone);
}

.drop-zone-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.drop-zone-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.drop-zone-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.drop-zone input[type="file"] {
  display: none;
}

/* --- Buttons & Inputs --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
  text-align: center;
  user-select: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface-subtle);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-success {
  background: var(--secondary);
  color: #ffffff;
}

.btn-success:hover {
  background: var(--secondary-hover);
  color: #ffffff;
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  min-height: 36px;
}

/* --- Options / Tool Settings Panel --- */
.tool-options-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .tool-options-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-select, .form-input, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  min-height: 44px;
  outline: none;
  transition: var(--transition);
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
  font-family: var(--font-family);
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* --- Text & Code Boxes --- */
.code-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  overflow-x: auto;
  color: var(--text-main);
  max-height: 350px;
  white-space: pre-wrap;
  word-break: break-all;
}

.stats-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .stats-grid-compact {
    grid-template-columns: repeat(4, 1fr);
  }
}

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

.stat-box-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

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

/* --- File List / Queue Items --- */
.file-list {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  gap: 0.75rem;
}

.file-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
  flex: 1;
}

.file-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #cbd5e1;
  flex-shrink: 0;
}

.file-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fecaca;
}

/* --- Progress Bar & Status State --- */
.tool-status-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  text-align: center;
  display: none;
}

.tool-status-box.active {
  display: block;
}

.progress-container {
  width: 100%;
  height: 10px;
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0.75rem 0;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.2s ease;
}

.status-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

/* --- Results Box --- */
.tool-result-box {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--secondary-light);
  border: 1px solid var(--secondary);
  border-radius: var(--radius-lg);
  text-align: center;
  display: none;
}

.tool-result-box.active {
  display: block;
}

.result-icon {
  font-size: 2.5rem;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

.result-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.result-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.result-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* --- Image Compressor Preview Cards --- */
.compress-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 600px) {
  .compress-preview-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.compress-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.compress-card-img-wrap {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.compress-card-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.compress-stats {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.savings-badge {
  display: inline-block;
  background: var(--secondary);
  color: #ffffff;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

/* --- Info Sections / How It Works / FAQ --- */
.content-section {
  max-width: 860px;
  margin: 3rem auto 0;
  padding: 0 1.25rem;
}

.section-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 2rem;
}

/* Steps Grid */
.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

@media (min-width: 768px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 auto 1rem;
}

.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.step-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

@media (min-width: 640px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.feature-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.feature-box h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.feature-box p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-bottom: 2rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.faq-question {
  width: 100%;
  padding: 1.15rem 1.25rem;
  text-align: left;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
}

.faq-icon {
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.faq-item.is-open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 1.25rem 1.25rem;
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.faq-item.is-open .faq-answer {
  display: block;
}

/* --- Generic Legal / Content Pages --- */
.prose-page {
  max-width: 800px;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 600px) {
  .prose-page {
    padding: 1.5rem;
  }
}

.prose-page h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}

.prose-page h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
}

.prose-page p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.prose-page ul {
  margin-left: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}

.prose-page li {
  margin-bottom: 0.35rem;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
  width: calc(100% - 3rem);
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideUp 0.3s ease;
}

.toast.toast-error {
  background: var(--danger);
}

.toast.toast-success {
  background: var(--secondary);
}

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

/* --- Footer --- */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 3.5rem 0 2rem;
  margin-top: auto;
  border-top: 1px solid #1e293b;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.875rem;
}

.footer-brand strong {
  color: #60a5fa;
}

.footer-desc {
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.footer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.security-pill {
  font-size: 0.75rem;
  background: #1e293b;
  color: #cbd5e1;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.footer-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

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

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

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  text-align: center;
  font-size: 0.8125rem;
}

@media (min-width: 640px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-privacy-note {
  color: #64748b;
}

/* =========================================
   NEW TOOLS STYLES: Cropper, Color Picker,
   Favicon Generator, Rotator, Metadata
========================================= */

/* --- Image Cropper --- */
.cropper-stage {
  position: relative;
  background: #0f172a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  max-height: 600px;
  margin-bottom: 1.5rem;
  user-select: none;
  touch-action: none;
}

.cropper-image {
  max-width: 100%;
  max-height: 560px;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #3b82f6;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  cursor: move;
}

.crop-grid-line-h, .crop-grid-line-v {
  position: absolute;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}
.crop-grid-line-h { left: 0; right: 0; height: 1px; }
.crop-grid-line-h.one { top: 33.33%; }
.crop-grid-line-h.two { top: 66.66%; }

.crop-grid-line-v { top: 0; bottom: 0; width: 1px; }
.crop-grid-line-v.one { left: 33.33%; }
.crop-grid-line-v.two { left: 66.66%; }

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 2px;
}
.crop-handle.tl { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle.tr { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle.bl { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-handle.br { bottom: -6px; right: -6px; cursor: nwse-resize; }
.crop-handle.tc { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.crop-handle.bc { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.crop-handle.ml { top: calc(50% - 6px); left: -6px; cursor: ew-resize; }
.crop-handle.mr { top: calc(50% - 6px); right: -6px; cursor: ew-resize; }

.aspect-ratio-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.aspect-pill {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-main);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.aspect-pill:hover, .aspect-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* --- Image Color Picker & Loupe --- */
.color-picker-stage {
  position: relative;
  background: #0f172a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  cursor: crosshair;
  margin-bottom: 1.5rem;
}

.color-picker-canvas {
  max-width: 100%;
  display: block;
}

.color-loupe {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  overflow: hidden;
  display: none;
  z-index: 50;
  background: #000000;
}

.color-loupe-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.color-loupe-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.color-swatches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.color-swatch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
}

.color-swatch-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.swatch-color-box {
  height: 60px;
  width: 100%;
}

.swatch-info {
  padding: 0.5rem;
  font-size: 0.75rem;
  text-align: center;
  font-family: monospace;
  font-weight: 600;
  color: var(--text-main);
}

/* --- Favicon Generator --- */
.favicon-package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.favicon-item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.favicon-item-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  width: 70px;
  height: 70px;
}

.favicon-item-preview img {
  image-rendering: pixelated;
}

.favicon-item-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-main);
}

.favicon-item-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-snippet-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: monospace;
  font-size: 0.8125rem;
  overflow-x: auto;
  position: relative;
  line-height: 1.5;
  margin: 1rem 0;
}

/* --- EXIF / Metadata Remover --- */
.metadata-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1rem 0;
}

.metadata-table th, .metadata-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.metadata-table th {
  background: var(--surface-subtle);
  font-weight: 600;
  color: var(--text-muted);
}

