@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── PREMIUM UI UTILITIES ────────────────────────────────── */
:root {
    --brand-primary: #0f172a;
    --brand-accent: #f59e0b;
    --brand-soft: #f8fafc;
    --soft-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --premium-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

[x-cloak] { display: none !important; }

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.premium-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    box-shadow: var(--premium-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 0.5rem; /* rounded-lg equivalent */
}

.premium-card:hover {
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);
}

/* Logos */
.logo-nav    { height: 1.95rem; object-fit: contain; }
.logo-invert { filter: brightness(0) invert(1); }

/* Cursor pointer helper */
.kursor { cursor: pointer; }

/* Table links */
.link-m { border-bottom: 2px solid rgba(37,99,235,.1); transition: all .15s ease; font-weight: 500; }
.link-m:hover { border-bottom-color: #2563eb; color: #2563eb; transform: translateY(-1px); }

/* Print-only date hidden by default */
.ukryte-data { display: none; }

/* ── MOBILE TABLE CARDS ─────────────────────────────────────
   Applied by adding .mobile-table on the wrapper div.
   Below lg (1024px) each <tr> becomes a labeled card.
────────────────────────────────────────────────────────── */
@media screen and (max-width: 1023px) {
  /* Strip wrapper — cards have their own visual treatment */
  .mobile-table {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
  }
  .mobile-table table {
    border-collapse: separate !important;
    border-spacing: 0 16px !important;
    width: 100%;
  }
  .mobile-table thead { display: none !important; }

  /* ── Card ── */
  .mobile-table tbody tr {
    display: block !important;
    background: #ffffff;
    border: 1px solid #f1f5f9 !important;
    border-radius: 0.5rem !important;
    box-shadow: var(--premium-shadow);
    overflow: visible;
    margin-bottom: 24px;
    background-color: #ffffff !important; /* Ensure card stays white on tap/hover */
  }

  /* ── Row ── */
  .mobile-table tbody td {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px !important;
    border-bottom: 1px solid #f8fafc !important;
    font-size: 14px !important;
    font-weight: 600;
    color: #1e293b;
    text-align: right !important;
    min-height: 56px;
  }
  .mobile-table tbody td:first-child {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
  }
  .mobile-table tbody td:last-child {
    border-bottom: none !important;
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
  }

  /* ── Label (::before) ── */
  .mobile-table tbody td::before {
    content: attr(data-label);
    font-size: 12px; /* Increased from 10px */
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64748b; /* slate-500 — passes WCAG AA 4.5:1 on white */
    flex-shrink: 0;
    text-align: left;
  }

  /* ── Stacked full-width rows (Uwagi) ── */
  .mobile-table tbody td.td-full,
  .mobile-table tbody td.td-full-mobile {
    flex-direction: column;
    align-items: flex-start;
    text-align: left !important;
    font-size: 14px !important;
    padding: 20px 20px !important;
    background: #ffffff;
    border-top: 1px solid #f8fafc;
    word-break: break-word; /* Ensure long words break */
    overflow-wrap: anywhere; /* Handle URLs and long strings */
  }
  .mobile-table tbody td.td-full::before,
  .mobile-table tbody td.td-full-mobile::before {
    margin-bottom: 8px;
    color: #64748b; /* slate-500 — passes WCAG AA 4.5:1 on white */
  }

  .mobile-table tbody td:empty { display: none !important; }
  /* no-print nie chowa na mobile — tylko przy druku */
}

/* ── QUANTITY BADGES ──────────────────────────────────────── */
/* Removed p-sztuki-badge: replaced by Tailwind inline classes */

/* ── FORM VALIDATION ───────────────────────────────────────── */
input:user-invalid,
select:user-invalid,
textarea:user-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
    background-color: #fef2f2 !important;
}
input:user-valid:not([type="number"]):not([type="password"]),
select:user-valid,
textarea:user-valid {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15) !important;
}

/* ── UWAGI SUB-ROW ────────────────────────────────────────── */
/* Desktop (≥1024px): hide inline uwagi td                    */
@media (min-width: 1024px) {
  .uwagi-inline { display: none !important; }
}
/* Mobile (<1024px): hide sub-row — higher specificity needed  *
 * to beat .mobile-table tbody tr { display: block !important } */
@media screen and (max-width: 1023px) {
  .mobile-table tbody tr.uwagi-sub-row { display: none !important; }
}

/* ── PRINT ────────────────────────────────────────────────── */
@media print {
  header, nav, .no-print { display: none !important; }
  .ukryte-data { display: inline !important; font-size: .75rem; }
  tr.uwagi-sub-row { display: table-row !important; }
  .uwagi-inline  { display: none !important; }

  /* Wymuś wygląd desktopowy w Tailwind dla wydruków (omijając węższe marginesy ekranu/papieru) */
  .md\:table-header-group { display: table-header-group !important; }
  .md\:hidden { display: none !important; }
}

/* ── REDUCED MOTION ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
