/* =====================================================================
   ORDER CHAT -- POS (staff side). Pang-Daet lang (js/chat/chat-ui.js).
   Mga kulay ng Daet: pula #B01010, madilim na pula #9A0A0A, dilaw #FFF200,
   tinta #2B0A0A. Lahat ng class ay may prefix na `dkc-`.
   ⚠️ Walang `display: … !important` sa mga pindutan: tinatalo nito ang gating
      ng roles.js (inline display:none) at ng features.js (.feature-off).
   ===================================================================== */

/* ---- Icon sa top bar (ang itsura ay galing sa .notif-bell-btn) ---- */
.dkc-top { position: relative; display: flex; align-items: center; }

/* ---- Pindutan sa inbox card at Order Details ---- */
.dkc-card-btn { display: inline-flex; align-items: center; gap: 6px; }
/* Slot ng hook: walang sariling kahon (ang pindutan ang flex item); wala kapag walang laman. */
.dkc-slot { display: contents; }
.dkc-slot:empty { display: none; }
.dkc-n:empty { display: none; }
.dkc-card-btn__n,
.dkc-item__n {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    box-sizing: border-box;
    border-radius: 10px;
    background: #B01010;
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    line-height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dkc-card-btn__n[hidden] { display: none; }
.dkc-od-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 2px 11px;
    border-radius: 999px;
    border: 2px solid #B01010;
    background: #fff;
    color: #B01010;
    font: inherit;
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
.dkc-od-btn:hover { background: #FFF200; }
.dkc-od-btn:focus-visible,
.dkc-card-btn:focus-visible { outline: 3px solid #FFF200; outline-offset: 2px; }

/* ---- Drawer ---- */
.dkc-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(43, 10, 10, 0.35);
    z-index: 9989;              /* sa ilalim ng modal (9999) at toast (10000) */
}
.dkc-backdrop[hidden],
.dkc-drawer[hidden],
.dkc-drawer [hidden] { display: none; }
.dkc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #2B0A0A;
    border-left: 2px solid #2B0A0A;
    box-shadow: -10px 0 28px rgba(43, 10, 10, 0.18);
    z-index: 9990;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    font-family: inherit;
}
.dkc-drawer.is-in { transform: none; }
@media (prefers-reduced-motion: reduce) { .dkc-drawer { transition: none; } }

.dkc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: #B01010;
    color: #fff;
    flex-shrink: 0;
}
.dkc-head__txt { flex: 1; min-width: 0; }
.dkc-title {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dkc-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-top: 4px;
    font-size: 12.5px;
    font-weight: 700;
    color: #FFF9B3;
}
/* Numero ng customer: pindot = tawag. Ang numero ay laging nakasulat din. */
.dkc-tel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #FFF9B3;
    font-weight: 800;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}
a.dkc-tel:hover { background: #FFF200; color: #B01010; }
a.dkc-tel:focus-visible { outline: 3px solid #FFF200; outline-offset: 2px; }
.dkc-iconbtn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.dkc-iconbtn:hover { background: #FFF200; color: #B01010; }
.dkc-iconbtn:focus-visible { outline: 3px solid #FFF200; outline-offset: 2px; }

.dkc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: #FFF4E0;
    border-bottom: 1px solid #EAD9AE;
    flex-shrink: 0;
}
.dkc-act {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 2px solid #2B0A0A;
    background: #fff;
    color: #2B0A0A;
    font: inherit;
    font-size: 13.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.dkc-act:hover:not(:disabled) { background: #FFF9B3; }
.dkc-act--danger { border-color: #B01010; color: #B01010; }
.dkc-act:disabled { opacity: 0.5; cursor: default; }
.dkc-act:focus-visible { outline: 3px solid #FFF200; outline-offset: 2px; }

.dkc-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #fff;
}

/* ---- Listahan ---- */
.dkc-list { list-style: none; margin: 0; padding: 0; }
.dkc-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid #F1E6D0;
    background: #fff;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.dkc-item:hover { background: #FFF9B3; }
.dkc-item:focus-visible { outline: 3px solid #B01010; outline-offset: -3px; }
.dkc-item.is-unread { background: #FFFDE6; }
.dkc-item__top,
.dkc-item__bottom { display: flex; align-items: center; gap: 8px; }
.dkc-item__top { justify-content: space-between; align-items: baseline; }
.dkc-item__name {
    min-width: 0;
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dkc-item__time { flex-shrink: 0; font-size: 12px; font-weight: 700; color: #6B3A3A; }
.dkc-item__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 700;
    color: #6B3A3A;
}
.dkc-item__bottom { margin-top: 4px; }
.dkc-item__snip {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dkc-item.is-unread .dkc-item__snip { font-weight: 800; }
.dkc-chip {
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}
.dkc-chip--closed { background: #EFE7D6; color: #6B3A3A; }
/* Order code (o "No order") sa listahan at sa header. */
.dkc-ochip {
    padding: 1px 8px;
    border-radius: 999px;
    background: #FFF200;
    color: #2B0A0A;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.dkc-ochip--none { background: #EFE7D6; color: #6B3A3A; letter-spacing: 0; }
.dkc-ochip--head { padding: 3px 10px; font-size: 12px; }
.dkc-item__phone { font-variant-numeric: tabular-nums; }
.dkc-chip--blocked { background: #B01010; color: #fff; }
.dkc-empty {
    padding: 48px 20px;
    text-align: center;
    font-weight: 700;
    color: #6B3A3A;
}
.dkc-empty i { display: block; font-size: 34px; opacity: 0.35; margin-bottom: 10px; }
.dkc-empty p { margin: 0; }

/* ---- Thread ---- */
.dkc-thread { display: flex; flex-direction: column; gap: 8px; padding: 14px 12px; }
.dkc-msg { display: flex; flex-direction: column; max-width: 82%; }
.dkc-msg--cust { align-self: flex-start; align-items: flex-start; }
.dkc-msg--staff { align-self: flex-end; align-items: flex-end; }
.dkc-bubble {
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.dkc-msg--cust .dkc-bubble {
    background: #FFF4E0;
    border: 1px solid #EAD9AE;
    color: #2B0A0A;
    border-bottom-left-radius: 4px;
}
.dkc-msg--staff .dkc-bubble {
    background: #B01010;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.dkc-time { margin-top: 3px; padding: 0 4px; font-size: 11px; font-weight: 700; color: #6B3A3A; }

/* ---- Reply ---- */
.dkc-compose {
    flex-shrink: 0;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    border-top: 2px solid #2B0A0A;
    background: #fff;
}
.dkc-note { margin-bottom: 8px; font-size: 12.5px; font-weight: 700; color: #6B3A3A; }
.dkc-note--err { color: #B01010; }
.dkc-compose__row { display: flex; align-items: flex-end; gap: 8px; }
.dkc-input {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    max-height: 140px;
    box-sizing: border-box;
    resize: none;
    padding: 10px 12px;
    border: 2px solid #2B0A0A;
    border-radius: 12px;
    background: #fff;
    color: #2B0A0A;
    font: inherit;
    font-size: 16px;            /* walang zoom sa iOS */
    font-weight: 600;
    line-height: 1.35;
}
.dkc-input:focus { outline: 3px solid #FFF200; outline-offset: 0; border-color: #B01010; }
.dkc-input:disabled { background: #F6F1E7; color: #6B3A3A; }
.dkc-send {
    width: 48px;
    height: 46px;
    flex-shrink: 0;
    border: 0;
    border-radius: 12px;
    background: #B01010;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}
.dkc-send:hover:not(:disabled) { background: #9A0A0A; }
.dkc-send:disabled { opacity: 0.45; cursor: default; }
.dkc-send:focus-visible { outline: 3px solid #FFF200; outline-offset: 2px; }
.dkc-count { margin-top: 4px; text-align: right; font-size: 12px; font-weight: 800; color: #6B3A3A; }
.dkc-count.is-max { color: #B01010; }

@media (max-width: 600px) {
    .dkc-drawer { width: 100vw; border-left: 0; }
    .dkc-msg { max-width: 88%; }
}

/* ---- Pop-up sa gilid habang may hindi pa nababasa (2026-12-01) ---- */
.dkc-pops {
    position: fixed;
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 9988;              /* sa ilalim ng chat drawer, modal at toast */
    display: grid;
    gap: 8px;
    width: min(270px, calc(100vw - 20px));
}
.dkc-pop {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 6px 8px;
    text-align: left;
    background: #fff;
    color: #2B0A0A;
    border: 2px solid #B01010;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(43, 10, 10, .22);
    cursor: pointer;
    font: inherit;
    animation: dkcPopIn .25s ease-out, dkcPopPulse 2.4s ease-in-out .25s infinite;
}
.dkc-pop:focus-visible { outline: 3px solid #2B6CB0; outline-offset: 2px; }
.dkc-pop__ic {
    flex: 0 0 auto;
    width: 28px; height: 28px;
    border-radius: 999px;
    display: grid; place-items: center;
    background: #B01010; color: #FFF200;
    font-size: 13px;
}
.dkc-pop__txt { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.dkc-pop__who { font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dkc-pop__n {
    display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
    border-radius: 999px; background: #B01010; color: #fff;
    font-size: 11px; line-height: 18px; text-align: center; vertical-align: 1px;
}
.dkc-pop__body { font-size: 12px; color: #6B4A3E; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dkc-pop__go {
    flex: 0 0 auto;
    padding: 5px 10px;
    border-radius: 8px;
    background: #B01010; color: #FFF200;
    font-weight: 800; font-size: 12px;
}
.dkc-pop--more {
    min-height: 40px;
    justify-content: center;
    font-weight: 800; font-size: 13px;
    color: #B01010;
    animation: dkcPopIn .25s ease-out;
}
@keyframes dkcPopIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dkcPopPulse {
    0%, 100% { box-shadow: 0 10px 26px rgba(43, 10, 10, .22), 0 0 0 0 rgba(176, 16, 16, .35); }
    50%      { box-shadow: 0 10px 26px rgba(43, 10, 10, .22), 0 0 0 7px rgba(176, 16, 16, 0); }
}
@media (prefers-reduced-motion: reduce) { .dkc-pop, .dkc-pop--more { animation: none; } }
/* Telepono: sa itaas ng "View Order" at ng Assistant na button. */
@media (max-width: 760px) {
    .dkc-pops { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); width: min(270px, calc(100vw - 20px)); }
}
