/* ═══════════════════════════════════════════════════════════════
   SnapTools — Design System
   ═══════════════════════════════════════════════════════════════ */

:root {
  --st-primary: #6C5CE7;
  --st-primary-light: #A29BFE;
  --st-primary-dark: #4834D4;
  --st-on-primary: #ffffff;
  --st-primary-container: #EDE9FE;
  --st-on-primary-container: #2D1B69;

  --st-secondary: #636E72;
  --st-on-secondary: #ffffff;
  --st-secondary-container: #F1F2F6;

  --st-surface: #FAFAFA;
  --st-on-surface: #1A1A2E;
  --st-surface-dim: #F0F0F5;
  --st-surface-container: #F5F5FA;
  --st-surface-container-high: #EBEBF0;
  --st-surface-container-highest: #E0E0E8;
  --st-on-surface-variant: #6B7280;

  --st-outline: #D1D5DB;
  --st-outline-variant: #E5E7EB;

  --st-error: #EF4444;
  --st-on-error: #ffffff;
  --st-success: #10B981;
  --st-warning: #F59E0B;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms;
  --dur-normal: 250ms;
  --dur-slow: 400ms;
}

[data-theme="dark"] {
  --st-primary: #A29BFE;
  --st-primary-light: #C4B5FD;
  --st-primary-dark: #7C6EE6;
  --st-on-primary: #1A1A2E;
  --st-primary-container: #2D2655;
  --st-on-primary-container: #E0DBFF;

  --st-secondary: #9CA3AF;
  --st-on-secondary: #1A1A2E;
  --st-secondary-container: #2A2A3E;

  --st-surface: #121218;
  --st-on-surface: #E8E8ED;
  --st-surface-dim: #18181F;
  --st-surface-container: #1E1E28;
  --st-surface-container-high: #262630;
  --st-surface-container-highest: #303040;
  --st-on-surface-variant: #9CA3AF;

  --st-outline: #404050;
  --st-outline-variant: #333345;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.3);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.3);
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--st-surface);
  color: var(--st-on-surface);
  transition: background-color var(--dur-normal) var(--ease), color var(--dur-normal) var(--ease);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ═══ App Shell ═══ */
.app-container { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* ═══ Desktop Nav Rail ═══ */
.navigation-rail {
  width: 84px;
  background: var(--st-surface-container);
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 0 12px;
  border-right: 1px solid var(--st-outline-variant);
  z-index: 10; flex-shrink: 0;
  transition: background-color var(--dur-normal) var(--ease);
}

.nav-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; gap: 2px; }
.logo-icon { font-size: 26px; color: var(--st-primary); }
.logo-text { font-size: 9px; font-weight: 800; color: var(--st-primary); letter-spacing: 1px; text-transform: uppercase; }

.nav-destinations {
  display: flex; flex-direction: column; gap: 2px;
  flex-grow: 1; width: 100%; align-items: center;
  overflow-y: auto; scrollbar-width: none; padding: 4px 0;
}
.nav-destinations::-webkit-scrollbar { display: none; }

.nav-dest {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  width: 100%; padding: 4px 0;
  color: var(--st-on-surface-variant);
  text-decoration: none; outline: none; flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease);
}
.nav-icon {
  font-size: 22px; padding: 6px 16px; border-radius: var(--radius-full);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-label { font-size: 10px; font-weight: 600; margin-top: 2px; text-align: center; }

.nav-dest.active .nav-icon { background: var(--st-primary-container); color: var(--st-on-primary-container); }
.nav-dest.active .nav-label { color: var(--st-on-surface); font-weight: 700; }
.nav-dest:hover:not(.active) .nav-icon { background: rgba(108,92,231,0.08); }

.nav-footer { padding-top: 8px; flex-shrink: 0; }

/* ═══ Main Workspace ═══ */
.main-workspace {
  flex-grow: 1; display: flex; flex-direction: column;
  overflow: hidden; height: 100vh;
  background: var(--st-surface);
}

/* ═══ Top App Bar ═══ */
.top-app-bar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--st-outline-variant);
  background: var(--st-surface); flex-shrink: 0;
  z-index: 5;
}
.top-app-bar h1 { font-size: 17px; font-weight: 700; }
.header-left { display: flex; align-items: center; gap: 12px; }

.btn-back {
  display: none; /* shown via JS when inside a tool */
  align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--st-primary); font-family: inherit;
  font-size: 13px; font-weight: 700; padding: 6px 10px;
  border-radius: var(--radius-full);
  transition: background var(--dur-fast) var(--ease);
}
.btn-back:hover { background: rgba(108,92,231,0.08); }
.btn-back .material-symbols-outlined { font-size: 20px; }
.btn-back.visible { display: inline-flex; }

.privacy-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--st-primary-container); color: var(--st-on-primary-container);
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: var(--radius-full);
}
.badge-icon { font-size: 13px; }

.header-right { display: flex; align-items: center; gap: 12px; }

.stats-counter {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--st-secondary);
}

.icon-btn {
  background: none; border: none; cursor: pointer;
  width: 40px; height: 40px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--st-on-surface-variant);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: rgba(108,92,231,0.08); color: var(--st-on-surface); }
.icon-btn .material-symbols-outlined { font-size: 22px; }

/* ═══ Screens Container ═══ */
.screens-container {
  flex-grow: 1; overflow-y: auto; padding: 24px; position: relative;
}

.screen {
  display: none; opacity: 0;
  transition: opacity var(--dur-normal) var(--ease);
}
.screen.active { display: block; opacity: 1; }

/* ═══ Privacy Callout ═══ */
.privacy-callout {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; margin-bottom: 16px;
  background: var(--st-primary-container);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--st-primary);
}
.privacy-callout-icon {
  font-size: 22px; color: var(--st-primary);
  font-variation-settings: 'FILL' 1;
  flex-shrink: 0;
}
.privacy-callout-text {
  font-size: 13px; color: var(--st-on-primary-container); line-height: 1.3;
}
.privacy-callout-text strong {
  font-weight: 800; font-size: 14px;
}

/* ═══ Category Sections (Collapsible on mobile) ═══ */
.category-section { margin-bottom: 8px; }
.category-header {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--st-on-surface-variant);
  margin: 28px 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--st-outline-variant);
  background: none; border-top: none; border-left: none; border-right: none;
  width: 100%; text-align: left; cursor: default;
  display: flex; align-items: center; justify-content: space-between;
}
.category-header .cat-chevron { display: none; font-size: 20px; transition: transform var(--dur-normal) var(--ease); }
.category-section:first-of-type .category-header { margin-top: 0; }
.category-body { transition: max-height var(--dur-slow) var(--ease), opacity var(--dur-normal) var(--ease); overflow: hidden; }

/* ═══ Footer ═══ */
.site-footer {
  margin-top: 40px; padding: 32px 0 16px;
  border-top: 1px solid var(--st-outline-variant);
  text-align: center; color: var(--st-on-surface-variant);
  font-size: 13px;
}
.site-footer p { margin-bottom: 8px; }
.footer-email {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--st-primary); font-weight: 600; text-decoration: none;
  font-size: 14px; margin-bottom: 12px;
}
.footer-email:hover { text-decoration: underline; }
.footer-email .material-symbols-outlined { font-size: 18px; }
.footer-copy { font-size: 12px; color: var(--st-on-surface-variant); opacity: 0.7; }

/* ═══ Tools Grid ═══ */
.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; margin-bottom: 8px;
}

.tool-card {
  background: var(--st-surface-container);
  border-radius: var(--radius-xl); padding: 18px; cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform var(--dur-normal) var(--ease), box-shadow var(--dur-normal) var(--ease), border-color var(--dur-normal) var(--ease);
  border: 1px solid var(--st-outline-variant);
  position: relative; overflow: hidden;
}
.tool-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--card-accent, var(--st-primary));
  opacity: 0; transition: opacity var(--dur-normal) var(--ease);
}
.tool-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
  border-color: var(--st-primary-light);
}
.tool-card:hover::before { opacity: 1; }
.tool-card:active { transform: translateY(-1px) scale(0.99); }

.card-icon-wrapper {
  width: 42px; height: 42px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.card-icon-wrapper span { font-size: 22px; }

/* Card accent colors */
.accent-converter { background: #FEE2E2; color: #991B1B; --card-accent: #EF4444; }
.accent-compressor { background: #DBEAFE; color: #1E3A8A; --card-accent: #3B82F6; }
.accent-resizer { background: #D1FAE5; color: #065F46; --card-accent: #10B981; }
.accent-cropper { background: #FEF3C7; color: #92400E; --card-accent: #F59E0B; }
.accent-merger { background: #EDE9FE; color: #5B21B6; --card-accent: #8B5CF6; }
.accent-splitter { background: #FFEDD5; color: #9A3412; --card-accent: #F97316; }
.accent-img-pdf { background: #DCFCE7; color: #166534; --card-accent: #22C55E; }
.accent-pdf-img { background: #E0E7FF; color: #3730A3; --card-accent: #6366F1; }
.accent-qr { background: #F0FDF4; color: #14532D; --card-accent: #16A34A; }
.accent-color { background: #FCE7F3; color: #9D174D; --card-accent: #EC4899; }
.accent-encrypt { background: #ECFDF5; color: #064E3B; --card-accent: #059669; }
.accent-password { background: #FFF7ED; color: #7C2D12; --card-accent: #EA580C; }
.accent-percent { background: #EFF6FF; color: #1E40AF; --card-accent: #2563EB; }
.accent-age { background: #FDF4FF; color: #86198F; --card-accent: #D946EF; }
.accent-zodiac { background: #FFFBEB; color: #78350F; --card-accent: #D97706; }
.accent-emi { background: #F0FDFA; color: #134E4A; --card-accent: #14B8A6; }
.accent-date { background: #FEF9C3; color: #854D0E; --card-accent: #CA8A04; }
.accent-bmi { background: #FFF1F2; color: #9F1239; --card-accent: #E11D48; }

.tool-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; line-height: 1.3; }
.tool-card p {
  font-size: 13px; color: var(--st-on-surface-variant);
  line-height: 1.4; margin-bottom: 14px; flex-grow: 1;
}
.card-action-btn {
  font-size: 12px; font-weight: 700; color: var(--st-primary);
  display: inline-flex; align-items: center; gap: 4px;
}

/* ═══ Tool Layout ═══ */
.tool-layout { display: flex; gap: 20px; height: 100%; align-items: flex-start; }

.tool-controls-panel {
  width: 280px; background: var(--st-surface-container);
  border-radius: var(--radius-xl); padding: 20px;
  display: flex; flex-direction: column; flex-shrink: 0;
  border: 1px solid var(--st-outline-variant);
}

.tool-workspace-panel {
  flex-grow: 1; display: flex; flex-direction: column;
  height: 100%; overflow-y: auto;
  background: var(--st-surface-dim);
  border-radius: var(--radius-xl); padding: 20px;
  border: 1px dashed var(--st-outline);
}

.section-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.panel-desc { font-size: 13px; color: var(--st-on-surface-variant); line-height: 1.4; margin-bottom: 16px; }

/* ═══ Settings Controls ═══ */
.settings-group { margin-bottom: 14px; display: flex; flex-direction: column; }
.settings-label { font-size: 12px; font-weight: 700; color: var(--st-on-surface); margin-bottom: 5px; }
.input-helper { font-size: 11px; color: var(--st-on-surface-variant); margin-top: 3px; }

.material-select {
  background: var(--st-surface); color: var(--st-on-surface);
  border: 1px solid var(--st-outline); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: inherit; font-size: 14px; font-weight: 500;
  outline: none; cursor: pointer; transition: border-color var(--dur-fast);
  width: 100%;
}
.material-select:focus { border-color: var(--st-primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.12); }

.material-input {
  background: var(--st-surface); color: var(--st-on-surface);
  border: 1px solid var(--st-outline); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: inherit; font-size: 14px; font-weight: 500;
  outline: none; transition: border-color var(--dur-fast);
  width: 100%;
}
.material-input:focus { border-color: var(--st-primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.12); }

.slider-header { display: flex; justify-content: space-between; align-items: center; }
.slider-value { font-size: 13px; font-weight: 700; color: var(--st-primary); }

.material-slider {
  -webkit-appearance: none; width: 100%; height: 6px; border-radius: 3px;
  background: var(--st-surface-container-high); outline: none; margin: 8px 0;
}
.material-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  border-radius: 50%; background: var(--st-primary); cursor: pointer;
  transition: transform var(--dur-fast); box-shadow: var(--shadow-md);
}
.material-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }

.radio-group { display: flex; flex-direction: column; gap: 8px; }
.material-radio { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.material-radio input { accent-color: var(--st-primary); width: 18px; height: 18px; }

/* Toggles */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
}
.toggle-row label { font-size: 13px; font-weight: 600; }
.toggle-switch {
  position: relative; width: 44px; height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--st-outline); border-radius: var(--radius-full);
  transition: background var(--dur-fast) var(--ease);
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: transform var(--dur-fast) var(--ease);
}
.toggle-switch input:checked + .toggle-slider { background: var(--st-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ═══ Buttons ═══ */
.md-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-full); padding: 10px 20px; font-family: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast), box-shadow var(--dur-fast);
  border: none; margin-bottom: 8px;
}
.md-btn .material-symbols-outlined { font-size: 18px; }
.md-btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.primary-btn { background: var(--st-primary); color: var(--st-on-primary); }
.primary-btn:hover { background: var(--st-primary-dark); box-shadow: var(--shadow-md); }
.primary-btn:active { transform: scale(0.97); }
.outline-btn { background: none; border: 1px solid var(--st-outline); color: var(--st-primary); }
.outline-btn:hover { background: rgba(108,92,231,0.06); }
.fill-width { width: 100%; }

.split-actions-row { display: flex; gap: 8px; }
.split-actions-row .md-btn { flex: 1; margin-bottom: 0; }

/* ═══ Dropzone ═══ */
.dropzone {
  flex-grow: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 32px; cursor: pointer;
  transition: background var(--dur-normal), border-color var(--dur-normal);
  min-height: 200px;
}
.dropzone:hover, .dropzone.dragover { background: var(--st-surface-container-highest); }
.dropzone-icon { font-size: 48px; color: var(--st-primary); margin-bottom: 10px; }
.dropzone-text { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.text-link { color: var(--st-primary); text-decoration: underline; cursor: pointer; }
.dropzone-subtext { font-size: 12px; color: var(--st-on-surface-variant); }
.file-input-hidden { display: none; }

/* ═══ File Lists & Cards ═══ */
.file-list-container { width: 100%; }
.list-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.file-item-card {
  background: var(--st-surface); border-radius: var(--radius-md);
  padding: 10px; display: flex; flex-direction: column; position: relative;
  border: 1px solid var(--st-outline-variant); box-shadow: var(--shadow-sm);
}

.item-preview {
  height: 100px; border-radius: var(--radius-sm);
  background: var(--st-surface-container);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: 8px;
}
.item-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

.item-info { display: flex; flex-direction: column; gap: 2px; }
.item-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 11px; color: var(--st-on-surface-variant); }

.item-delete-btn {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--st-error); color: white; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0.85; transition: opacity var(--dur-fast);
}
.item-delete-btn:hover { opacity: 1; }
.item-delete-btn span { font-size: 16px; }

/* ═══ Compressor Preview ═══ */
.compressor-comparison { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.preview-cards-container { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.preview-card {
  background: var(--st-surface); border-radius: var(--radius-lg);
  padding: 14px; border: 1px solid var(--st-outline-variant);
}
.preview-card h4 { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--st-secondary); }
.highlight-card { border-color: var(--st-primary); box-shadow: var(--shadow-sm); }
.highlight-card h4 { color: var(--st-primary); }

.img-preview-box {
  height: 180px; border-radius: var(--radius-sm);
  background: var(--st-surface-container);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
  border: 1px solid var(--st-outline-variant);
}
.img-preview-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.preview-stats { margin-top: 8px; font-size: 12px; line-height: 1.5; }
.preview-stats span { font-weight: 700; }

.compression-metric-banner {
  background: #D1FAE5; color: #065F46;
  border-radius: var(--radius-md); padding: 10px 16px;
  text-align: center; font-size: 14px; font-weight: 700;
  border: 1px solid #A7F3D0;
}
.compression-metric-banner.warning-badge { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }

/* ═══ Loading ═══ */
.loading-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(255,255,255,0.7); display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
[data-theme="dark"] .loading-overlay { background: rgba(0,0,0,0.5); }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--st-outline-variant);
  border-top-color: var(--st-primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ PDF Sortable ═══ */
.sortable-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }

.pdf-sortable-row {
  background: var(--st-surface); border-radius: var(--radius-md);
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--st-outline-variant); box-shadow: var(--shadow-sm);
}
.pdf-row-info { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.pdf-row-icon { color: var(--st-error); }
.pdf-row-details { display: flex; flex-direction: column; overflow: hidden; }
.pdf-row-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-row-size { font-size: 11px; color: var(--st-on-surface-variant); }
.pdf-row-actions { display: flex; align-items: center; gap: 4px; }

.sort-btn {
  background: none; border: none; color: var(--st-on-surface-variant);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  transition: background var(--dur-fast);
}
.sort-btn:hover:not(:disabled) { background: var(--st-surface-container-high); color: var(--st-on-surface); }
.sort-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══ PDF Splitter ═══ */
.pdf-splitter-workspace { width: 100%; }
.pdf-info-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--st-outline-variant);
}
.pdf-info-name { font-size: 14px; font-weight: 700; }
.pdf-info-pages {
  font-size: 12px; background: var(--st-surface-container-highest);
  padding: 4px 10px; border-radius: var(--radius-full); font-weight: 600;
}

.thumbnail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; }

.page-thumbnail-card {
  background: var(--st-surface); border-radius: var(--radius-md);
  border: 2px solid transparent; padding: 8px;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.page-thumbnail-card:hover { box-shadow: var(--shadow-md); }
.page-thumbnail-card.selected { border-color: var(--st-primary); background: rgba(108,92,231,0.04); }

.canvas-wrapper {
  width: 90px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--st-outline-variant);
  overflow: hidden; border-radius: 4px;
}
.canvas-wrapper canvas { max-width: 100%; max-height: 100%; }

.page-number { font-size: 11px; font-weight: 700; margin-top: 6px; }

.select-indicator {
  position: absolute; top: 5px; right: 5px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--st-surface-container);
  border: 1px solid var(--st-outline);
  display: flex; align-items: center; justify-content: center;
  color: transparent; transition: background var(--dur-fast), border-color var(--dur-fast);
}
.page-thumbnail-card.selected .select-indicator {
  background: var(--st-primary); border-color: var(--st-primary); color: white;
}
.select-indicator span { font-size: 14px; }

/* ═══ Textarea ═══ */
.tool-textarea {
  flex-grow: 1; min-height: 140px; padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--st-outline);
  background: var(--st-surface); color: var(--st-on-surface);
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  outline: none; resize: none;
}
.tool-textarea:focus { border-color: var(--st-primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.1); }

/* ═══ Color Picker Wheel ═══ */
.color-wheel-container {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  width: 100%;
}
.color-wheel-canvas {
  cursor: crosshair; touch-action: none;
  border-radius: 50%;
}
.color-brightness-strip {
  width: 100%; max-width: 280px; height: 24px;
  border-radius: var(--radius-full); cursor: crosshair; touch-action: none;
  border: 2px solid var(--st-outline-variant);
}
.color-preview-block {
  width: 100%; max-width: 280px; height: 80px;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.color-format-row { display: flex; gap: 8px; margin-bottom: 10px; }
.color-format-box { flex: 1; }
.color-value-text { font-size: 12px; font-family: monospace; font-weight: 600; color: var(--st-on-surface); }

.palette-section { width: 100%; max-width: 360px; }
.palette-row { display: flex; gap: 6px; margin-top: 6px; }
.palette-swatch {
  flex: 1; height: 40px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); cursor: pointer;
  position: relative; transition: transform var(--dur-fast);
  border: 1px solid rgba(0,0,0,0.08);
}
.palette-swatch:hover { transform: scale(1.06); }
.palette-swatch::after {
  content: attr(data-hex); position: absolute; bottom: -16px;
  left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 600; white-space: nowrap;
  color: var(--st-on-surface-variant);
}

/* ═══ Image Resizer ═══ */
.resizer-inputs { display: flex; gap: 10px; align-items: flex-end; }
.resizer-inputs .settings-group { flex: 1; }
.resizer-link-btn {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--st-primary); margin-bottom: 16px;
  transition: background var(--dur-fast);
}
.resizer-link-btn:hover { background: rgba(108,92,231,0.08); }
.resizer-link-btn.active { background: var(--st-primary-container); }

/* ═══ Image Cropper ═══ */
.cropper-canvas-container {
  position: relative; display: flex; align-items: center;
  justify-content: center; flex-grow: 1;
  background: var(--st-surface-container); border-radius: var(--radius-md);
  overflow: hidden; min-height: 300px;
}
.cropper-canvas-container canvas { max-width: 100%; max-height: 100%; }

/* ═══ Password Generator ═══ */
.password-display {
  background: var(--st-surface-container-high);
  border-radius: var(--radius-md); padding: 16px;
  font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 700;
  text-align: center; word-break: break-all; letter-spacing: 1px;
  border: 1px solid var(--st-outline-variant);
  min-height: 60px; display: flex; align-items: center; justify-content: center;
  user-select: all; color: var(--st-on-surface);
}
.strength-meter {
  height: 6px; border-radius: 3px; background: var(--st-outline-variant);
  margin: 8px 0; overflow: hidden;
}
.strength-meter-fill {
  height: 100%; border-radius: 3px;
  transition: width var(--dur-normal) var(--ease), background var(--dur-normal);
}
.strength-label { font-size: 12px; font-weight: 700; text-align: right; }

/* ═══ Percentage Calculator ═══ */
.calc-card {
  background: var(--st-surface); border-radius: var(--radius-lg);
  padding: 16px; border: 1px solid var(--st-outline-variant);
  margin-bottom: 12px;
}
.calc-card h4 { font-size: 13px; font-weight: 700; color: var(--st-secondary); margin-bottom: 10px; }
.calc-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.calc-row span { font-size: 14px; font-weight: 600; color: var(--st-on-surface-variant); }
.calc-input {
  width: 100px; padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--st-outline);
  background: var(--st-surface); color: var(--st-on-surface);
  font-family: inherit; font-size: 16px; font-weight: 700;
  outline: none; text-align: center;
}
.calc-input:focus { border-color: var(--st-primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.1); }
.calc-result {
  display: inline-flex; padding: 8px 16px;
  background: var(--st-primary-container); color: var(--st-on-primary-container);
  border-radius: var(--radius-full); font-size: 16px; font-weight: 800;
  min-width: 80px; text-align: center; justify-content: center;
}

/* ═══ Age Calculator ═══ */
.age-result-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px; margin-top: 14px;
}
.age-stat-card {
  background: var(--st-surface); border-radius: var(--radius-md);
  padding: 14px; text-align: center;
  border: 1px solid var(--st-outline-variant);
}
.age-stat-value { display: block; font-size: 26px; font-weight: 800; color: var(--st-primary); }
.age-stat-label { display: block; font-size: 11px; font-weight: 600; color: var(--st-on-surface-variant); margin-top: 2px; }
.age-fun-fact {
  background: var(--st-primary-container); color: var(--st-on-primary-container);
  border-radius: var(--radius-md); padding: 14px;
  font-size: 14px; font-weight: 600; text-align: center;
  margin-top: 12px;
}

/* ═══ Zodiac ═══ */
.zodiac-result-card {
  background: var(--st-surface); border-radius: var(--radius-xl);
  padding: 24px; text-align: center;
  border: 1px solid var(--st-outline-variant); box-shadow: var(--shadow-md);
  max-width: 400px; margin: 0 auto;
}
.zodiac-emoji { font-size: 64px; display: block; margin-bottom: 8px; }
.zodiac-sign-name { font-size: 28px; font-weight: 800; color: var(--st-primary); margin-bottom: 4px; }
.zodiac-dates { font-size: 13px; color: var(--st-on-surface-variant); margin-bottom: 16px; }
.zodiac-traits { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.zodiac-trait {
  padding: 5px 12px; border-radius: var(--radius-full);
  background: var(--st-primary-container); color: var(--st-on-primary-container);
  font-size: 12px; font-weight: 700;
}
.zodiac-detail-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--st-outline-variant);
  font-size: 13px;
}
.zodiac-detail-row:last-child { border-bottom: none; }
.zodiac-detail-label { color: var(--st-on-surface-variant); font-weight: 600; }
.zodiac-detail-value { font-weight: 700; }

/* ═══ JSON Output ═══ */
.json-output-pre {
  background: var(--st-surface-container);
  overflow: auto; white-space: pre-wrap; margin: 0;
}

/* ═══ Color Input ═══ */
.color-input-small {
  width: 100%; height: 36px;
  border: 1px solid var(--st-outline); border-radius: var(--radius-sm);
  cursor: pointer; padding: 2px;
}

/* ═══ Toast ═══ */
#toast-container {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 20px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600; font-family: inherit;
  color: white; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(16px) scale(0.95);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease-spring);
  pointer-events: auto; max-width: 90vw; text-align: center;
}
.toast.visible { opacity: 1; transform: translateY(0) scale(1); }
.toast-success { background: #059669; }
.toast-error { background: #DC2626; }
.toast-info { background: var(--st-primary); }
.toast-warning { background: #D97706; }

/* ═══ Mobile Bottom Bar ═══ */
.mobile-bottom-bar {
  display: none;
  height: 56px;
  background: var(--st-surface-container);
  border-top: 1px solid var(--st-outline-variant);
  align-items: center; justify-content: space-around;
  flex-shrink: 0; z-index: 10;
  padding: 0 16px;
}
.mobile-bottom-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer;
  color: var(--st-on-surface-variant); padding: 6px 16px;
  border-radius: var(--radius-md);
  font-family: inherit; font-size: 10px; font-weight: 700;
  transition: color var(--dur-fast), background var(--dur-fast);
  min-width: 64px;
}
.mobile-bottom-btn .material-symbols-outlined { font-size: 24px; }
.mobile-bottom-btn.active { color: var(--st-primary); background: var(--st-primary-container); }
.mobile-bottom-btn:hover { background: rgba(108,92,231,0.06); }

/* ═══ GIF & PDF Compressor ═══ */
.accent-gif { background: linear-gradient(135deg, #00B894, #00CEC9); }
.accent-pdf-compress { background: linear-gradient(135deg, #E17055, #FDCB6E); }

/* ═══ Noise Generator ═══ */
.accent-noise { background: linear-gradient(135deg, #2D3436, #636E72); }
.noise-visualizer-container { width: 100%; max-width: 500px; text-align: center; }
#noise-visualizer { width: 100%; height: 200px; border-radius: var(--radius-md); background: var(--st-surface-container); }
.noise-status { margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--st-on-surface-variant); }

/* ═══ Pomodoro Timer ═══ */
.accent-pomodoro { background: linear-gradient(135deg, #E17055, #D63031); }
.pomo-display { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.pomo-ring-container { position: relative; width: 220px; height: 220px; }
.pomo-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.pomo-ring-bg { fill: none; stroke: var(--st-surface-container-high); stroke-width: 8; }
.pomo-ring-fill { fill: none; stroke: var(--st-primary); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 565.48; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.pomo-time { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 48px; font-weight: 700; letter-spacing: -1px; color: var(--st-on-surface); }
.pomo-phase { font-size: 18px; font-weight: 700; color: var(--st-primary); text-transform: uppercase; letter-spacing: 2px; }
.pomo-session-dots { display: flex; gap: 10px; }
.pomo-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--st-surface-container-high); transition: background var(--dur-normal); }
.pomo-dot.done { background: var(--st-primary); }
.pomo-phase.break-phase { color: var(--st-success); }
.pomo-ring-fill.break-ring { stroke: var(--st-success); }

/* ═══ Confession Box (Inline) ═══ */
.confession-inline {
  margin-top: 32px; padding: 24px;
  background: var(--st-surface-container);
  border-radius: var(--radius-lg);
  border: 1px solid var(--st-outline-variant);
}
.confession-inline-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.confession-inline-header .material-symbols-outlined {
  font-size: 28px; color: var(--st-primary);
}
.confession-inline-header h3 {
  font-size: 16px; font-weight: 700; color: var(--st-on-surface); margin-bottom: 2px;
}
.confession-inline-header p {
  font-size: 12px; color: var(--st-on-surface-variant); line-height: 1.3;
}
.confession-textarea {
  width: 100%; padding: 16px; border: 2px solid var(--st-outline-variant); border-radius: var(--radius-md);
  background: var(--st-surface-container); color: var(--st-on-surface); font-family: inherit; font-size: 16px;
  resize: vertical; min-height: 120px; outline: none; transition: border-color var(--dur-fast);
}
.confession-textarea:focus { border-color: var(--st-primary); }
.confession-vanish-area { width: 100%; min-height: 40px; position: relative; }
.confession-particle {
  position: absolute; font-size: 13px; color: var(--st-on-surface-variant); pointer-events: none; white-space: pre;
  animation: confessionVanish 2s ease-out forwards;
}
@keyframes confessionVanish {
  0% { opacity: 0.8; transform: translateY(0) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.3); filter: blur(6px); }
}

/* ═══ FAQ Page ═══ */
.faq-container { max-width: 720px; margin: 0 auto; }
.faq-hero { text-align: center; margin-bottom: 32px; }
.faq-hero-icon {
  font-size: 48px; color: var(--st-primary);
  font-variation-settings: 'FILL' 1;
  margin-bottom: 8px; display: block;
}
.faq-hero h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.faq-hero p { font-size: 14px; color: var(--st-on-surface-variant); }

.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: var(--st-surface-container);
  border: 1px solid var(--st-outline-variant);
  border-radius: var(--radius-md); overflow: hidden;
  transition: border-color var(--dur-fast);
}
.faq-item[open] { border-color: var(--st-primary-light); }
.faq-question {
  padding: 16px 20px; font-size: 14px; font-weight: 700;
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--st-on-surface);
  transition: background var(--dur-fast);
}
.faq-question:hover { background: rgba(108,92,231,0.04); }
.faq-question::after {
  content: '+'; font-size: 20px; font-weight: 400;
  color: var(--st-primary); flex-shrink: 0; margin-left: 12px;
  transition: transform var(--dur-normal) var(--ease);
}
.faq-item[open] .faq-question::after { content: '−'; }
.faq-question::-webkit-details-marker { display: none; }
.faq-answer {
  padding: 0 20px 16px; font-size: 13px; line-height: 1.6;
  color: var(--st-on-surface-variant);
}

.faq-footer-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--st-primary-container); color: var(--st-on-primary-container);
  border: none; border-radius: var(--radius-full);
  padding: 8px 16px; font-family: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer;
  margin-bottom: 12px;
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.faq-footer-link:hover { background: var(--st-primary-light); color: var(--st-on-primary); transform: translateY(-1px); }
.faq-footer-link .material-symbols-outlined { font-size: 18px; }

/* ═══ Language Switcher ═══ */
.lang-switcher { position: relative; }
.lang-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: var(--st-surface-container);
  border: 1px solid var(--st-outline-variant);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  min-width: 140px; z-index: 100; overflow: hidden;
  animation: dropIn 0.15s var(--ease);
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.lang-option {
  display: block; width: 100%; padding: 10px 16px;
  background: none; border: none; text-align: left;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--st-on-surface); cursor: pointer;
  transition: background var(--dur-fast);
}
.lang-option:hover { background: rgba(108,92,231,0.06); }
.lang-option.active { color: var(--st-primary); background: var(--st-primary-container); }

/* ═══ RTL Support ═══ */
[dir="rtl"] .faq-question::after { margin-left: 0; margin-right: 12px; }
[dir="rtl"] .lang-dropdown { right: auto; left: 0; }

/* ═══ Utility ═══ */
.hidden { display: none !important; }

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
  .app-container { flex-direction: column; }
  .navigation-rail { display: none; }
  .mobile-bottom-bar { display: flex; }

  .main-workspace { height: calc(100vh - 56px); }
  .screens-container { padding: 16px; }
  .top-app-bar { padding: 0 16px; height: 52px; }
  .top-app-bar h1 { font-size: 15px; }
  .privacy-badge { font-size: 10px; padding: 3px 8px; }

  .tool-layout { flex-direction: column; align-items: stretch; height: auto; }
  .tool-controls-panel { width: 100%; }
  .tool-workspace-panel { height: auto; min-height: 260px; }

  .preview-cards-container { grid-template-columns: 1fr; }
  .hero-compact h2 { font-size: 18px; }

  /* Collapsible categories on mobile */
  .category-header { cursor: pointer; }
  .category-header .cat-chevron { display: inline-block; }
  .category-section.collapsed .category-body { max-height: 0; opacity: 0; margin-bottom: 0; }
  .category-section.collapsed .cat-chevron { transform: rotate(-90deg); }
  .category-body { max-height: 2000px; opacity: 1; }

  #toast-container { bottom: 70px; }
}

@media (max-width: 600px) {
  .tools-grid { grid-template-columns: 1fr; }
  .file-grid { grid-template-columns: 1fr 1fr; }
  .resizer-inputs { flex-direction: column; }
  .age-result-grid { grid-template-columns: 1fr 1fr; }
  .calc-row { gap: 6px; }
  .calc-input { width: 80px; }
}
