/* Theme variables */
:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.08);
  --text: #e9eef7;
  --muted: rgba(233,238,247,0.75);
  --border: rgba(255,255,255,0.10);
  --shadow: 0 18px 70px rgba(0,0,0,0.45);
  --accent: #ffb300;
}

html[data-theme="light"]{
  --bg: #f6f7fb;
  --panel: rgba(0,0,0,0.04);
  --panel2: rgba(0,0,0,0.06);
  --text: #0f172a;
  --muted: rgba(15,23,42,0.65);
  --border: rgba(0,0,0,0.10);
  --shadow: 0 18px 70px rgba(0,0,0,0.15);
  --accent: #ff7a00;
}

*{ box-sizing: border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
  background: var(--bg);
  color: var(--text);
}

.bg-glow{
  position: fixed;
  inset: -30vh -30vw auto -30vw;
  height: 60vh;
  background: radial-gradient(circle at 30% 20%, rgba(255,179,0,0.22), transparent 60%);
  pointer-events: none;
  z-index: -1;
}

/* Under development banner */
.dev-banner{
  background: var(--accent);
  color: #111;
  text-align: center;
  padding: 8px 12px;
  font-weight: 650;
  font-size: 14px;
}

.wrap{
  max-width: 1060px;
  margin: 24px auto;
  padding: 0 16px 40px;
}

.top{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
}

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

.logo{
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: var(--panel2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 800;
  letter-spacing: 0.8px;
}

.brand-text h1{ margin:0; font-size: 22px; }
.brand-text p{ margin: 4px 0 0; color: var(--muted); }

.right-tools{
  display:flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  min-width: 280px;
}

.toggles{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill{
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.stats{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 14px;
  padding: 12px 12px;
  min-width: 220px;
}
.stats-title{
  font-weight: 700;
  margin-bottom: 8px;
}
.stats-row{
  display:flex;
  justify-content: space-between;
  color: var(--muted);
  margin: 4px 0;
}
.stats-row b{ color: var(--text); }

.badges{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.badge{
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
}
.badge-btn{
  cursor: pointer;
  color: var(--text);
}

.card{
  margin-top: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.dropzone{
  border: 1px dashed var(--border);
  background: rgba(255,255,255,0.03);
  border-radius: 18px;
  padding: 18px;
  cursor: pointer;
}
.dropzone.is-drag{
  outline: 2px solid var(--accent);
}
.file{ display:none; }
.dz-inner{ text-align:center; padding: 10px 0; }
.icon{ font-size: 22px; opacity: 0.9; }
.dz-title{ font-weight: 750; margin-top: 4px; }
.dz-sub{ color: var(--muted); margin-top: 2px; }
.file-name{ margin-top: 10px; color: var(--muted); }

.grid{
  display:grid;
  grid-template-columns: 1fr 240px;
  gap: 12px;
  margin-top: 12px;
}

.field span{
  display:block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}
.field select, .field input, .field textarea{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline: none;
}
.field textarea{ resize: vertical; }

.btn{
  width: 100%;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #111;
  padding: 12px 12px;
  cursor: pointer;
  font-weight: 800;
}
.btn:disabled{ opacity: 0.7; cursor: not-allowed; }
.btn-text{ display:block; }
.btn-sub{ display:block; font-size: 12px; opacity: 0.85; margin-top: 2px; }

.adv{
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.adv summary{
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}
.adv-grid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hint{
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.status{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.12);
}

.foot{
  margin-top: 18px;
  text-align:center;
  color: var(--muted);
  font-size: 13px;
}
.sep{ margin: 0 8px; }
.link{ color: var(--text); text-decoration: underline; cursor: pointer; }

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}
.modal-card{
  position: relative;
  margin: 8vh auto 0;
  width: min(760px, 92vw);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head{
  display:flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.modal-title{ font-weight: 800; }
.modal-x{
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}
.modal-body{
  padding: 14px;
  max-height: min(70vh, 640px);
  overflow: auto;
}
.modal-actions{ margin-top: 12px; }

.btn-small{
  width: auto;
  padding: 10px 12px;
}

/* Hard fix: modal must NOT block when hidden */
.modal[hidden]{
  display: none !important;
  pointer-events: none !important;
}

body.modal-open{ overflow: hidden; }

@media (max-width: 900px){
  .top{ flex-direction: column; align-items: stretch; }
  .right-tools{ align-items: stretch; }
  .badges{ justify-content: flex-start; }
  .grid{ grid-template-columns: 1fr; }
  .adv-grid{ grid-template-columns: 1fr; }
}

/* ===== Footer ===== */
.site-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:16px 20px;
  margin-top:40px;
  font-size:14px;
  border-top:1px solid rgba(255,255,255,0.1);
}

.site-footer a{
  color:inherit;
  text-decoration:none;
  opacity:0.85;
}

.site-footer a:hover{
  opacity:1;
}

/* Facebook icon */
.fb-icon{
  width:22px;
  height:22px;
  fill:#1877f2;
}


/* === JN Enhance === */
.is-hidden{ display:none !important; }

.jn-status{
  margin-top:10px;
  font-size:13px;
  opacity:0.85;
}

button.is-busy{
  opacity:0.85;
  cursor:wait;
}

.pill.tools-pill{
  text-decoration:none;
  cursor:pointer;
}

/* === Donation Modal === */
.modal.hidden{ display:none; }
.modal{
  position:fixed; inset:0; z-index:10000;
}
.modal-backdrop{
  position:absolute; inset:0;
  background:rgba(0,0,0,.45);
}
.modal-box{
  position:relative;
  max-width:420px;
  margin:10vh auto;
  background:var(--card-bg, #fff);
  color:var(--text, #000);
  border-radius:14px;
  padding:22px;
  box-shadow:0 20px 60px rgba(0,0,0,.25);
}
.modal-close{
  position:absolute; top:10px; right:10px;
  border:none; background:transparent; font-size:18px; cursor:pointer;
}
.donation-method{
  margin:14px 0;
  padding:12px;
  border-radius:10px;
  background:rgba(0,0,0,.04);
}
.donation-number{
  font-size:18px;
  font-weight:600;
  letter-spacing:1px;
}
.donation-note{
  font-size:13px;
  opacity:.85;
  margin-top:10px;
}
.pill.donate-pill{
  background:rgba(255,165,0,.15);
  border:1px solid rgba(255,165,0,.35);
  cursor:pointer;
}

.donate-btn{
  border:1px solid rgba(255,165,0,.35) !important;
  background:rgba(255,165,0,.12) !important;
}

/* === Donate button hover effect === */
.donate-btn{
  position: relative;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease,
    border-color .18s ease;
}

.donate-btn:hover{
  transform: translateY(-1px) scale(1.03);
  border-color: rgba(255,165,0,.65) !important;
  background: rgba(255,165,0,.22) !important;
  box-shadow:
    0 6px 20px rgba(255,165,0,.35),
    0 0 0 1px rgba(255,165,0,.25);
}

/* little heart pulse */
.donate-btn:hover::after{
  content: " 💛";
  animation: donatePulse 1.2s infinite;
}

@keyframes donatePulse{
  0%   { opacity:.4; }
  50%  { opacity:1; }
  100% { opacity:.4; }
}


/* === Spinning logo next to JN Converter === */
.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.spin-logo{
  display:inline-block;
  font-size:1.4em;
  opacity:.85;
  animation: spinSlow 6s linear infinite;
  transform-origin:center;
}

@keyframes spinSlow{
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* subtle hover pause */
.brand:hover .spin-logo{
  animation-play-state: paused;
  opacity:1;
}

/* === Brand logo: file + spinning gear === */
.logo{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:1.25em;
}

.file-icon{
  opacity:.85;
}

.spin-gear{
  display:inline-block;
  animation: gearSpin 6s linear infinite;
  opacity:.9;
}

.spin-gear{
  display:inline-block;
  animation: gearSpin 6s linear infinite;
  opacity:.9;
}

@keyframes gearSpin{
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Premium touch: pausa vid hover */
.brand:hover .spin-gear{
  animation-play-state: paused;
  opacity:1;
}

/* Respektera "reduce motion" */
@media (prefers-reduced-motion: reduce){
  .spin-gear{
    animation: none;
  }
}

/* === JN BOTTOM SECTION START === */

/* Generic helpers */
.is-hidden{ display:none !important; }

/* ---------- Brand / Logo (file + gear) ---------- */
.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.logo{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:1.25em;         /* justera vid behov */
  line-height:1;
}

.file-icon{
  opacity:.9;
}

.spin-gear{
  display:inline-block;
  animation: gearSpin 6s linear infinite;
  opacity:.95;
  color:#ff8a00;            /* <- HÄR byter du färg på kugghjulet */
  transform-origin:center;
}

@keyframes gearSpin{
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Premium touch: pausa snurr vid hover */
.brand:hover .spin-gear{
  animation-play-state: paused;
  opacity:1;
  text-shadow: 0 0 8px rgba(255,138,0,.35);
}

/* Respektera "reduce motion" */
@media (prefers-reduced-motion: reduce){
  .spin-gear{ animation:none; }
}

/* ---------- Status under Convert button ---------- */
.jn-status{
  margin-top:10px;
  font-size:13px;
  opacity:0.85;
}

button.is-busy{
  opacity:0.85;
  cursor:wait;
}

/* ---------- Donate button ---------- */
.donate-btn{
  border:1px solid rgba(255,165,0,.35) !important;
  background:rgba(255,165,0,.12) !important;
  position: relative;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease,
    border-color .18s ease;
}

.donate-btn:hover{
  transform: translateY(-1px) scale(1.03);
  border-color: rgba(255,165,0,.65) !important;
  background: rgba(255,165,0,.22) !important;
  box-shadow:
    0 6px 20px rgba(255,165,0,.35),
    0 0 0 1px rgba(255,165,0,.25);
}

/* little heart pulse on hover */
.donate-btn:hover::after{
  content: " 💛";
  animation: donatePulse 1.2s infinite;
}

@keyframes donatePulse{
  0%   { opacity:.4; }
  50%  { opacity:1; }
  100% { opacity:.4; }
}

/* ---------- Donation Modal ---------- */
.modal.hidden{ display:none !important; }
.modal{
  position:fixed;
  inset:0;
  z-index:100000;
}
.modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.55);
}
.modal-box{
  position:relative;
  max-width:420px;
  margin:10vh auto;
  border-radius:14px;
  padding:22px;
  box-shadow:0 20px 60px rgba(0,0,0,.35);

  /* Light default */
  background:#fff;
  color:#111;
}
.modal-close{
  position:absolute;
  top:10px;
  right:10px;
  border:none;
  background:transparent;
  font-size:18px;
  cursor:pointer;
  color:inherit;
}
.donation-method{
  margin:14px 0;
  padding:12px;
  border-radius:10px;
  background:rgba(0,0,0,.04);
}
.donation-number{
  font-size:18px;
  font-weight:700;
  letter-spacing:1px;
}
.donation-note{
  font-size:13px;
  opacity:.85;
  margin-top:10px;
}

/* Dark mode support (om du använder data-theme="dark") */
[data-theme="dark"] .modal-box{
  background:#121212;
  color:#f1f1f1;
}
[data-theme="dark"] .donation-method{
  background:rgba(255,255,255,.06);
}

/* === JN BOTTOM SECTION END === */

/* === Fix brand title alignment === */
.brand-text h1{
  white-space: nowrap;   /* hindra radbrytning */
  line-height: 1.05;
  margin: 0;
}

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

/* minska ikonområdet så det inte påverkar layouten */
.logo{
  font-size: 1.05em;     /* tidigare var den större */
  gap: 5px;
  min-width: 44px;       /* stabil bredd */
  justify-content: center;
}


/* === Header layout fix === */
.top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:32px;
}

.brand{
  display:flex;
  align-items:center;
  gap:16px;
  min-width:0;
}

.logo{
  flex-shrink:0;
}

.logo-img{
  height:44px;
  width:auto;
  display:block;
}

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

.brand-title{
  margin:0;
  font-size:1.55rem;
  line-height:1.15;
}

.brand-sub{
  margin:0;
  font-size:0.95rem;
  opacity:0.85;
  max-width:520px;
}

/* Se till att högerdelen inte trycker vänster */
.top-actions{
  flex-shrink:0;
}


/* === Logo cleanup (JN Converter) === */
.brand{
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo,
.logo-img,
.brand .logo{
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.brand-title{
  margin: 0;
  line-height: 1.1;
}

/* === Logo no-badge variant === */
.logo,
.logo-img,
.brand .logo{
  background: transparent !important;
  box-shadow: none !important;
}

/* === Remove small text inside logo badge === */
.brand .logo *,
.brand .logo span,
.brand .logo div,
.brand .logo-text {
  display: none !important;
}

/* === Remove logo badge entirely === */
.brand .logo {
  display: none !important;
}

/* === Hover effect: Convert button === */
.convert-btn,
button[type="submit"],
.btn-primary {
  transition: 
    transform .18s ease,
    box-shadow .18s ease,
    background-color .18s ease,
    filter .18s ease;
}

.convert-btn:hover,
button[type="submit"]:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 140, 0, 0.35);
  filter: brightness(1.05);
}

/* === Hover effect: Facebook icon === */
.fb-icon,
.footer-social a,
.social a {
  transition:
    transform .2s ease,
    box-shadow .2s ease,
    filter .2s ease;
}

.fb-icon:hover,
.footer-social a:hover,
.social a:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 16px rgba(24, 119, 242, 0.45);
  filter: brightness(1.1);
}

/* === Ensure top right buttons are clickable === */
.top-actions, .toggles {
  position: relative;
  z-index: 50;
}

.pill {
  pointer-events: auto;
  cursor: pointer;
}


/* === Modal base (privacy/gdpr) === */
.modal.hidden{ display:none; }
.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.55);
}
.modal-card{
  position: relative;
  width: min(720px, calc(100% - 28px));
  margin: 8vh auto 0;
  background: rgba(255,255,255,.98);
  border-radius: 16px;
  padding: 18px 18px 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.modal-close{
  position:absolute;
  top:10px;
  right:10px;
  border:none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

html[data-theme="dark"] .modal-card{
  background: rgba(20,20,24,.98);
}


/* === Modal base (privacy/gdpr) === */
.modal.hidden{ display:none; }
.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.55);
}
.modal-card{
  position: relative;
  width: min(760px, calc(100% - 28px));
  margin: 7vh auto 0;
  background: rgba(255,255,255,.98);
  border-radius: 16px;
  padding: 18px 18px 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.modal-close{
  position:absolute;
  top:10px;
  right:10px;
  border:none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}
html[data-theme="dark"] .modal-card{
  background: rgba(20,20,24,.98);
}


/* === EMERGENCY: if page becomes unclickable, ensure hidden modals never capture clicks === */
.modal.hidden{
  display:none !important;
  pointer-events:none !important;
}
.modal.hidden *{
  pointer-events:none !important;
}

/* === CLICK FIX (force page clickable) === */
/* Hidden modals must never block anything */
.modal[hidden],
.modal.hidden{
  display: none !important;
  pointer-events: none !important;
}

/* Backdrops are OFF by default */
.modal-backdrop{
  display: none !important;
  pointer-events: none !important;
}

/* Only when a modal is visible (not hidden and not [hidden]) do we enable backdrop */
.modal:not([hidden]):not(.hidden) .modal-backdrop{
  display: block !important;
  pointer-events: auto !important;
}

/* Ensure body isn't stuck in modal-open */
body.modal-open{
  overflow: auto !important;
}

/* === HARD CLICK OVERRIDE === */
html, body, .wrap, main, header, section, footer{
  pointer-events: auto !important;
}

/* === File picker: safe hidden input (NOT display:none) === */
.file-input-hidden{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}
.file-pick{
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
}
.file-pick:hover{
  transform: translateY(-1px);
}

/* === File picker fix === */
.file{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.file-pick{
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
}

.file-pick:hover{
  transform: translateY(-1px);
}

/* Status messages */
.status {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 20px;
    font-size: 14px;
    transition: all 0.3s;
}

.status-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.status-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.status-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Drag and drop states */
.dropzone.dragover {
    border-color: #007bff !important;
    background-color: rgba(0, 123, 255, 0.1) !important;
}

.dropzone.dragover .icon {
    transform: scale(1.1);
}

/* Button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* File name display */
.file-name {
    margin-top: 10px;
    font-weight: 500;
    color: #007bff;
}

/* Modal open state */
.modal-open {
    overflow: hidden;
}

.small-note{
  margin-top: 6px;
  font-size: 12px;
  opacity: .75;
}

/* --- Progress UI (stable) --- */
.progress-bar{
  width:100%;
  height:10px;
  border-radius:999px;
  background: rgba(255,255,255,.10);
  overflow:hidden;
}
.progress-fill{
  height:100%;
  width:0%;
  border-radius:999px;
  background: rgba(255,255,255,.65);
  transition: width .15s ease;
}

/* --- Progress UI (stable) --- */
.progress-bar{
  width:100%;
  height:10px;
  border-radius:999px;
  background: rgba(255,255,255,.10);
  overflow:hidden;
}
.progress-fill{
  height:100%;
  width:0%;
  border-radius:999px;
  background: rgba(255,255,255,.65);
  transition: width .15s ease;
}
