/* =====================================================
   Naleng AutoPOS — Returns Module
   Mobile-first | Premium | SME Friendly
===================================================== */
:root{

  /* ===============================
     BASE LAYOUT COLORS
  ================================ */

  --bg:#f6f8fc;
  --panel:rgba(255,255,255,.92);
  --panel2:rgba(255,255,255,.75);

  --deep:#062a57;      /* Primary dark blue */
  --deep2:#0b3d7a;     /* Secondary blue */

  --orange:#ff7a18;    /* PRIMARY UI Accent */
  --orange2:#ff9a3c;   /* Hover / soft accent */

  --text:#0b1b33;
  --muted:#5a6b7d;
  --line:rgba(12, 28, 55, .12);

  --shadow:0 18px 45px rgba(2, 10, 28, .10);
  --shadow2:0 10px 28px rgba(2, 10, 28, .08);

  --radius:18px;
  --radius2:22px;

  --topH:68px;
  --sidebarW:300px;

  --focus:rgba(255, 122, 24, .25);


  /* ===============================
     RETURNS MODULE MAPPING
     (Mapped to NEW ORANGE SYSTEM)
  ================================ */

  --r-accent:var(--orange);
  --r-soft:rgba(255,122,24,.08);
  --r-border:var(--line);

  --r-success:#16a34a;
  --r-danger:#e5484d;
  --r-warning:#ffb020;

  --r-ink:var(--text);
  --r-muted:var(--muted);

  --r-card:var(--panel);

}


/* Optional page transition target */
.page{
  animation: pageFade .35s ease;
}
@keyframes pageFade{
  from{ opacity:0; transform: translateY(10px); }
  to{ opacity:1; transform: translateY(0); }
}

/* ================= HERO ================= */

.module-hero{
  display:flex;
  flex-direction:column;
  gap:1rem;
  margin-bottom: 1.2rem;
}

.module-kicker{
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  font-size:.75rem;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  color: var(--r-accent);
}

.k-dot{
  width:10px;height:10px;border-radius:50%;
  background: var(--r-accent);
  box-shadow: 0 0 0 6px rgba(15,98,254,.12);
}

.module-hero h1{
  margin:.2rem 0 .35rem;
  font-size:1.8rem;
  color: var(--r-ink);
}

.module-hero p{
  margin:0;
  color: var(--r-muted);
  line-height:1.6;
  max-width: 62ch;
}

.hero-rule{
  width:90px;height:4px;border-radius:999px;
  background: var(--r-accent);
  margin-top: .9rem;
  opacity:.9;
}

.module-hero-right{
  display:flex;
}

/* Role card */
.role-card{
  width:100%;
  background: linear-gradient(135deg, rgba(15,98,254,.12), rgba(15,98,254,.05));
  border:1px solid rgba(15,98,254,.18);
  border-radius: 18px;
  padding: 1rem;
}

.role-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:.8rem;
  margin-bottom:.75rem;
}

.role-title{
  font-weight:700;
  color: var(--r-ink);
  display:flex;
  align-items:center;
  gap:.55rem;
}

.role-badge{
  padding:.35rem .65rem;
  border-radius:999px;
  font-size:.75rem;
  font-weight:800;
  background: rgba(15,98,254,.12);
  color: var(--r-accent);
  border:1px solid rgba(15,98,254,.2);
}

.role-actions{
  display:flex;
  flex-direction:column;
  gap:.45rem;
}

/* ================= KPI GRID ================= */

.returns-cards{
  margin-top: .8rem;
  margin-bottom: 1rem;
}

/* ================= ACTION BAR ================= */

.actionbar{
  display:flex;
  flex-direction:column;
  gap:.75rem;
  margin: 1.25rem 0 1rem;
}

.action-left{
  display:flex;
  flex-direction:column;
  gap:.75rem;
}

.searchbox{
  display:flex;
  align-items:center;
  gap:.6rem;
  background: var(--r-card);
  border:1px solid var(--r-border);
  padding: .7rem .85rem;
  border-radius: 14px;
}

.searchbox i{ color: var(--r-muted); }

.searchbox input{
  border:none;
  outline:none;
  width:100%;
  font-size:.92rem;
  background: transparent;
}

.filters{
  display:flex;
  gap:.6rem;
}

.filters select{
  width:100%;
  padding:.75rem .85rem;
  border-radius: 14px;
  border:1px solid var(--r-border);
  background: var(--r-card);
  font-size:.92rem;
  outline:none;
}

.action-right .btn{
  width:100%;
  justify-content:center;
}

/* ================= TABLE ================= */

.table-shell{
  margin-top: .25rem;
}

.table-wrapper{
  width:100%;
  overflow:hidden;
  border-radius: 18px;
  border:1px solid var(--r-border);
  background: var(--r-card);
}

.data-table{
  width:100%;
  border-collapse: collapse;
}

.data-table thead{
  background:#f8fafc;
}

.data-table th{
  text-align:left;
  padding: .95rem 1rem;
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  color: var(--r-muted);
  border-bottom:1px solid var(--r-border);
}

.data-table td{
  padding: .95rem 1rem;
  border-bottom:1px solid #f1f5f9;
  font-size:.92rem;
  color: var(--r-ink);
  vertical-align: top;
}

.data-table tbody tr:hover{
  background:#f9fafb;
}

.table-empty{
  text-align:center;
  margin-top: 1.25rem;
  padding: 1.2rem;
  color: var(--r-muted);
  opacity:.9;
}

/* Status badges */
.badge{
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  padding:.35rem .7rem;
  border-radius:999px;
  font-size:.75rem;
  font-weight:800;
  border:1px solid transparent;
}

.badge.pending{ background: rgba(255,176,32,.15); color:#7a4b00; border-color: rgba(255,176,32,.25); }
.badge.approved{ background: rgba(22,163,74,.15); color:#0f6a2e; border-color: rgba(22,163,74,.25); }
.badge.rejected{ background: rgba(229,72,77,.15); color:#8a1b1f; border-color: rgba(229,72,77,.25); }

/* Actions */
.table-actions{
  display:flex;
  gap:.4rem;
}

.table-btn{
  border:none;
  background:#f1f5f9;
  padding:.5rem .65rem;
  border-radius:10px;
  cursor:pointer;
  transition:.18s ease;
}

.table-btn:hover{
  transform: translateY(-1px);
  background:#e2e8f0;
}

.table-btn.view{ color:#334155; }
.table-btn.delete{ color: var(--r-danger); }

/* ================= PAGINATION ================= */

.pagination{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:1rem;
  margin-top: 1.2rem;
}

.page-btn{
  padding:.55rem .9rem;
  border-radius: 12px;
  border:1px solid var(--r-border);
  background: var(--r-card);
  cursor:pointer;
  transition:.18s ease;
}

.page-btn:hover{ background: var(--r-soft); }
.page-btn:disabled{ opacity:.5; cursor:not-allowed; }

.page-info{
  color: var(--r-muted);
  font-weight:700;
  font-size:.9rem;
}

/* ================= MODALS ================= */

.modal{
  position:fixed;
  inset:0;
  display:none;
  justify-content:center;
  align-items:center;
  padding: 18px;
  background: rgba(15,23,42,.52);
  backdrop-filter: blur(6px);
  z-index: 2000;
}

.modal[aria-hidden="false"]{ display:flex; }

.modal-card{
  width:100%;
  max-width: 520px;
  max-height: calc(100vh - 36px);
  overflow:auto;
  background: var(--r-card);
  border-radius: 20px;
  box-shadow: 0 28px 70px rgba(0,0,0,.25);
  animation: modalIn .22s ease;
}

.modal-wide{ max-width: 760px; }
.modal-small{ max-width: 420px; }

@keyframes modalIn{
  from{ opacity:0; transform: translateY(10px) scale(.98); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}

.modal-head{
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--r-border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.8rem;
  position: sticky;
  top:0;
  background: var(--r-card);
  z-index:1;
}

.modal-title{
  font-weight:800;
  color: var(--r-ink);
  display:flex;
  align-items:center;
  gap:.6rem;
}

.modal-title.danger{ color: var(--r-danger); }

.modal-body{
  padding: 1rem 1.15rem;
  display:flex;
  flex-direction:column;
  gap: .9rem;
}

.modal-foot{
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--r-border);
  display:flex;
  justify-content:flex-end;
  gap:.6rem;
  position: sticky;
  bottom:0;
  background: var(--r-card);
}

/* Form */
.form-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: .85rem;
}

.form-group{
  display:flex;
  flex-direction:column;
  gap:.35rem;
}

.form-group label{
  font-size:.8rem;
  font-weight:800;
  color: var(--r-muted);
}

.form-group input,
.form-group select,
textarea{
  padding: .75rem .85rem;
  border-radius: 14px;
  border:1px solid var(--r-border);
  outline:none;
  font-size:.92rem;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
textarea:focus{
  border-color: var(--r-accent);
  box-shadow: 0 0 0 3px rgba(15,98,254,.12);
}

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

/* Items */
.items-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:1rem;
  margin-top:.25rem;
}

.items-title{
  font-weight:900;
  color: var(--r-ink);
}

.items-list{
  display:flex;
  flex-direction:column;
  gap:.65rem;
}

.item-row{
  display:grid;
  grid-template-columns: 1.2fr .6fr .8fr auto;
  gap:.55rem;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  padding: .75rem;
}

.item-row input{
  width:100%;
  border:1px solid #e6ebf3;
  border-radius: 12px;
  padding:.65rem .75rem;
  background:#fff;
}

.item-row .remove-btn{
  border:none;
  background: rgba(229,72,77,.12);
  color: var(--r-danger);
  border-radius: 12px;
  padding: .6rem .75rem;
  cursor:pointer;
  transition:.18s ease;
}

.item-row .remove-btn:hover{
  transform: translateY(-1px);
  background: rgba(229,72,77,.18);
}

/* Summary */
.summary{
  background: linear-gradient(135deg, rgba(15,98,254,.06), rgba(15,98,254,.02));
  border:1px solid rgba(15,98,254,.15);
  border-radius: 18px;
  padding: .9rem;
}

.summary-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:.8rem;
  margin-bottom:.55rem;
  color: var(--r-ink);
}

.summary-row b{ color: var(--r-accent); }

.error-box{
  padding:.85rem;
  border-radius: 14px;
  border:1px solid rgba(229,72,77,.25);
  background: rgba(229,72,77,.08);
  color: #8a1b1f;
  font-weight:700;
}

/* View */
.view-grid{
  display:grid;
  gap:.65rem;
}

.view-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  background:#f8fafc;
  border:1px solid #eef2f7;
  padding:.75rem .9rem;
  border-radius: 16px;
}

.view-label{
  font-size:.78rem;
  font-weight:900;
  color: var(--r-muted);
}
.view-value{
  font-weight:800;
  color: var(--r-ink);
}

.view-subtitle{
  margin-top:.25rem;
  font-weight:900;
  color: var(--r-ink);
}

.mini-table{
  border:1px solid var(--r-border);
  border-radius: 16px;
  overflow:hidden;
}

.mini-row{
  display:flex;
  justify-content:space-between;
  padding:.75rem .9rem;
  border-bottom:1px solid #f1f5f9;
  background:#fff;
}
.mini-row:last-child{ border-bottom:none; }
.mini-row b{ color: var(--r-ink); }
.mini-row span{ color: var(--r-muted); font-weight:700; }

.note-box{
  padding:.85rem .9rem;
  border:1px solid var(--r-border);
  border-radius: 16px;
  background:#fff;
  color: var(--r-ink);
}

/* Delete */
.delete-message{
  color: var(--r-ink);
  margin:0;
}
.delete-highlight{
  margin:.6rem 0 0;
  font-weight:900;
  color: var(--r-danger);
}

/* Toast */
.toast-container{
  position:fixed;
  top: 1rem;
  right: 1rem;
  z-index: 4000;
  display:flex;
  flex-direction:column;
  gap: .7rem;
}

.toast{
  background:#fff;
  border-left: 6px solid var(--r-success);
  border-radius: 18px;
  box-shadow: 0 20px 55px rgba(0,0,0,.16);
  padding: .9rem 1rem;
  display:flex;
  gap:.65rem;
  align-items:flex-start;
  animation: toastIn .28s ease;
  min-width: 260px;
}

.toast.error{ border-left-color: var(--r-danger); }
.toast.warning{ border-left-color: var(--r-warning); }

@keyframes toastIn{
  from{ opacity:0; transform: translateY(-10px); }
  to{ opacity:1; transform: translateY(0); }
}

.toast i{
  margin-top: .15rem;
  color: var(--r-success);
}
.toast.error i{ color: var(--r-danger); }
.toast.warning i{ color: var(--r-warning); }

.toast .t-title{
  font-weight:900;
  color: var(--r-ink);
  margin:0 0 .1rem;
}
.toast .t-msg{
  color: var(--r-muted);
  margin:0;
}

/* Buttons (align with your system if main.css already defines) */
.btn{
  background:var(--orange);
  color:#fff;
  border:none;
  border-radius:var(--radius);
  box-shadow:var(--shadow2);
  transition:.2s ease;
}

.btn:hover{
  background:var(--orange2);
  transform:translateY(-2px);
}


.btn.ghost{
  background:#f1f5f9;
  color:#334155;
}

.btn.danger{
  background: var(--r-danger);
}

.icon-btn{
  border:none;
  background:transparent;
  cursor:pointer;
  font-size: 1rem;
  color: #334155;
}

/* Mobile table -> cards */
@media (max-width: 820px){
  .filters{ flex-direction:column; }
  .action-right .btn{ width:100%; }
}

@media (min-width: 920px){
  .module-hero{
    flex-direction:row;
    justify-content:space-between;
    align-items:flex-start;
    gap:1.25rem;
  }
  .module-hero-right{ width: 360px; }
  .actionbar{
    flex-direction:row;
    justify-content:space-between;
    align-items:flex-end;
  }
  .action-left{
    width: calc(100% - 220px);
    flex-direction:row;
    align-items:center;
    gap: .8rem;
  }
  .searchbox{ flex: 1.6; }
  .filters{ flex: 1; }
  .filters select{ width: 100%; }
  .action-right{ width: 200px; }
}

@media (max-width: 768px){
  .data-table thead{ display:none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td{
    display:block; width:100%;
  }
  .data-table tr{
    border-bottom:none;
    border-top:1px solid #f1f5f9;
    padding: .85rem .9rem;
  }
  .data-table td{
    border-bottom:none;
    padding: .5rem 0;
  }
  .data-table td::before{
    content: attr(data-label);
    display:block;
    font-size:.72rem;
    font-weight:900;
    color: var(--r-muted);
    margin-bottom:.15rem;
    text-transform:uppercase;
    letter-spacing:.08em;
  }
  .table-actions{
    justify-content:flex-start;
    margin-top:.25rem;
  }
  .item-row{
    grid-template-columns: 1fr 1fr;
  }
  .item-row .remove-btn{
    grid-column: 1 / -1;
  }
  .view-row{
    flex-direction:column;
    align-items:flex-start;
  }
}
