:root{
  --bg1:#050b14;
  --card: rgba(12, 18, 28, .92);
  --card2: rgba(15, 22, 34, .94);
  --border: rgba(255,255,255,.10);
  --text:#eaf0ff;
  --muted: rgba(234,240,255,.65);
  --accent:#ff6a2b;
  --shadow: 0 18px 60px rgba(0,0,0,.55);
  --radius: 22px;
}


/* Force the action buttons to sit left + right */
.field.full.actions{
  grid-column: 1 / -1;
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important; /* left + right */
  align-items: center !important;
  gap: 12px;
  margin-top: 6px;
}

/* Make buttons not stretch full width */
.field.full.actions .btn{
  width: auto !important;
  min-width: 140px;          /* optional: make them look balanced */
}

/* Optional: if something is still forcing 100% width */
.field.full.actions button{
  flex: 0 0 auto !important;
}



*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background: radial-gradient(1200px 800px at 30% 30%, #0e2444 0%, var(--bg1) 55%, #02050b 100%);
  overflow-x:hidden;
}

.bg{
  position:fixed; inset:0;
  background: linear-gradient(135deg, rgba(10,40,80,.35), rgba(0,0,0,0));
  pointer-events:none;
}

.wrap{
  min-height:100%;
  display:flex;
  justify-content:center;
  padding: 38px 16px;
}

.card{
  width: min(1120px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.card-head{
  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.accent{
  width: 82px;
  height: 5px;
  background: var(--accent);
  border-radius: 999px;
  margin-bottom: 14px;
}
.accent.small{ width: 56px; height: 4px; margin-bottom: 10px; }

.head-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
}

h1{ margin:0; font-size: 30px; letter-spacing: .2px; }
h2{ margin:0; font-size: 22px; }
.sub{ margin: 8px 0 0; color: var(--muted); }

.head-actions{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}

.toolbar{
  margin-top: 16px;
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:space-between;
  flex-wrap: wrap;
}

.search input{
  width: min(460px, 100%);
  background: rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline:none;
}
.search input:focus{ border-color: rgba(255,106,43,.55); }

.filters{ display:flex; gap: 10px; align-items:center; }
select{
  background: rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 10px;
  outline:none;
}

.card-body{ padding: 18px 22px 22px; }

.notice{
  min-height: 20px;
  margin-bottom: 12px;
  color: var(--muted);
}

.table-wrap{
  width:100%;
  overflow:auto;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
}

.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

thead th{
  position: sticky;
  top: 0;
  z-index: 2;
}

th, td{
  text-align:left;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  vertical-align: middle;
}

th{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(234,240,255,.7);
  background: rgba(10,14,22,.92);
  backdrop-filter: blur(6px);
}

tbody tr:hover{
  background: rgba(255,255,255,.03);
}

.thumb{
  width: 56px;
  height: 44px;
  border-radius: 10px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  object-fit: cover;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}

.dot{ width:8px; height:8px; border-radius:999px; background: rgba(255,255,255,.35); }
.dot.ok{ background: rgba(0,255,170,.65); }
.dot.no{ background: rgba(255,80,80,.75); }

.btn{
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
  cursor:pointer;
  transition: transform .08s ease, filter .12s ease;
}
.btn:hover{ filter: brightness(1.05); }
.btn:active{ transform: translateY(1px); }

.btn-ghost{
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
}

.btn-danger{ background: rgba(255, 70, 70, .92); }

.row-actions{ display:flex; gap: 8px; flex-wrap: wrap; }

.empty{
  margin-top: 12px;
  color: var(--muted);
  text-align:center;
}

/* ===== Modal (smooth + scrollable) ===== */

/* ===== MODAL FIXES ===== */
.modal-overlay{
  z-index: 9998;
}

.modal{
  z-index: 9999;
}

body.modal-open{
  overflow: hidden; /* stops background scrolling */
}

/* Make sure hidden truly hides */
[hidden]{
  display: none !important;
}
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.60);
  backdrop-filter: blur(2px);
  
  transition: opacity .15s ease;
}

.modal{
  position: fixed;
  inset: 0;
  display:grid;
 background-color: #02050b;
  place-items:center;
  padding: 18px;
  transform: translateY(6px);
  transition: transform .15s ease;
}

.modal-card{
  width: min(860px, 100%);
  max-height: calc(100vh - 40px);
  overflow:auto;
  background: var(--card2);
  border:1px solid rgba(255,255,255,.10);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.modal-head{
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}

.icon-btn{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  font-size: 22px;
}

.form{ padding: 16px 18px 18px; }

.grid{
  display:grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field{ display:flex; flex-direction:column; gap: 8px; }
.field.full{ grid-column: 1 / -1; }

label{ font-weight: 800; font-size: 13px; color: rgba(234,240,255,.92); }

input, textarea{
  background: rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline:none;
}
input:focus, textarea:focus{ border-color: rgba(255,106,43,.55); }

.check{ display:flex; align-items:center; gap: 10px; margin-top: 10px; color: rgba(234,240,255,.85); }
.check input{ width: 18px; height: 18px; }

.image-row{ display:flex; gap: 12px; align-items:flex-start; flex-wrap: wrap; }

.image-preview{
  width: 170px;
  height: 128px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  display:grid;
  place-items:center;
  overflow:hidden;
}
.image-preview img{ width:100%; height:100%; object-fit:cover; }

.image-actions{
  flex: 1;
  min-width: 260px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.hint{ color: var(--muted); font-size: 12px; }

.actions{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  padding-top: 6px;
}

code{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  padding: 2px 6px;
  border-radius: 8px;
}

/* Responsive */
@media (max-width: 780px){
  .head-row{ flex-direction: column; }
  .grid{ grid-template-columns: 1fr; }
  .table{ min-width: 900px; }
}


/* SMALL SCREENS ONLY — TABLE: show ONLY Name + Actions */
/* MOBILE: show Image + Name + Actions as stacked cards */
@media (max-width: 780px){

  /* hide header */
  #itemsTable thead{ display:none !important; }

  /* block layout */
  #itemsTable,
  #itemsTable tbody,
  #itemsTable tr,
  #itemsTable td{
    display:block !important;
    width:100% !important;
  }

  /* row card */
  #itemsTable tbody tr{
    padding: 12px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: rgba(255,255,255,.02);
    margin-bottom: 12px;
  }

  /* hide all cells then show only Image(1) + Name(2) + Actions(5) */
  #itemsTable tbody td{ display:none !important; }
  #itemsTable tbody td:nth-child(1),
  #itemsTable tbody td:nth-child(2),
    #itemsTable tbody td:nth-child(3),
  #itemsTable tbody td:nth-child(5){
    display:block !important;
  }

  /* image cell */
  #itemsTable tbody td:nth-child(1){
    padding: 0 0 10px 0 !important;
  }
  #itemsTable tbody td:nth-child(1) .thumb{
    width: 100% !important;
    height: 160px !important;
    border-radius: 14px;
  }

  /* name cell */
  #itemsTable tbody td:nth-child(2){
    padding: 0 0 10px 0 !important;
  }

  /* actions */
  #itemsTable tbody td:nth-child(5){
    padding: 0 !important;
  }

  .row-actions{
    display:flex !important;
    gap: 10px;
    justify-content: flex-start; /* or flex-end */
    align-items:center;
    flex-wrap: wrap;
  }

  .row-actions .btn{
    width:auto !important;
    min-width:0 !important;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 10px;
    white-space: nowrap;
  }
}


/* Small screens: make product image smaller */
@media (max-width: 780px){
  #itemsTable tbody td:nth-child(1) .thumb{
    width: 88px !important;
    height: 66px !important;
    border-radius: 12px !important;
    object-fit: cover !important;
    display: block;
  }

  /* optional: keep a little spacing below the image */
  #itemsTable tbody td:nth-child(1){
    padding-bottom: 8px !important;
  }
}