:root {
  /* Brand palette — sampled from the LMT PDF Academy badge */
  --brand-red: #E31E24;
  --brand-red-dark: #A3121A;
  --brand-red-darker: #7A0D12;
  --brand-red-light: #FFE5E6;

  --bg: #F7F6F8;
  --surface: #FFFFFF;
  --border: #ECE7E8;
  --text: #201617;
  --text-muted: #7A6E6F;

  --success: #1A8A4A;
  --success-bg: #EFFBF3;
  --error: #C81E27;
  --error-bg: #FDEEEE;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(60, 10, 12, 0.06), 0 10px 28px rgba(60, 10, 12, 0.07);

  --font-display: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ------------------------------------------------------------------ */
/* Language modal                                                      */
/* ------------------------------------------------------------------ */
.lang-modal {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, var(--brand-red) 0%, var(--brand-red-darker) 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.lang-modal.visible { display: flex; }

.lang-modal-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.lang-modal-logo {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  margin-bottom: 18px;
}

.lang-modal-card h2 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.lang-modal-card p {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--text-muted);
}

.lang-modal-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lang-option {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: white;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.lang-option:hover {
  border-color: var(--brand-red);
  background: var(--brand-red-light);
  color: var(--brand-red-dark);
}

/* ------------------------------------------------------------------ */
/* Header                                                               */
/* ------------------------------------------------------------------ */
.topbar {
  background: radial-gradient(circle at 20% 20%, var(--brand-red) 0%, var(--brand-red-darker) 75%);
  color: white;
  padding: 24px 24px 56px;
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; }

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-tagline {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.88;
}

.lang-switcher {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.14);
  padding: 4px;
  border-radius: 999px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: white;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.75;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.lang-btn:hover { opacity: 1; }

.lang-btn.active {
  background: white;
  color: var(--brand-red-dark);
  opacity: 1;
}

/* ------------------------------------------------------------------ */
/* App shell / nav / panel                                             */
/* ------------------------------------------------------------------ */
.app-shell {
  max-width: 1080px;
  width: 100%;
  margin: -34px auto 0;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  flex: 1;
}

.tool-nav {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tool-btn:hover { background: var(--brand-red-light); }

.tool-btn.active {
  background: var(--brand-red);
  color: white;
}

.tool-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  display: inline-flex;
}
.tool-icon svg { width: 100%; height: 100%; }

.tool-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  min-height: 420px;
}

.tool-view { display: none; animation: fadeIn 0.2s ease; }
.tool-view.active { display: block; }

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

.tool-view h2 {
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tool-desc {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 14.5px;
}

/* ------------------------------------------------------------------ */
/* Dropzone                                                             */
/* ------------------------------------------------------------------ */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  background: #FBFAFB;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--brand-red);
  background: var(--brand-red-light);
}

.dropzone-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 10px;
  display: block;
  color: var(--brand-red);
}
.dropzone-icon svg { width: 100%; height: 100%; }

.dropzone-content p {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
}

.dropzone-sub {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.file-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-list:empty { margin: 0; }

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
}

.file-remove {
  width: 16px;
  height: 16px;
  color: var(--error);
  cursor: pointer;
  flex-shrink: 0;
}
.file-remove svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------------ */
/* Options / inputs                                                     */
/* ------------------------------------------------------------------ */
.option-group {
  margin: 20px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.radio-option input[type="radio"] { accent-color: var(--brand-red); }

.field-label {
  font-size: 14px;
  font-weight: 600;
}

.text-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
  max-width: 320px;
  font-family: inherit;
}

.text-input:focus {
  outline: none;
  border-color: var(--brand-red);
}

.text-input:disabled { background: #f3f1f1; color: #b2a9aa; }

/* ------------------------------------------------------------------ */
/* Buttons                                                              */
/* ------------------------------------------------------------------ */
.btn-primary {
  margin-top: 24px;
  background: var(--brand-red);
  color: white;
  border: none;
  padding: 12px 26px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover { background: var(--brand-red-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ------------------------------------------------------------------ */
/* Status messages                                                      */
/* ------------------------------------------------------------------ */
.status-area { margin-top: 18px; font-size: 14px; }

.status-msg {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
}
.status-icon svg { width: 100%; height: 100%; }

.status-msg.success { background: var(--success-bg); color: var(--success); }
.status-msg.error { background: var(--error-bg); color: var(--error); }
.status-msg.loading { background: var(--brand-red-light); color: var(--brand-red-dark); }

.icon-spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ */
/* Footer                                                               */
/* ------------------------------------------------------------------ */
.app-footer {
  text-align: center;
  padding: 10px 18px 26px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.app-footer p { margin: 0 0 10px; }

.footer-credit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.footer-credit:hover { color: var(--brand-red-dark); }

.footer-credit-logo {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                           */
/* ------------------------------------------------------------------ */
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; margin-top: -26px; }
  .tool-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
  }
  .tool-btn { flex-direction: column; gap: 4px; padding: 10px; font-size: 11px; white-space: nowrap; }
  .tool-icon { width: 17px; height: 17px; }
  .tool-panel { padding: 22px; }
  .topbar { padding: 20px 18px 48px; }
  .brand-logo { width: 44px; height: 44px; }
  .brand-name { font-size: 18px; }
  .lang-modal-card { padding: 32px 24px; }
}

@media (max-width: 420px) {
  .topbar-inner { justify-content: center; text-align: center; }
  .brand { flex-direction: column; }
}
