/* === RESET & BASE === */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, #fff0f6, #ffe4ec);
  margin: 0;
  padding: 0;
  color: #3a3a3a;
}

/* === PANEL === */
.panel {
  max-width: 1200px;
  margin: 40px auto;
  background: #ffffff;
  padding: 35px;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(255, 105, 180, 0.18);
}

/* === HEADINGS === */
h2 {
  margin-top: 0;
  font-size: 26px;
  font-weight: 700;
  color: #ff4f9a;
}

h3 {
  margin-top: 35px;
  font-size: 18px;
  color: #ff4f9a;
  border-bottom: 2px solid #ffe0eb;
  padding-bottom: 6px;
}

/* === LINKS === */
a {
  text-decoration: none;
  font-weight: 600;
  color: #ff4f9a;
  margin-right: 15px;
}

a:hover {
  text-decoration: underline;
}

/* === FORMS === */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #555;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #ffd1e3;
  background: #fffafb;
  font-size: 14px;
  margin-bottom: 14px;
  transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #ff4f9a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 79, 154, 0.15);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

/* === BUTTONS === */
button {
  background: linear-gradient(135deg, #ff4f9a, #ff77b7);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 8px 20px rgba(255, 79, 154, 0.35);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(255, 79, 154, 0.45);
}

button[type="button"] {
  background: #ffe0eb;
  color: #ff4f9a;
  box-shadow: none;
}

button[type="button"]:hover {
  background: #ffd1e3;
}

/* === TABLES === */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 15px;
  overflow: hidden;
  border-radius: 14px;
}

th {
  background: #fff0f6;
  color: #ff4f9a;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 14px;
}

td {
  padding: 14px;
  border-top: 1px solid #ffe0eb;
  font-size: 14px;
  vertical-align: top;
}

tr:hover td {
  background: #fff7fa;
}

/* === STATUS TAGS (opcjonalnie pod przyszłość) === */
.status {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.nowe {
  background: #ffe0eb;
  color: #ff4f9a;
}

.status.oplacone {
  background: #e6fff3;
  color: #00a870;
}

.status.wyslane {
  background: #eef3ff;
  color: #4a6bff;
}

/* === MOBILE === */
@media (max-width: 768px) {
  .panel {
    margin: 15px;
    padding: 22px;
  }

  table, thead, tbody, tr, th, td {
    display: block;
  }

  th {
    display: none;
  }

  td {
    border: none;
    padding: 10px 0;
  }

  tr {
    border-bottom: 1px solid #ffe0eb;
    margin-bottom: 15px;
  }
}


.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 240, 246, 0.95);
  backdrop-filter: blur(8px);
  padding: 12px 0;
  border-bottom: 1px solid #ffd1e3;
}

.top-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-bar a {
  font-weight: 700;
  color: #ff4f9a;
  text-decoration: none;
  margin-right: 15px;
}

.top-bar a:hover {
  text-decoration: underline;
}



/* === PAGINATION === */
.pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0 10px;
}

.pagination a {
  display: inline-block;
  padding: 6px 12px;
  background: #1a1a2e;
  color: #ff4f9a;
  border: 1px solid #ff4f9a;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.pagination a:hover {
  background: #ff4f9a;
  color: #fff;
}

.pagination a.active {
  background: #ff4f9a;
  color: #fff;
  font-weight: 700;
  pointer-events: none;
}

.pagination-info {
  margin-left: 10px;
  color: #aaa;
  font-size: 13px;
}

/* === PARAGON === */
.paragon-tak {
  display: inline-block;
  background: #1db954;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.paragon-nie {
  display: inline-block;
  background: #444;
  color: #aaa;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

/* === WYSZUKIWARKA === */
.search-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 14px 16px;
  background: #1a1a2e;
  border-radius: 10px;
  border: 1px solid #2a2a4a;
}

.search-bar input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ff4f9a;
  background: #0f0f1e;
  color: #fff;
  font-size: 14px;
}

.search-bar select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ff4f9a;
  background: #0f0f1e;
  color: #fff;
  font-size: 14px;
}

.search-bar button[type="submit"] {
  padding: 8px 18px;
  background: #ff4f9a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.search-bar button[type="submit"]:hover {
  background: #e0367f;
}

.search-clear {
  color: #aaa;
  font-size: 13px;
  text-decoration: none;
  padding: 4px 8px;
}

.search-clear:hover {
  color: #fff;
}

/* === INPOST SEKCJA (edit.php) === */
.inpost-box {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 20px;
  margin-top: 24px;
}

.inpost-box h3 {
  margin-top: 0;
  color: #ff4f9a;
}

.inpost-box label {
  color: #ccc;
  font-weight: normal;
}

.inpost-success {
  background: #0d2e1a;
  border: 1px solid #1db954;
  border-radius: 8px;
  padding: 10px 14px;
  color: #1db954;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-label {
  display: inline-block;
  padding: 5px 12px;
  background: #1db954;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.btn-label:hover {
  background: #17a348;
}

/* === MODAL MAGAZYNU === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.visible { display: flex; }

.modal-window {
  background: #fff;
  border-radius: 18px;
  padding: 28px 30px;
  max-width: 800px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(255, 79, 154, 0.3);
}

.modal-window h3 {
  margin: 0 0 16px 0;
  color: #ff4f9a;
  font-size: 20px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: #888;
  font-weight: 700;
  line-height: 1;
}
.modal-close:hover { color: #ff4f9a; }

.modal-search {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #ffd1e3;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 16px;
  outline: none;
}
.modal-search:focus {
  border-color: #ff4f9a;
  box-shadow: 0 0 0 3px rgba(255, 79, 154, 0.15);
}

.warehouse-list {
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid #ffe0eb;
  border-radius: 10px;
}

.warehouse-row {
  display: grid;
  grid-template-columns: 130px 1fr 80px 100px 110px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #fff0f6;
  gap: 10px;
  transition: background 0.15s;
}
.warehouse-row:last-child { border-bottom: none; }
.warehouse-row:hover { background: #fff7fa; }

.warehouse-row .sku   { font-weight: 700; color: #ff4f9a; font-size: 13px; }
.warehouse-row .name  { font-size: 14px; color: #333; }
.warehouse-row .stock { text-align: center; font-size: 13px; }
.warehouse-row .price { text-align: right; font-weight: 600; color: #555; }
.warehouse-row button {
  padding: 6px 12px;
  font-size: 13px;
  border: none;
  background: #ff4f9a;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}
.warehouse-row button:hover { background: #e0367f; }
.warehouse-row.out-of-stock { opacity: 0.4; }
.warehouse-row.out-of-stock button { background: #ccc; cursor: not-allowed; }

.warehouse-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
}

.stock-badge-low  { background: #ffa44f; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.stock-badge-ok   { background: #1db954; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.stock-badge-zero { background: #ff4f4f; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }

/* Mała etykietka SKU obok nazwy w polu zamówienia */
.sku-badge {
  display: inline-block;
  background: #ffe0eb;
  color: #ff4f9a;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}

.btn-warehouse {
  background: linear-gradient(135deg, #ff4f9a, #ff9de2) !important;
  color: #fff !important;
  margin-right: 8px;
}

/* === SKU STATUS BADGES (faktury) === */
.sku-status {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.sku-badge-existing {
  background: #d6f5e3;
  color: #1db954;
  border: 1px solid #1db954;
}
.sku-badge-new {
  background: #e6f0ff;
  color: #2563eb;
  border: 1px solid #2563eb;
}
.sku-badge-warning {
  background: #fff3e0;
  color: #b86400;
  border: 1px solid #ffa44f;
}

/* === SZEROKOŚCI PÓL FAKTURY === */
#invoice-positions { table-layout: fixed; width: 100%; }
#invoice-positions th:nth-child(1),
#invoice-positions td:nth-child(1) { width: 130px; }       /* SKU - wąski */
#invoice-positions th:nth-child(2),
#invoice-positions td:nth-child(2) { width: auto; min-width: 280px; }   /* Nazwa - szeroka */
#invoice-positions th:nth-child(3),
#invoice-positions td:nth-child(3) { width: 95px; }   
#invoice-positions th:nth-child(4),
#invoice-positions td:nth-child(4),
#invoice-positions th:nth-child(5),
#invoice-positions td:nth-child(5),
#invoice-positions th:nth-child(6),
#invoice-positions td:nth-child(6) { width: 100px; }       /* Ceny */
#invoice-positions th:nth-child(7),
#invoice-positions td:nth-child(7) { width: 90px; }        /* Wartość */
#invoice-positions th:nth-child(8),
#invoice-positions td:nth-child(8),
#invoice-positions th:nth-child(9),
#invoice-positions td:nth-child(9) { width: 50px; }        /* Etykieta + Usuń */

#invoice-positions input { width: 100%; }
#invoice-positions input.pos-brutto { width: 100% !important; }

#invoice-positions input[type="number"] { padding-right: 4px; }


