/* NEOLI UI (no dependencies) */
/* Dark theme inspired layout: left sidebar + content + table + pills */

:root{
  --bg: #0b1220;
  --panel: #0f1a2e;
  --panel-2: #111f38;
  --border: rgba(255,255,255,0.08);

  --text: rgba(255,255,255,0.92);
  --text-2: rgba(255,255,255,0.70);
  --muted: rgba(255,255,255,0.55);

  --accent: #2f55d4;
  --accent-2: #1d3fb8;
  --brown: #8b6b3d;
  --danger: #d43a3a;
  --ok: #22c55e;
  --gray: #9aa4b2;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);

  --sidebar-w: 270px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 30% 0%, rgba(47,85,212,0.15), transparent 60%),
              radial-gradient(1000px 600px at 90% 20%, rgba(139,107,61,0.10), transparent 60%),
              var(--bg);
  color: var(--text);
}

/* Links + buttons */
a{ color:inherit; text-decoration:none; }
.btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor:pointer;
  user-select:none;
}
.btn:hover{ background: rgba(255,255,255,0.09); }
.btn-primary{
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 18px rgba(47,85,212,0.25);
}
.btn-primary:hover{ filter: brightness(1.05); }
.btn-danger{
  background: rgba(212,58,58,0.12);
  border-color: rgba(212,58,58,0.35);
}
.btn-danger:hover{ background: rgba(212,58,58,0.18); }

/* App layout */
.app{
  min-height:100vh;
  display:flex;
}

.sidebar{
  width: var(--sidebar-w);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  position: sticky;
  top:0;
  height:100vh;
}

.brand{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding: 10px 12px 18px 12px;
}
.brand .logo{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(139,107,61,0.35), rgba(47,85,212,0.25));
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow);
}
.brand-text{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.brand-title{ font-size:18px; letter-spacing:0.2px; font-weight:700; }
.brand-sub{ color: var(--text-2); font-size:12px; }

/* MENU: kafelki (.menu-item) */
.menu{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding: 6px 8px;
}

.menu-item{
  display:block;
  padding:14px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.10);
  background:rgba(255,255,255,0.04);
  color:rgba(255,255,255,0.82);
  text-decoration:none;
  font-weight:600;
}
.menu-item:hover{
  background:rgba(255,255,255,0.08);
  color:rgba(255,255,255,0.95);
}
.menu-item.active{
  background:rgba(47,85,212,0.18);
  border-color:rgba(47,85,212,0.35);
  color:rgba(255,255,255,0.95);
}

.sidebar-footer{
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 2px;
}
.sidebar-footer .links{
  color: var(--muted);
}

/* MAIN */
.main{
  flex:1;
  padding: 22px;
}

.topbar{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:16px;
  margin-bottom: 14px;
}

/* Nagłówki */
.h1{
  font-size: 30px;
  margin: 0;
  letter-spacing: 0.2px;
}
.subtitle{
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

/* Cards */
.card{
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Panel header (tytuł + akcje po prawej) */
.panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:16px;
}
.panel-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}

/* Search + filters row */
.toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.search{
  flex: 1;
  min-width: 220px;
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}
.search input{
  width:100%;
  border:none;
  outline:none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}
.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.chip{
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-2);
  font-size: 13px;
  cursor:pointer;
  user-select:none;
}
.chip:hover{ background: rgba(255,255,255,0.06); }
.chip.active{
  background: rgba(47,85,212,0.18);
  border-color: rgba(47,85,212,0.35);
  color: var(--text);
}

/* Table */
.table-wrap{
  overflow:auto;
  border-radius: var(--radius);
}
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 920px;
}
.table thead th{
  text-align:left;
  font-weight:700;
  font-size:12px;
  padding:14px 16px;
  color: rgba(255,255,255,0.75);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  background: rgba(11,18,32,0.95);
  backdrop-filter: blur(8px);
  z-index: 1;
}
.table tbody td{
  padding:14px 16px;
  vertical-align:middle;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size:14px;
}
.table tbody tr:hover td{
  background: rgba(255,255,255,0.03);
}

/* Status pills */
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  display:inline-block;
}
.badge-ok{
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.28);
  color: rgba(220,255,235,0.92);
}
.badge-ok::before{ background: var(--ok); }

.badge-danger{
  background: rgba(212,58,58,0.12);
  border-color: rgba(212,58,58,0.28);
  color: rgba(255,225,225,0.92);
}
.badge-danger::before{ background: var(--danger); }

.badge-gray{
  background: rgba(154,164,178,0.12);
  border-color: rgba(154,164,178,0.25);
  color: rgba(240,245,255,0.85);
}
.badge-gray::before{ background: var(--gray); }

.badge-blue{
  background: rgba(47,85,212,0.14);
  border-color: rgba(47,85,212,0.30);
  color: rgba(225,235,255,0.92);
}
.badge-blue::before{ background: var(--accent); }

/* Thumbs + modal */
.thumb{
  width:44px;
  height:44px;
  border-radius:10px;
  object-fit:cover;
  display:block;
}
.thumb.placeholder{
  width:44px;
  height:44px;
  border-radius:10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
}
.thumb-btn{
  padding:0;
  border:0;
  background:transparent;
  cursor:pointer;
  border-radius:12px;
}

.img-modal{
  position:fixed;
  inset:0;
  z-index:9999;
}
.img-modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.75);
}
.img-modal-body{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}
.img-modal-body img{
  max-width: min(1100px, 96vw);
  max-height: 92vh;
  border-radius:16px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  background: rgba(255,255,255,0.03);
}
.no-scroll{ overflow:hidden; }

/* Row actions */
.row-actions{
  display:inline-flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
}
.icon-btn{
  width:36px;
  height:36px;
  border-radius:10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: rgba(255,255,255,0.90);
  text-decoration:none;
  cursor:pointer;
}
.icon-btn:hover{ background: rgba(255,255,255,0.08); }
.icon-btn.danger{
  border-color: rgba(212,58,58,0.35);
  background: rgba(212,58,58,0.10);
}
.icon-btn.danger:hover{
  background: rgba(220,60,60,0.18);
  border-color: rgba(220,60,60,0.35);
}

/* ===== Mobile menu (hamburger + overlay + slide-in) ===== */

/* hamburger w kwadracie – domyślnie ukryty */
/* ===== Mobile menu (hamburger + overlay + slide-in) ===== */

/* hamburger w kwadracie – domyślnie ukryty (desktop) */
.menu-toggle{
  display:none;
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.06);
  color:rgba(255,255,255,0.92);
  cursor:pointer;
  margin-right:10px;
}
.menu-toggle:hover{
  background:rgba(255,255,255,0.10);
}

/* overlay */
.menu-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.55);
  z-index:9998;
}
body.menu-open .menu-overlay{
  display:block;
}

/* ogólna responsywność */
@media (max-width: 720px){
  .main{ padding: 14px; }
  .h1{ font-size: 24px; }
  .table{ min-width: 780px; }
}

/* MOBILE: menu wysuwane + czytelne tło + hamburger po lewej */
@media (max-width: 900px){
  /* topbar: hamburger lewo, wyloguj prawo */
  .topbar{
    justify-content:space-between;
  }

  /* hamburger większy i zawsze klikalny */
  .menu-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:55px;
    height:55px;
    border-radius:14px;
    font-size:20px;
    margin-right:0;
    position: relative;
    z-index: 10001;
  }

  /* po otwarciu: hamburger przyklejony u góry */
  body.menu-open .menu-toggle{
    position: fixed;
    top: 10px;
    left: 10px;
  }

  /* sidebar jako panel */
  .sidebar{
    background: rgba(11,18,32,0.96); /* mocne tło (czytelne kafelki) */
    backdrop-filter: blur(10px);
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    transform:translateX(-110%);
    transition:transform .18s ease;
    z-index:9999;
    width:290px;
  }

  body.menu-open .sidebar{
    transform:translateX(0);
  }

  /* NAJWAŻNIEJSZE: na mobile zawsze pokazuj nazwy menu */
  .menu-item{
    font-size:14px !important;
  }
  .menu-item::before{
    content:none !important;
  }
}

/* odstęp między komunikatem a formularzem logowania */
.login-message,
.flash-message,
.alert,
.notice {
  margin-bottom: 24px;
}

/* ====== RESPONSIVE: tabela jako kafelki (produkty) ====== */
@media (max-width: 1400px){

  /* tabela przestaje być tabelą */
  .table-wrap{ overflow: visible; }
  .table{ min-width: 0 !important; }

  .table thead{ display:none; }

  .table,
  .table tbody,
  .table tr,
  .table td{
    display:block;
    width:100%;
  }

  /* każdy produkt = kafel */
  .table tbody tr{
    margin: 0 0 14px 0;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    box-shadow: 0 10px 30px rgba(0,0,0,0.22);
  }

  .table tbody td{
    padding: 0;
    border: 0;
    background: transparent;
  }

  /* 1) numer (#) – mały badge */
  .table tbody td:nth-child(1){
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    margin-bottom: 10px;
  }

  /* 2) zdjęcie – duże, na środku */
  .table tbody td:nth-child(2){
    display:flex;
    justify-content:center;
    margin: 6px 0 12px 0;
  }

  .thumb-btn{
    width: min(340px, 96%) !important;
    height: min(340px, 70vw) !important;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
  }

  .thumb-img{
    width: 100% !important;
    height: 100% !important;
    border-radius: 20px;
    object-fit: cover;
  }

  .thumb-empty{
    width: min(340px, 96%) !important;
    height: min(340px, 70vw) !important;
    border-radius: 20px;
  }


  /* 3) nazwa – pełna, bez cięcia */
  .table tbody td:nth-child(3){
    margin-top: 6px;
    margin-bottom: 10px;
  }

  .table tbody td:nth-child(3) .title{
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    font-size: 14px;
    font-weight: 700;
  }

  /* 4/5/6 – ceny jako wiersze informacji */
  .table tbody td:nth-child(4),
  .table tbody td:nth-child(5),
  .table tbody td:nth-child(6){
    margin-top: 8px;
    color: rgba(255,255,255,0.86);
    font-weight: 600;
  }

  .table tbody td:nth-child(4)::before{
    content:"Cena netto: ";
    color: rgba(255,255,255,0.65);
    font-weight: 600;
  }
  .table tbody td:nth-child(5)::before{
    content:"VAT: ";
    color: rgba(255,255,255,0.65);
    font-weight: 600;
  }
  .table tbody td:nth-child(6)::before{
    content:"Cena brutto: ";
    color: rgba(255,255,255,0.65);
    font-weight: 600;
  }

  /* 7) akcje – na dole */
  .table tbody td:nth-child(7){
    margin-top: 12px;
    text-align:left !important;
  }

  .table tbody td:nth-child(7) .icon-btn{
    margin-left: 0;
    margin-right: 10px;
    min-width: 44px;
    height: 40px;
    border-radius: 12px;
  }

  /* nagłówek panelu: przycisk dodawania pod tytułem */
  .panel-header{
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .panel-actions{
    width:100%;
    justify-content:flex-start;
  }

  .panel-actions .btn{
    width:100%;
    justify-content:center;
  }


/* ===== FIX: nagłówek Zamówienia – tytuł + opis admina ===== */

.page-header,
.panel-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header .subtitle,
.panel-header .subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

/* mobile: opis pod tytułem, nie nachodzi */
@media (max-width: 720px) {
  .page-header,
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header .subtitle,
  .panel-header .subtitle {
    white-space: normal;
  }
}


