/* =========================================================
   KSN Pick Portal – Base Layout & Global
   ========================================================= */
body {
    background: #f3f4f6;
}

.site-header {
    padding-block-end: 0;
}

.ksn-pick-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding-right: 10px;
    background-color: #e5e7eb;
}

.ksn-pick-sidebar {
    width: 230px;
    padding-top: 8px;
}

.ksn-pick-content {
    flex: 1;
    min-width: 0;
    background: #f9fafb;
    padding: 0 16px;
}

.ksn-pick {
    background: #f9fafb;
    padding: 16px;
    font-family: inherit;
}

/* =========================================================
   Menu (Sidebar)
   ========================================================= */
.ksn-pick-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ksn-pick-menu li {
    margin-bottom: 6px;
}

.ksn-pick-menu a {
    display: block;
    padding: 6px 10px;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    border-radius: 6px;
}

.ksn-pick-menu li.active > a,
.ksn-pick-submenu li.active > a {
    background: #a81010;
    color: #fff;
}

/* =========================================================
   Tables & Reports
   ========================================================= */
/*فرمت کلی جدول*/
.ksn-pick-content table {
    width: 100%;
    border-collapse: collapse;
    text-align-last: center;
    background: #fff;
}
/*سلول ها*/
.ksn-pick-content table th,
.ksn-pick-content table td {
    border: 1px solid #e5e7eb;
    padding: 8px;
}

/*هدر جدول*/
.ksn-pick-content table th,
.ksn-pick-content table th {
    background: #e5e7eb;
    font-weight: 600;
}

/*سطرهای جدول*/
.ksn-pick-content table tr:nth-child(even) {
    background: #f9fafb;
}

.ksn-table tr.clickable {
    cursor: pointer;
}

.ksn-table tr.over {
    background: #fee2e2;
}

.ksn-table tr.done {
    background: #dcfce7;
}

.ksn-table tr.flash {
    box-shadow: inset 0 0 0 3px #22c55e;
    animation: ksnFlash 0.6s ease-out;
}

@keyframes ksnFlash {
    from {
        box-shadow: inset 0 0 0 3px #22c55e;
    }
    to {
        box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0);
    }
}

td.title {
    text-align-last: right;
}

td.barcode,
td.shelf {
    font-size: 15px;
    font-family: none !important;
}

input#ksn-pack-search {
    width: 320px;
}

/* =========================================================
   Toolbar & Filters
   ========================================================= */
.ksn-toolbar {
    margin-bottom: 12px;
}

.ksn-toolbar input {
    min-width: 260px;
    padding: 6px;
}

.ksn-toolbar button {
    margin-inline-start: 8px;
}

.ksn-ship-filters {
    margin: 10px 0 30px;
    font-size: 13px;
    text-align: right;
}

.ksn-pack-filters {
    margin-bottom: 20px;
}

/* =========================================================
   Shipping Book (دفتر ارسال)
   ========================================================= */

.ksn-pick-content .nav-tab-wrapper {
  display: flex;
  gap: 6px;
  margin: 12px 0 18px;
  padding: 0;
  border-bottom: 2px solid #e5e7eb;
}

.ksn-pick-content .nav-tab {
  display: inline-block;
  padding: 8px 14px;
  text-decoration: none;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
}

.ksn-pick-content .nav-tab:hover {
  background: #e5e7eb;
}

.ksn-pick-content .nav-tab.nav-tab-active {
  background: #ffffff;
  color: #111827;
  font-weight: 700;
  border-bottom: 2px solid #ffffff;
}

/* ردیف انتخاب‌شده در دفتر ارسال */
tr.ksn-row-selected {
    background-color: #dcfce7 !important;
}



/* =========================================================
   Scan & Mask
   ========================================================= */
.ksn-scan-wrap {
    display: flex;
    gap: 8px;
    max-width: 460px;
    position: relative;
}

.ksn-scan-wrap input {
    padding: 8px;
    flex: 1;
}

#ksn-scan-msg {
    white-space: nowrap;
    color: #ff0000;
    font-weight: 600;
    font-size: 18px;
}

#ksn-mask {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    background: transparent;
    transition: background 0.2s;
}

#ksn-mask.ok {
    background: rgba(0, 255, 100, 0.49);
}

#ksn-mask.error {
    background: rgba(255, 0, 0, 0.84);
}

.ksn-toast, #ksn-toast {
    position: fixed !important;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999 !important;
    color: #fff !important;
    background: rgba(0, 0, 0, 0.65);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    max-width: min(720px, calc(100vw - 24px));
    pointer-events: none;
}

/* =========================================================
   Header & Meta
   ========================================================= */
.ksn-header {
    margin-bottom: 16px;
}

.ksn-back {
    margin-bottom: 8px;
}

.ksn-meta {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}

.ksn-meta li {
    display: inline-block;
    margin-inline-end: 16px;
}

/* =========================================================
   Packing Popup
   ========================================================= */
.ksn-pack-popup-overlay{
    position:fixed;inset:0;
    background:rgba(0,0,0,.4);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:9999;
}
.ksn-pack-popup{
    background:#fff;
    width:960px;
    padding:16px;
    border-radius:6px;
    max-height: 85vh;
    overflow-y: auto;
}
.ksn-pack-popup h3 {
    padding-top: 0em;
    padding-bottom: 0.5em;
}
.ksn-pack-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
/* ✅ دو ستونه (2 ستون آیتم‌ها) */
.ksn-pack-grid{
    display:grid;
    grid-template-columns: 1fr 1fr;
    column-gap:28px;
    row-gap:12px;
    margin:12px 0 16px;
}

/* هر آیتم */
.ksn-pack-row{
    display:flex;
    align-items:center;
    justify-content:flex-start;
    gap:10px;
}

/* لیبل سمت راست */
.ksn-pack-row > span{
    min-width:120px;
    text-align:right;
}

/* کانتر */
.ksn-pack-counter{
    display:flex;
    align-items:center;
    gap:0;
}

.ksn-pack-counter input{
    width:36px !important;
    height:36px;
    text-align:center;
    padding:0!important;
    border:1px solid #cbd5e1;
    border-radius:4px;
    background:#fff;
}

.ksn-pack-counter button{
    width:28px;
    height:36px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid #cbd5e1;
    border-radius:4px;
    background:#fff;
    line-height:1;
    padding:0;
}

/* ترتیب RTL: + سمت راست، - سمت چپ */
.ksn-pack-counter button[data-act="inc"]{ order:1; }
.ksn-pack-counter input{ order:2; }
.ksn-pack-counter button[data-act="dec"]{ order:3; }

/* =========================================================
   Buttons
   ========================================================= */
button {
    border-color: #a81010 !important;
    color: #a81010 !important;
}

button#ksn-pack-confirm {
    background: #a81010;
    color: #fff !important;
}

/* =========================================================
   KSN Pick Portal – Print Label (120mm x 90mm)
   ========================================================= */

@media print {

    @page {
        size: 120mm 90mm;
        margin: 0;
    }

    body {
        margin: 0;
        padding: 4mm;
        direction: rtl;
        font-family: "IRANSans", Tahoma, Arial, sans-serif;
        font-size: 12px;
    }

    .top {
        font-size: 10px;
        display: flex;
        justify-content: space-between;
        margin-bottom: 3px;
    }

    .box {
        border: 1px dashed #000;
        padding: 5px;
        margin-bottom: 4px;
        border-radius: 6px;
    }

    .ttl {
        font-weight: bold;
        font-size: 13px;
        margin-bottom: 3px;
        text-align: right;
    }

    .phone {
        font-size: 13px;
        font-weight: bold;
        margin-top: 4px;
    }

    .delivery {
        text-align: center;
        font-size: 11px;
        margin-top: 3px;
    }

    .insurance {
        text-align: center;
        font-size: 11px;
        color: #b30000;
        margin-top: 1px;
    }

    .city {
        margin-top: 6px;
        text-align: center;
    }

    .city span {
        display: inline-block;
        font-size: 40px;
        font-weight: 700;
        transform: scaleX(2) rotate(-0.6deg);
        transform-origin: center;
        letter-spacing: 1px;
        line-height: 1.05;
    }
}

