/* Basic styling for the offline PDF merger */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --text-strong: rgba(15, 23, 42, 0.92);
  --muted: rgba(15, 23, 42, 0.65);
  --subtle: rgba(15, 23, 42, 0.22);
  --surface: rgba(15, 23, 42, 0.04);
  --surface-strong: rgba(15, 23, 42, 0.08);
  --border: rgba(15, 23, 42, 0.15);
  --border-strong: rgba(15, 23, 42, 0.26);
  --accent: #0e7490; /* teal-blue, complements the light neutral scheme */
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.15);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --line-height: 1.58;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--text);
  background: radial-gradient(circle at 20% 6%, rgba(29, 78, 216, 0.15), transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(16, 185, 129, 0.12), transparent 60%),
    linear-gradient(155deg, #f4f6fb 0%, #e7eaf5 100%);
  text-rendering: optimizeLegibility;
}

h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2.5rem;
  padding: 2rem 1.5rem;
  max-width: 1120px;
  margin: 0 auto;
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
}

.trust {
  display: flex;
  justify-content: center;
  width: 100%;
}

.trust__card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.10);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  line-height: 1.4;
}

.trust__card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.proof__toggle {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 120ms ease, transform 120ms ease;
}

.proof__toggle:hover {
  background: var(--surface-strong);
}

.proof__toggle:active {
  transform: scale(0.98);
}

.proof__toggle:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.9);
  outline-offset: 2px;
}

.proof__toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.trust__card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

@media (max-width: 980px) {
  .trust__card {
    max-width: 100%;
  }
}

/* Thinner/subtle scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--subtle) transparent;
}

/* WebKit-based browsers */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--subtle);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

.app__header {
  text-align: center;
}

.app__header h1 {
    display: flex;
    align-items: center;
    justify-content: center;
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text-strong);
}

.subtitle {
  margin: 0.75rem auto 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  font-weight: 500;
}

.privacy-group {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
}

.privacy-banner {
  background: rgba(29, 78, 216, 0.06);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  display: grid;
  gap: 0.35rem;
  max-width: 880px;
}

.privacy-banner__line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-strong);
  font-weight: 600;
}

.privacy-banner__icon {
  width: 1.1em;
  display: inline-flex;
  justify-content: center;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.10);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  margin-bottom: -1px; /* collapse border with trust card */
  width: 100%;
  max-height: 10000;
  max-width: 720px;
  min-height: 400px;
  margin: 0 auto;
  transition: height 2s ease-in-out;
}

.card--dragover {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.2);
  color: #ffffff;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.45);
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 5;
}

.drop-hint--visible {
  opacity: 1;
}

.drop-hint--error {
  background: rgba(239, 68, 68, 0.85);
}

.card + .trust {
  margin-top: -1px; /* collapse border */
}

.card + .trust .trust__card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.card {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.status {
  width: fit-content;
  left: 1rem;
  font-size: 0.85rem;
  min-height: 2.6rem;
  color: var(--muted);
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.status__prefix {
  font-family: var(--font);
  color: var(--text);
}

.status__value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
}

.status__value--ready {
  color: #15803d; /* slightly darker green for readability */
}

.status__value--info {
  color: #d97706; /* deeper yellow/amber for contrast */
}

.status__value--error {
  color: #b91c1c; /* strong dark red for readability */
}

.network-activity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--muted);
}

.network-activity__dot {
  width: 0.65rem;
  height: 0.65rem;
  min-width: 0.65rem;
  min-height: 0.65rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 0 1px var(--border);
}
.network-activity__dot--offline {
  background: rgba(239, 68, 68, 0.9);
}

.network-activity__dot--warn {
  background: rgba(250, 204, 21, 0.9);
}

.network-activity__text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.75rem;
  font-weight: 600;
}

.proof {
  margin: 1rem 0 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.proof__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.proof__title {
  font-weight: 600;
  color: var(--text-strong);
}

.proof__log {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 10rem;
  overflow-y: auto;
  padding: 0.75rem 1.5rem 0.75rem 0.75rem;
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  line-height: 1.4;
  white-space: pre-wrap;
}

.proof__clear {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  padding: 0.25rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
}

.proof__clear:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.btn--small {
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
}

.file-input {
  display: grid;
  gap: 0.75rem;
}

.file-input__hint {
  margin: auto;
  margin-top: 130px;
  max-width: 600px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.4;
}
.file-input__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.2rem;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.no-select {
  user-select: none;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 9999;
  cursor: grabbing;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  user-select: none;
}

.file-list__wrapper {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: var(--surface);
}

.file-list__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.file-list__table-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 80px 75px 95px 44px;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem 0.4rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.file-list__item {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 80px 65px 95px 44px;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: grab;
  transition: transform 120ms ease-out, box-shadow 160ms ease, background 160ms ease;
}

.file-list__table-cell {
  display: block;
}

.file-list__table-cell--drag {
  text-align: center;
}

.file-list__table-cell--date {
  text-align: center;
}

.file-list__table-cell--size {
  text-align: center;
}

.file-list__table-cell--controls {
  text-align: center;
}

.file-list__table-cell--remove {
  text-align: center;
}

.file-list__actions {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.file-list__remove {
  display: flex;
  justify-content: center;
}

.file-list__hint {
  color: var(--muted);
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.file-list__item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--border);
  pointer-events: none;
}

.file-list__item.dragging {
  cursor: grabbing;
  opacity: 0.7;
  transform: scale(1.02);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.file-list__grip {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--text);
  cursor: grab;
  border-radius: 12px;
  background: var(--surface);
  transition: background 120ms ease, transform 120ms ease;
}

.file-list__grip:hover {
  background: var(--surface-strong);
}

.file-list__grip:active {
  cursor: grabbing;
  transform: scale(0.96);
}

.file-list__controls {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  min-width: 160px;
}

.file-list__btn {
  width: 2.2rem;
  height: 2.2rem;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 120ms ease;
}

.file-list__btn:hover {
  background: var(--surface-strong);
}

.file-list__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.file-list__btn--remove {
  background: rgba(239, 68, 68, 0.18);
  color: rgba(239, 68, 68, 0.9);
}

.file-list__btn--remove:hover {
  background: rgba(239, 68, 68, 0.25);
}

.file-list__add {
  width: 100%;
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

.file-list__add:hover {
  background: var(--surface-strong);
  border-color: var(--accent);
}

.file-list__wrapper--dragover {
  border-color: rgba(59, 130, 246, 0.75);
  background: rgba(59, 130, 246, 0.06);
}

.file-list__placeholder {
  height: 2px;
  border-top: 2px dashed rgba(59, 130, 246, 0.9);
  margin: 0.35rem 0;
}

.file-list__item {
  transition: transform 220ms ease, box-shadow 220ms ease, background 160ms ease;
}

.file-list__item.dragging {
  opacity: 0.9;
}

.file-list__item:active {
  cursor: grabbing;
}

.file-list__item.dragging {
  cursor: grabbing;
  opacity: 0.65;
  transform: scale(1.02);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.file-list__item.flash {
  animation: flash-highlight 0.44s ease;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.8);
}

@keyframes flash-highlight {
  0% {
    background: rgba(59, 130, 246, 0.35);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.9);
  }
  50% {
    background: rgba(59, 130, 246, 0.25);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6);
  }
  100% {
    background: rgba(0, 0, 0, 0.25);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.file-list__date {
  font-size: 0.82rem;
  color: var(--muted);
  width: 80px;
  text-align: right;
}

.file-list__size {
  font-size: 0.82rem;
  color: var(--muted);
  justify-self: end;
  width: 75px;
  text-align: right;
}

.file-list__name {
  min-width: 0;
}

.file-list__name {
  font-size: 0.95rem;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input__label:hover {
  border-color: var(--accent);
  background: var(--surface-strong);
}

.file-input input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.actions__group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.file-input__icon {
  display: inline-flex;
  width: 1.1em;
  justify-content: center;
  align-items: center;
}

.file-input__text {
    text-transform: uppercase;
    letter-spacing: 0.05rem;
  font-weight: 600;
}

.btn {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.8rem 1.2rem;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

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

.confirm {
  margin: auto;
  padding: 1.25rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  max-width: 720px;
  width: 100%;
}

.confirm__header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.confirm__hint {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.confirm__content {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.confirm__files {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.75rem;
}

.confirm__file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  counter-reset: file-item;
}

.confirm__file-item {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  position: relative;
}

.confirm__file-item::before {
  content: counter(file-item) ".";
  counter-increment: file-item;
  font-weight: 600;
  margin-right: 0.6rem;
  color: var(--muted);
}

.confirm__ad {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
  text-align: center;
  color: var(--muted);
}

/* Ensure the hidden attribute actually hides the ad container (author styles can override UA defaults). */
.confirm__ad[hidden] {
  display: none !important;
}

.confirm__ad-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.confirm__ad-placeholder {
  border-radius: 10px;
  padding: 1rem;
  background: var(--surface);
  font-size: 0.85rem;
  line-height: 1.3;
}

.confirm__actions {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.download {
  margin-top: 1.5rem;
  text-align: center;
}

.download__link {
  display: inline-block;
  width: 100%;
  padding: 0.85rem 1.3rem;
  border-radius: 999px;
  background: var(--accent);
  border: 1px solid rgba(14, 116, 144, 0.6);
  text-decoration: none;
  color: #ffffff;
  font-weight: 700;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.download__link:hover {
  background: rgba(14, 116, 144, 0.9);
  border-color: rgba(14, 116, 144, 0.8);
  transform: translateY(-1px);
}

.footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

/* When offline, footer links are disabled to avoid navigation failures. */
.footer-links a.offline-disabled {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: none;
}
