/* ============================================================
   ULTRA THEME ENGINE 3.0 — LITE
   Minimalny, czysty, stabilny system motywów dla Twojego UI
   Zachowuje 100% wyglądu oryginału, usuwa wszystkie konflikty
============================================================ */

/* ============================================================
   1. MOTYW JASNY / CIEMNY (DESIGN TOKENS)
============================================================ */

:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --text: #2b2b2b;
  --muted: #666;
  --border: #dcdcdc;

  --accent: #6bbf59;
  --accent-hover: #57a649;

  --hover: rgba(0, 0, 0, 0.05);
  --shadow: rgba(0, 0, 0, 0.05);
  --shadow-strong: rgba(0, 0, 0, 0.12);

  --radius: 12px;
  --radius-sm: 8px;
  
  /* soft accent (u Ciebie używane w index.html) */
  --accent-soft-bg: rgba(107,191,89,0.10);
  --accent-soft: rgba(107,191,89,0.35);

  /* “premium” elevation */
  --shadow-card: 0 10px 30px var(--shadow);
  --shadow-card-strong: 0 16px 44px var(--shadow-strong);
}

:root.dark {
  --bg: #020617;
  --surface: #0f172a;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;

  --accent: #10b981;
  --accent-hover: #34d399;

  --hover: rgba(255, 255, 255, 0.06);
  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-strong: rgba(0, 0, 0, 0.6);
  
  --accent-soft-bg: rgba(16,185,129,0.12);
  --accent-soft: rgba(16,185,129,0.35);
}



/* ============================================================
   2. GLOBALNE TŁO + BEZPIECZNY SYSTEM PRZEJŚĆ
============================================================ */

html {
  transition: background-color .4s ease, color .4s ease;
}

body {
  background: radial-gradient(circle at top, var(--surface) 0, var(--bg) 55%, var(--bg) 100%);
  color: var(--text);
  transition: background-color .4s ease, color .4s ease;
}

/* Bezpieczne przejścia — bez *input* (nie psuje formularzy) */
body,
body *:not(input):not(select):not(textarea):not(button):not(label) {
  transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

/* ============================================================
   3. UTILITY CLASSES
============================================================ */

.bg-surface { background-color: var(--surface); }
.bg-bg      { background-color: var(--bg); }
.text-main  { color: var(--text); }
.text-muted { color: var(--muted); }
.border-main { border-color: var(--border); }

/* ============================================================
   4. PRZYCISKI
============================================================ */

.btn-accent {
  background-color: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  padding: .6rem 1.2rem;
  transition: background-color .2s ease, transform .2s ease;
}
.btn-accent:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

/* ============================================================
   5. KARTY (cards)
============================================================ */

.card {
  background-color: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 16px; /* ciut bardziej premium niż 12px */
  box-shadow: var(--shadow-card);
}

.card.upload {
  background: linear-gradient(to bottom right, rgba(107,191,89,0.05), rgba(0,0,0,0.02));
  border-color: rgba(107,191,89,0.4);
}

/* Panel odbioru: bardziej “elegancki”, neutralny (bez zielonej poświaty) */
.card.download {
  background: linear-gradient(
    to bottom right,
    rgba(255,255,255,0.98),
    rgba(0,0,0,0.015)
  );
}

:root.dark .card.download {
  background: linear-gradient(
    to bottom right,
    rgba(15,23,42,0.92),
    rgba(255,255,255,0.03)
  );
}

/* ============================================================
   6. TABS
============================================================ */

.tab-gradient-active {
  background: linear-gradient(to bottom,
      rgba(107,191,89,0.18),
      rgba(107,191,89,0.10)
  );
  box-shadow: inset 0 0 0 1px rgba(107,191,89,0.35);
  color: var(--accent) !important;
}

/* Elegancki aktywny tab — działa po aria-selected */
[role="tablist"] [role="tab"][aria-selected="true"] {
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--accent) 16%, transparent),
    rgba(255,255,255,0)
  );
  color: var(--text) !important;
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--accent) 45%, transparent);
}

[role="tablist"] [role="tab"][aria-selected="true"] svg {
  color: var(--accent);
}

/* ============================================================
   7. DRAG & DROP
============================================================ */

#dropZone {
  transition: border-color .25s ease, background-color .25s ease;
}
#dropZone svg {
  opacity: 0.9;
  transition: transform .2s ease, opacity .2s ease;
}
#dropZone:hover svg {
  transform: translateY(-2px);
  opacity: 1;
}
#dropZone.dragover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: rgba(16, 185, 129, 0.08);
}

/* ============================================================
   8. LISTA PLIKÓW
============================================================ */

.file-item {
  opacity: 0;
  transform: translateY(4px);
  padding: 4px 8px;
  transition: opacity .25s ease, transform .25s ease;
}
.file-item.show {
  opacity: 1;
  transform: translateY(0);
}
.file-item:hover {
  background-color: var(--hover);
}
.file-remove {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  opacity: 0.8;
  transition: opacity .2s ease, transform .2s ease;
}
.file-remove:hover {
  opacity: 1;
  transform: scale(1.2);
}

/* ============================================================
   9. TOASTY
============================================================ */

.toast {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .4s ease, transform .4s ease;
  font-weight: 500;
}
.toast.opacity-0 {
  opacity: 0;
  transform: translateY(-4px);
}

/* ============================================================
   10. LOGA LIGHT / DARK
============================================================ */

.logo-light, .logo-dark {
  display: none;
}
:root:not(.dark) .logo-light { display: block; }
:root.dark .logo-dark { display: block; }

/* ============================================================
   11. MODALE — GLASSMORPHISM
============================================================ */

#uploadSuccessModal > div,
#pickupCodeModal > div {
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 8px 32px var(--shadow-strong);
  border: 1px solid rgba(200,200,200,0.4);
  background-color: rgba(255,255,255,0.7);
}

:root.dark #uploadSuccessModal > div,
:root.dark #pickupCodeModal > div {
  background-color: rgba(15,23,42,0.65);
  border-color: rgba(255,255,255,0.08);
}


/* ============================================================
   12. AUTOFILL BAIT — OCHRONA PRZED AUTOUZUPEŁNIANIEM CHROME
============================================================ */

.autofill-bait {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;

    /* Chrome musi widzieć pole, ale nie użytkownik */
    width: 1px !important;
    height: 1px !important;

    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;

    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}


/* ============================================================
   13. GLOBAL MODAL LAYER
============================================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-bg {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    z-index: 2;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    width: 480px;
    max-width: calc(100% - 2rem);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFade .18s ease-out;
}

.cci-readonly {
    background: #f3f4f6;
}

/* smooth pop-in */
@keyframes modalFade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0px);
    }
}


/* Kafelki z cyframi kodu odbioru */
.receive-code-input {
  font-weight: 600;
}


/* PIN — bardziej “premium” w dotyku */
.receive-code-input {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 1px 2px rgba(0,0,0,0.04);
  border-color: color-mix(in srgb, var(--border) 78%, transparent);
}

.receive-code-input:focus {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent),
    0 1px 2px rgba(0,0,0,0.06);
}

/* ID i token — delikatniejsza ramka + fokus */
#receiveRecipientId,
#receiveCodeSection input[name="token"] {
  border-color: color-mix(in srgb, var(--border) 78%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

#receiveRecipientId:focus,
#receiveCodeSection input[name="token"]:focus {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent),
    inset 0 1px 0 rgba(255,255,255,0.55);
}


.cta-triangle {
  margin: 2rem 0 0.5rem;
  text-align: center;
}

.cta-triangle-text {
  display: inline-block;
  padding: 0.7rem 1.8rem 2.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(107, 191, 89, 0.1); /* rozjaśniony akcent */
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.cta-triangle-text span {
  display: block;
  margin-top: 0.15rem;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--muted);
}



.share-card {
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  text-align: center;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 88px; /* ~2/3 poprzedniej */
}

.share-card .icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.share-card .title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.2;
}

.share-card .desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

/* hover */
.share-card:hover {
  border-color: var(--accent);
}

/* Active card */
.share-card.active {
  border-color: var(--accent);
  background: rgba(107,191,89,0.07);
}

.share-card.active .icon {
  color: var(--accent);
}


/* ============================================================
   14. NOWY STYL: przełącznik "Jak chcesz przekazać link?"
============================================================ */

/* Kontener przełącznika */
.link-delivery-group {
  display: inline-flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Przycisk przełącznika */
.link-delivery-btn {
  cursor: pointer;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid transparent;
  opacity: 0.75;
  transition: all .2s ease;
}

/* Hover tylko dla nieaktywnych */
.link-delivery-btn:hover:not([aria-pressed="true"]) {
  background: var(--surface);
  color: var(--text-main);
  opacity: 0.9;
}

/* Stan aktywny */
.link-delivery-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  opacity: 1;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(107,191,89,0.35);
}


/* ============================================================
   15. INVOICE MODAL
============================================================ */

/* ===== Premium Invoice Modal ===== */
#invoiceModal .invoice-modal{
  width: min(920px, 96vw);
  max-height: min(82vh, 760px);
  overflow: hidden;
  padding: 0;
  position: relative;
  border-radius: 18px;
}

#invoiceModal .invoice-modal__header{
  padding: 18px 18px 10px 18px;
}

#invoiceModal .invoice-modal__title{
  margin: 0;
  font-size: 1.15rem;
  font-weight: 850;
  color: var(--text);
}

#invoiceModal .invoice-modal__subtitle{
  margin: 6px 0 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

#invoiceModal .invoice-modal__close{
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  color: #6b7280;
  font-size: 18px;
  line-height: 1;
}

#invoiceModal .invoice-modal__form{
  display: flex;
  flex-direction: column;
  height: 100%;
}

#invoiceModal .invoice-modal__body{
  overflow: auto;
  padding: 10px 18px 18px 18px;
}

#invoiceModal .invoice-modal__footer{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 16px 18px;
  border-top: 1px solid var(--border);
  background: white;
}

/* 12-col grid: wypełnia przestrzeń, brak "dziur" */
#invoiceModal .invoice-grid{
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

#invoiceModal .field{ min-width: 0; }
#invoiceModal .field .invite-label{ display:block; margin-bottom: 6px; }

#invoiceModal .span-12{ grid-column: span 12; }
#invoiceModal .span-8{ grid-column: span 8; }
#invoiceModal .span-6{ grid-column: span 6; }
#invoiceModal .span-4{ grid-column: span 4; }
#invoiceModal .span-3{ grid-column: span 3; }

/* Mobile: wszystko na pełną szerokość */
@media (max-width: 720px){
  #invoiceModal .span-12,
  #invoiceModal .span-8,
  #invoiceModal .span-6,
  #invoiceModal .span-4,
  #invoiceModal .span-3{ grid-column: span 12; }
}

/* Upewnijmy się że inputy rozciągają się w kolumnach */
#invoiceModal .dashboard-input{
  width: 100%;
}