:root {
  --primary: #e43f3f;
  --primary-light: #fce8e8;
  --primary-dark: #b71c1c;
  --accent-purple: #7c4dff;
  --accent-teal: #00bfa5;
  --accent-orange: #ff9100;
  --accent-blue: #2979ff;
  --accent-green: #00c853;

  --bg: #f5f6fa;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --nav-height: 68px;
  --header-height: 60px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  min-height: 100dvh;
  background: var(--bg);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 3px;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 10px;
}

/* --- Typography --- */
h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.05rem;
  font-weight: 700;
}
h3 {
  font-size: 0.95rem;
  font-weight: 600;
}
h4 {
  font-size: 0.85rem;
  font-weight: 600;
}
h5 {
  font-size: 0.82rem;
  font-weight: 600;
}
p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

/* ============================================================
   PAGE & NAVIGATION
   ============================================================ */

.page {
  display: none;
  padding: 0 20px 100px;
  animation: fadeSlideIn 0.35s ease;
  min-height: 100dvh;
}
.page.active {
  display: block;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* --- Page Header --- */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  padding: 16px 0 12px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon {
  color: var(--primary);
  font-size: 1.6rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.icon-btn:active {
  transform: scale(0.92);
}

.notif-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

/* Tool Header */
.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tool-header h1 {
  flex: 1;
  text-align: center;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: var(--bg-nav);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius);
  transition: all 0.25s ease;
  color: var(--text-muted);
  font-family: var(--font);
}
.nav-item span:last-child {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.nav-item .material-icons-round {
  font-size: 1.35rem;
  transition: all 0.25s;
}
.nav-item:hover {
  color: var(--text-secondary);
}
.nav-item.active {
  color: var(--primary);
}
.nav-item.active .material-icons-round {
  transform: scale(1.1);
}

/* ============================================================
   PROMO BANNER
   ============================================================ */
.promo-banner {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 8px 0 20px;
  color: white;
  position: relative;
  overflow: hidden;
}
.promo-banner::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}
.promo-banner::after {
  content: "";
  position: absolute;
  bottom: -20px;
  left: 40%;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}
.promo-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.promo-icon {
  font-size: 2rem;
  opacity: 0.95;
}
.promo-content h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.promo-content p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.75rem;
}
.btn-promo {
  background: white;
  color: var(--primary);
  border: none;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.btn-promo:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 12px;
}
.section-header h2 {
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-icon {
  font-size: 1.1rem;
  color: var(--primary);
}
.view-all {
  font-size: 0.78rem;
  color: var(--primary);
}

/* ============================================================
   TOOLS GRID (Home Page)
   ============================================================ */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.tool-card:active {
  transform: translateY(0) scale(0.97);
}

.tool-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tool-color) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.tool-icon-wrap .material-icons-round {
  font-size: 1.4rem;
  color: var(--tool-color);
}

.tool-card h4 {
  margin-bottom: 4px;
}
.tool-card p {
  font-size: 0.72rem;
  line-height: 1.4;
}

/* ============================================================
   UTILITIES GRID (Home Page)
   ============================================================ */
.utils-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.util-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
}
.util-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.util-card:active {
  transform: scale(0.97);
}

.util-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--util-color) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.util-icon .material-icons-round {
  font-size: 1.15rem;
  color: var(--util-color);
}
.util-card span:last-child {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================
   RECENT FILES
   ============================================================ */
.recent-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.file-item:hover {
  background: var(--primary-light);
}

.file-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-icon.pdf {
  background: #fce8e8;
}
.file-icon.pdf .material-icons-round {
  color: var(--primary);
}
.file-icon.doc {
  background: #e3f2fd;
}
.file-icon.doc .material-icons-round {
  color: var(--accent-blue);
}
.file-icon.img {
  background: #fff3e0;
}
.file-icon.img .material-icons-round {
  color: var(--accent-orange);
}

.file-info {
  flex: 1;
  min-width: 0;
}
.file-info h5 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info p {
  font-size: 0.72rem;
}

.file-action {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}

.full-list {
  padding-bottom: 24px;
}

/* ============================================================
   ALL TOOLS LIST (Tools Page)
   ============================================================ */
.premium-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fffbe6 0%, #fff3e0 100%);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 8px;
  border: 1px solid #ffe0b2;
}
.premium-icon {
  color: #ff9100;
  font-size: 1.8rem;
}
.premium-card h4 {
  font-size: 0.82rem;
  margin-bottom: 2px;
}
.premium-card p {
  font-size: 0.7rem;
}

.tools-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.tool-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.tool-list-item:hover {
  background: var(--primary-light);
}
.tool-list-item:active {
  transform: scale(0.98);
}

.tl-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tl-color) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tl-icon .material-icons-round {
  color: var(--tl-color);
  font-size: 1.2rem;
}
.tl-info {
  flex: 1;
}
.tl-info h5 {
  margin-bottom: 2px;
}
.tl-info p {
  font-size: 0.7rem;
}
.tl-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  letter-spacing: 0.01em;
}
.btn .material-icons-round {
  font-size: 1.15rem;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  box-shadow: 0 4px 16px rgba(228, 63, 63, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(228, 63, 63, 0.4);
}
.btn-primary:active {
  transform: translateY(0) scale(0.97);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.75rem;
  border-radius: 50px;
}

.btn-full {
  width: 100%;
  margin-top: 16px;
}

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.tool-body {
  padding: 8px 0;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  background: var(--bg-card);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone.drag-over {
  transform: scale(1.01);
}

.upload-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  transition: all 0.3s;
}
.upload-icon-wrap .material-icons-round {
  font-size: 2rem;
  color: var(--primary);
}
.upload-zone:hover .upload-icon-wrap {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(228, 63, 63, 0.15);
}

.upload-zone h3 {
  margin-bottom: 6px;
}
.upload-zone p {
  font-size: 0.75rem;
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* --- Uploaded File Info --- */
.uploaded-file {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
  box-shadow: var(--shadow);
  animation: fadeSlideIn 0.3s ease;
}

.remove-file {
  width: 32px;
  height: 32px;
}
.remove-file .material-icons-round {
  font-size: 1rem;
}

/* Uploaded Files List (multi-file) */
.uploaded-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

/* ============================================================
   PROGRESS CIRCLE
   ============================================================ */
.conversion-progress {
  text-align: center;
  padding: 32px 0;
  animation: fadeSlideIn 0.3s ease;
}

.progress-circle {
  width: 120px;
  height: 120px;
  position: relative;
  margin: 0 auto 16px;
}
.progress-circle svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}
.progress-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}
.progress-bar {
  fill: none;
  stroke: var(--primary);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 0.4s ease;
}
.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}
.progress-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================================
   LANGUAGE SELECT (Translator)
   ============================================================ */
.language-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
}
.lang-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lang-row label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lang-dropdown {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.lang-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(228, 63, 63, 0.1);
}
.swap-lang-btn {
  align-self: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--primary);
  transition: all 0.3s;
}
.swap-lang-btn:hover {
  background: var(--primary);
  color: white;
  transform: rotate(180deg);
}



/* ============================================================
   COMPRESSION OPTIONS
   ============================================================ */
.compression-options {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.compression-options h4 {
  margin-bottom: 12px;
}
.option-chips {
  display: flex;
  gap: 8px;
}
.chip {
  flex: 1;
  padding: 10px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ============================================================
   PASSWORD FIELDS (Protect / Unlock)
   ============================================================ */
.password-fields {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px 0;
  box-shadow: var(--shadow);
  animation: fadeSlideIn 0.3s ease;
}
.input-group {
  margin-bottom: 14px;
}
.input-group:last-child {
  margin-bottom: 0;
}
.input-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.text-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text-primary);
  transition: all 0.2s;
}
.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(228, 63, 63, 0.1);
}

/* ============================================================
   AD BANNER
   ============================================================ */
.ad-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #fffbe6 0%, #fff3e0 100%);
  border: 1px solid #ffe0b2;
  border-radius: var(--radius);
  padding: 14px;
  margin: 16px 0;
}
.ad-banner .material-icons-round {
  color: #ff9100;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.ad-banner p {
  font-size: 0.72rem;
  color: var(--text-primary);
  font-weight: 500;
}

.ad-banner.lg {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px;
  background: #f8f8f8;
  border: 1px dashed var(--border);
  margin-top: 24px;
}
.ad-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============================================================
   SUCCESS PAGE
   ============================================================ */
.success-body {
  text-align: center;
  padding: 24px 0;
}
.success-anim {
  margin-bottom: 24px;
}
.success-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--accent-green) 0%,
    var(--accent-teal) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  animation: successPop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0, 200, 83, 0.25);
}
.success-circle .material-icons-round {
  font-size: 3rem;
  color: white;
}

@keyframes successPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.success-body h2 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}
.success-sub {
  margin-bottom: 24px;
}

.success-file {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: left;
  margin-bottom: 8px;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-body {
  padding: 8px 0;
}
.settings-group {
  margin-bottom: 24px;
}
.settings-group h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.setting-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 4px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
}
.setting-item:hover {
  background: var(--primary-light);
}
.setting-item > .material-icons-round:first-child {
  color: var(--text-secondary);
  font-size: 1.2rem;
}
.setting-item > span:nth-child(2) {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
}
.setting-value {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}
.badge-pro {
  background: linear-gradient(135deg, #ff9100, #ff6d00);
  color: white;
  padding: 3px 8px;
  border-radius: 50px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* Toggle */
.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  cursor: pointer;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 50px;
  transition: all 0.3s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: all 0.3s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.toggle input:checked + .toggle-slider {
  background: var(--primary);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 481px) {
  #app {
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

@media (max-width: 360px) {
  .tools-grid {
    gap: 8px;
  }
  .tool-card {
    padding: 16px 12px;
  }
  .utils-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   LOADING SKELETON
   ============================================================ */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* ============================================================
   RIPPLE EFFECT
   ============================================================ */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
    rgba(228, 63, 63, 0.15) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.ripple:active::after {
  opacity: 1;
}

/* ============================================================
   FREE BANNER (replaces promo banner)
   ============================================================ */
.free-banner {
  background: linear-gradient(135deg, #00c853 0%, #00bfa5 100%);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin: 8px 0 16px;
  color: white;
  position: relative;
  overflow: hidden;
}
.free-banner::before {
  content: '';
  position: absolute;
  top: -25px; right: -25px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}
.free-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.free-icon { font-size: 1.8rem; opacity: 0.95; }
.free-content h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 3px; }
.free-content p { color: rgba(255,255,255,0.88); font-size: 0.72rem; }

.free-badge-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e8f5e9;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.free-badge-bar .material-icons-round { color: #00c853; font-size: 1.1rem; }
.free-badge-bar span:last-child { font-size: 0.78rem; font-weight: 600; color: #2e7d32; }

/* ============================================================
   GOOGLE ADS
   ============================================================ */
.google-ad {
  background: #f8f8f8;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.google-ad.lg {
  min-height: 250px;
  margin-top: 24px;
}
.google-ad ins {
  width: 100%;
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 380px;
  width: calc(100% - 40px);
  padding: 14px 20px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 200;
  text-align: center;
  animation: fadeSlideIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.toast.info { background: #1a1a2e; color: white; }
.toast.success { background: #00c853; color: white; }
.toast.error { background: var(--primary); color: white; }

/* ============================================================
   TEXT PREVIEW (Extract Text tool)
   ============================================================ */
.extracted-text-preview {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px 0;
  box-shadow: var(--shadow);
  animation: fadeSlideIn 0.3s ease;
}
.extracted-text-preview h4 { margin-bottom: 12px; }
.text-preview-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Courier New', monospace;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .material-icons-round {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-state p { font-size: 0.82rem; }

/* ============================================================
   INFO NOTICE
   ============================================================ */
.info-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
}
.info-notice .material-icons-round { color: var(--accent-blue); font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.info-notice p { font-size: 0.75rem; color: #1565c0; font-weight: 500; }

/* ============================================================
   LANGUAGE SELECTOR (Translate PDF)
   ============================================================ */
.language-select {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 14px 0;
  box-shadow: var(--shadow);
  animation: fadeSlideIn 0.3s ease;
}
.language-select h4 { margin-bottom: 12px; }
.lang-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.lang-field {
  flex: 1;
}
.lang-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-primary);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.text-input:focus {
  outline: none;
  border-color: var(--primary);
}
select.text-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.swap-btn {
  flex-shrink: 0;
  margin-bottom: 2px;
  width: 36px;
  height: 36px;
  color: var(--primary);
}

/* ============================================================
   DARK MODE
   ============================================================ */
body.dark-mode {
  --bg: #121212;
  --bg-card: #1e1e2e;
  --bg-nav: #1a1a2a;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;
  --border: #2e2e42;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body.dark-mode {
  background: var(--bg);
  color: var(--text-primary);
}

body.dark-mode .page-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
body.dark-mode .page-header h1,
body.dark-mode .page-header .logo h1 {
  color: #e8e8f0;
}

body.dark-mode .free-banner {
  background: linear-gradient(135deg, #1a3a1a 0%, #1e3e1e 100%);
  border-color: #2a5a2a;
}
body.dark-mode .free-banner h3 { color: #7ddf7d; }
body.dark-mode .free-banner p { color: #5abf5a; }

body.dark-mode .tool-card {
  background: var(--bg-card);
  border-color: var(--border);
}
body.dark-mode .tool-card h4 { color: var(--text-primary); }
body.dark-mode .tool-card p { color: var(--text-secondary); }

body.dark-mode .util-card {
  background: var(--bg-card);
  border-color: var(--border);
}
body.dark-mode .util-card span { color: var(--text-primary); }

body.dark-mode .tool-list-item {
  background: var(--bg-card);
  border-color: var(--border);
}
body.dark-mode .tool-list-item h5 { color: var(--text-primary); }
body.dark-mode .tool-list-item p { color: var(--text-secondary); }

body.dark-mode .upload-zone {
  background: #1a1a2e;
  border-color: #3a3a55;
}
body.dark-mode .upload-zone h3 { color: var(--text-primary); }
body.dark-mode .upload-zone p { color: var(--text-secondary); }
body.dark-mode .upload-zone .upload-icon-wrap {
  background: rgba(228, 63, 63, 0.15);
}

body.dark-mode .uploaded-file {
  background: var(--bg-card);
  border-color: var(--border);
}

body.dark-mode .btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #c62828 100%);
}
body.dark-mode .btn-outline {
  border-color: var(--border);
  color: var(--text-primary);
}
body.dark-mode .btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .bottom-nav {
  background: var(--bg-nav);
  border-color: var(--border);
}
body.dark-mode .nav-item { color: var(--text-muted); }
body.dark-mode .nav-item.active { color: var(--primary); }

body.dark-mode .section-header h2 { color: var(--text-primary); }
body.dark-mode .view-all { color: var(--primary); }

body.dark-mode .settings-body { color: var(--text-primary); }
body.dark-mode .settings-group {
  background: var(--bg-card);
  border-color: var(--border);
}
body.dark-mode .setting-item {
  border-color: var(--border);
  color: var(--text-primary);
}

body.dark-mode .free-badge-bar {
  background: #1a3a1a;
  border-color: #2a5a2a;
  color: #7ddf7d;
}

body.dark-mode .success-body h2 { color: var(--text-primary); }
body.dark-mode .success-sub { color: var(--text-secondary); }
body.dark-mode .success-file {
  background: var(--bg-card);
  border-color: var(--border);
}

body.dark-mode .empty-state { color: var(--text-muted); }
body.dark-mode .file-item {
  background: var(--bg-card);
  border-color: var(--border);
}
body.dark-mode .file-item h5 { color: var(--text-primary); }
body.dark-mode .file-item p { color: var(--text-secondary); }

body.dark-mode .info-notice {
  background: rgba(41, 121, 255, 0.1);
  border-color: rgba(41, 121, 255, 0.3);
}
body.dark-mode .info-notice p { color: #5da3ff; }

body.dark-mode .language-select {
  background: var(--bg-card);
  border-color: var(--border);
}
body.dark-mode .language-select h4 { color: var(--text-primary); }
body.dark-mode .lang-field label { color: var(--text-secondary); }
body.dark-mode .text-input {
  background: #121212;
  color: var(--text-primary);
  border-color: var(--border);
}
body.dark-mode select.text-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23a0a0b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

body.dark-mode .google-ad {
  border-color: var(--border);
  background: var(--bg-card);
}

body.dark-mode .toast {
  background: #2a2a3e;
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .conversion-progress { color: var(--text-primary); }
body.dark-mode .progress-label { color: var(--text-secondary); }

body.dark-mode .icon-btn { color: var(--text-secondary); }
body.dark-mode .icon-btn:hover { color: var(--text-primary); }

body.dark-mode .text-preview-box {
  background: #121212;
  color: var(--text-primary);
  border-color: var(--border);
}

body.dark-mode .tool-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
body.dark-mode .tool-header h1 { color: #e8e8f0; }
