/* M2M Logistics - Status History timeline (dipakai halaman Tracking + modal global).
   Class ber-prefix awb- agar tidak tabrakan dengan komponen .timeline bawaan AdminLTE. */

.awb-timeline { position: relative; padding: 10px 0; }
.awb-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #dee2e6, #007bff);
    border-radius: 2px;
    transform: translateX(-50%);
}
.awb-tl-item {
    position: relative;
    width: 50%;
    padding: 4px 0;
    cursor: pointer;
    box-sizing: border-box;
    animation: awb-tl-in .35s ease both;
}
.awb-tl-item.left { left: 0; text-align: right; padding-right: 34px; }
.awb-tl-item.right { left: 50%; padding-left: 34px; }
/* Compact: item berikutnya ditarik ke atas agar modal tidak panjang */
.awb-tl-item + .awb-tl-item { margin-top: -30px; }
@keyframes awb-tl-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.awb-tl-badge {
    position: absolute;
    top: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    z-index: 1;
    background: #6c757d;
}
.awb-tl-item.left .awb-tl-badge { right: -15px; }
.awb-tl-item.right .awb-tl-badge { left: -15px; }
.awb-tl-card {
    position: relative;
    display: inline-block;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 7px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    transition: box-shadow .15s, transform .15s;
    max-width: 100%;
    vertical-align: top;
}
/* Sudut "percakapan" (speech bubble) mengarah ke badge:
   left  → badge di kanan → ekor kanan
   right → badge di kiri  → ekor kiri */
.awb-tl-item.left .awb-tl-card {
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
}
.awb-tl-item.right .awb-tl-card {
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
}
.awb-tl-item.left .awb-tl-card::after,
.awb-tl-item.right .awb-tl-card::after {
    content: '';
    position: absolute;
    top: 12px;
    width: 10px;
    height: 10px;
    background: #fff;
    z-index: 0;
}
/* Ekor kanan (menuju badge di sisi kanan) */
.awb-tl-item.left .awb-tl-card::after {
    right: -5px;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    transform: rotate(-45deg);
}
/* Ekor kiri (menuju badge di sisi kiri) */
.awb-tl-item.right .awb-tl-card::after {
    left: -5px;
    border-left: 1px solid #e9ecef;
    border-top: 1px solid #e9ecef;
    transform: rotate(45deg);
}
.awb-tl-item:hover .awb-tl-card {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    transform: translateY(-1px);
}
.awb-tl-checkpoint { font-weight: 700; font-size: 13px; color: #343a40; }
.awb-tl-checkpoint .now {
    font-size: 10px;
    font-weight: 700;
    background: #28a745;
    color: #fff;
    border-radius: 10px;
    padding: 1px 8px;
    margin-left: 6px;
    vertical-align: 1px;
}
.awb-tl-date { font-size: 11px; color: #888; margin-top: 2px; }
.awb-tl-detail { font-size: 11px; color: #666; margin-top: 2px; }
.awb-tl-remark { font-size: 11px; color: #999; font-style: italic; margin-top: 2px; }
.awb-tl-item.current .awb-tl-badge { animation: awb-tl-pulse 2s infinite; }
@keyframes awb-tl-pulse {
    0% { box-shadow: 0 0 0 2px rgba(40,167,69,.6); }
    50% { box-shadow: 0 0 0 7px rgba(40,167,69,.15); }
    100% { box-shadow: 0 0 0 2px rgba(40,167,69,.6); }
}
.awb-tl-item.current .awb-tl-card { border-color: #28a745; }
/* Ekor bubble ikut warna border card saat current */
.awb-tl-item.current.left .awb-tl-card::after {
    border-right-color: #28a745;
    border-bottom-color: #28a745;
}
.awb-tl-item.current.right .awb-tl-card::after {
    border-left-color: #28a745;
    border-top-color: #28a745;
}

/* Chip "Tahap Berikutnya" — DI TENGAH garis timeline (bukan zigzag kiri/kanan) */
.awb-tl-item.awb-tl-item-next {
    width: 100%;
    left: 0;
    padding: 2px 0 6px;
    text-align: center;
    cursor: default;
    margin-top: 2px !important; /* jangan ikut overlap -30px */
}
.awb-tl-item-next:hover .awb-tl-card { box-shadow: none; transform: none; }
/* Badge tetap di garis tengah, di atas card */
.awb-tl-item-next .awb-tl-badge {
    left: 50% !important;
    right: auto !important;
    top: -6px;
    transform: translateX(-50%);
    z-index: 2;
}
.awb-tl-card-next {
    position: relative;
    display: inline-block;
    border-style: dashed;
    border-color: #ced4da;
    background: #fafbfc;
    box-shadow: none;
    border-radius: 14px;
    padding: 6px 14px;
    margin-top: 18px; /* ruang untuk badge di garis tengah */
    max-width: min(420px, calc(100% - 24px));
    vertical-align: top;
    /* tanpa ekor bubble — card center, bukan percakapan kiri/kanan */
}
.awb-tl-card-next::after,
.awb-tl-card-next::before { display: none !important; }
.awb-tl-badge-next { opacity: .9; }
.awb-tl-checkpoint .next-chip {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    background: #6f42c1;
    color: #fff;
    border-radius: 10px;
    padding: 1px 8px;
    margin-left: 6px;
    vertical-align: 1px;
}

/* Compact list (dipakai bila ruang sempit) */
.awb-tl-item-li { cursor: pointer; }

/* Empty state */
.awb-no-data { text-align: center; padding: 40px 20px; color: #aaa; }
.awb-no-data i { font-size: 40px; display: block; margin-bottom: 12px; }

/* Tabel detail timeline (halaman Tracking + modal global) */
.awb-detail-table th[scope="row"] {
    width: 220px;
    font-weight: 600;
    font-size: .8rem;
    color: #495057;
    background: #f8f9fa;
    vertical-align: middle;
    white-space: nowrap;
}
.awb-detail-table td { font-size: .82rem; vertical-align: middle; }
.awb-detail-table td code {
    font-size: .78rem;
    color: #6f42c1;
    background: #f3effc;
    padding: 1px 6px;
    border-radius: 4px;
    word-break: break-all;
}
.modal-title code, h6 code {
    font-size: .78rem;
    font-weight: 400;
    background: #e9ecef;
    padding: 1px 8px;
    border-radius: 10px;
}

/* Layar sempit / modal kecil: jadi satu kolom */
@media (max-width: 767.98px) {
    .awb-timeline::before { left: 15px; }
    .awb-tl-item.left, .awb-tl-item.right {
        left: 0;
        width: 100%;
        text-align: left;
        padding-left: 44px;
        padding-right: 0;
    }
    .awb-tl-item.left .awb-tl-badge, .awb-tl-item.right .awb-tl-badge { left: 0; right: auto; }
    /* Compact di mobile (badge semua di kiri → ekor bubble juga di kiri) */
    .awb-tl-item + .awb-tl-item { margin-top: -14px; }
    .awb-tl-item.left .awb-tl-card,
    .awb-tl-item.right .awb-tl-card {
        border-radius: 12px;
        border-top-left-radius: 2px;
        border-bottom-left-radius: 2px;
        border-top-right-radius: 12px;
        border-bottom-right-radius: 12px;
    }
    .awb-tl-item.left .awb-tl-card::after,
    .awb-tl-item.right .awb-tl-card::after {
        right: auto;
        left: -5px;
        border-left: 1px solid #e9ecef;
        border-top: 1px solid #e9ecef;
        border-right: 0;
        border-bottom: 0;
        transform: rotate(45deg);
    }
    .awb-tl-item.current.left .awb-tl-card::after,
    .awb-tl-item.current.right .awb-tl-card::after {
        border-left-color: #28a745;
        border-top-color: #28a745;
        border-right-color: transparent;
        border-bottom-color: transparent;
    }
    /* Next stage: badge di garis kiri (satu kolom), card penuh di sampingnya */
    .awb-tl-item.awb-tl-item-next {
        width: 100%;
        left: 0;
        text-align: left;
        padding: 4px 0 6px 44px;
        margin-top: 2px !important;
    }
    .awb-tl-item-next .awb-tl-badge {
        left: 0 !important;
        right: auto !important;
        top: 2px;
        transform: none;
    }
    .awb-tl-card-next {
        display: block;
        margin-top: 0;
        max-width: 100%;
    }
}


/* ── Lampiran foto / dokumen (tracking) ─────────────────────────── */
.att-gallery { border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px; background: #fafbfc; }
.att-empty { padding: 10px 4px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.att-item {
    position: relative; width: 118px; text-align: center;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
    padding: 6px 4px 4px; transition: box-shadow .15s ease;
}
.att-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.att-thumb {
    width: 100%; height: 84px; object-fit: cover; border-radius: 4px;
    display: block; background: #f1f3f5; cursor: pointer;
}
.att-doc-icon {
    width: 100%; height: 84px; display: flex; align-items: center; justify-content: center;
    background: #f1f3f5; border-radius: 4px; font-size: 2rem; text-decoration: none;
}
.att-name {
    font-size: 10px; color: #444; margin-top: 4px; line-height: 1.25;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-meta { font-size: 9px; color: #999; }
.att-del {
    position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
    border: 0; border-radius: 50%; background: #dc3545; color: #fff;
    font-size: 9px; line-height: 20px; padding: 0; cursor: pointer;
    display: none; align-items: center; justify-content: center; z-index: 2;
}
.att-item:hover .att-del { display: flex; }
.att-del:hover { background: #a71d2a; }

/* Dropzone upload */
.att-dropzone {
    border: 2px dashed #b6c2d0; border-radius: 8px; background: #f8fafc;
    padding: 22px 14px; text-align: center; cursor: pointer; outline: none;
    transition: border-color .15s ease, background .15s ease;
}
.att-dropzone:hover, .att-dropzone:focus { border-color: #007bff; background: #f0f6ff; }
.att-dropzone.att-dz-hover { border-color: #28a745; background: #f0fff4; }
.att-dz-icon { font-size: 34px; color: #9fb0c3; display: block; margin-bottom: 6px; }
.att-dropzone.att-dz-hover .att-dz-icon { color: #28a745; }
.att-dz-text { font-size: 13px; color: #444; line-height: 1.5; }
.att-dz-hint { font-size: 11px; color: #888; margin-top: 5px; }
.att-picked { max-height: 240px; overflow-y: auto; }
.att-picked-title { font-size: 12px; font-weight: 600; color: #555; }

/* Section gabungan "Foto & Dokumen" — semua stage dalam satu blok, thumbnail kecil */
.att-all {
    border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 10px 12px 12px; background: #fafbfc;
}
.att-all-h {
    display: flex; align-items: center;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: #495057; margin-bottom: 8px;
}
.att-all-h i { color: #e02027; }
.att-all-n {
    background: #e5e7eb; color: #374151;
    border-radius: 999px; padding: 0 7px; font-size: 10px;
    line-height: 1.5; margin-left: 5px;
}
.att-all-g { display: flex; flex-wrap: wrap; gap: 5px; }
.att-all-thumb {
    width: 44px; height: 44px; overflow: hidden;
    border: 1px solid #dee2e6; border-radius: 5px; background: #fff;
    display: flex; align-items: center; justify-content: center;
}
.att-all-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-all-thumb.doc { color: #dc3545; font-size: 1.1rem; background: #f1f3f5; }
.att-all-thumb:hover { border-color: #007bff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.14); }


/* FancyBox harus berada DI ATAS Bootstrap modal (modal=1055, backdrop=1050).
   Default FancyBox = 1050 -> akan tertutup modal; naikkan. */
:root { --fancybox-zIndex: 1080; }
