/* =======================
   0. Nút tra cứu cố định (Image Button)
   ======================= */
/* Wrapper cho nút tra cứu hình ảnh */
.oat-fixed-tracking-wrapper {
    position: fixed;
    bottom: calc(160px + env(safe-area-inset-bottom, 0px));
    right: 20px;
    z-index: 1000;
}

/* Nút tra cứu dạng hình ảnh */
.oat-fixed-tracking-img-btn {
    cursor: pointer;
    display: block;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.3s ease;
    animation: oat-tracking-btn-pulse 2s infinite;
}

.oat-fixed-tracking-img-btn:hover {
    transform: scale(1.08);
    animation: none;
}

.oat-fixed-tracking-img-btn:active {
    transform: scale(0.95);
}

/* Hình ảnh nút tra cứu */
.oat-tracking-btn-img {
    display: block;
    width: 55px;
    height: auto;
    background: transparent !important;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.25));
    transition: filter 0.3s ease;
}

.oat-fixed-tracking-img-btn:hover .oat-tracking-btn-img {
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.35));
}

/* Animation pulse cho nút */
@keyframes oat-tracking-btn-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Focus state cho accessibility */
.oat-fixed-tracking-img-btn:focus {
    outline: none;
    background: transparent !important;
}

/* Override styles cũ cho #fixed-tracking-button */
.oat-fixed-tracking-wrapper #fixed-tracking-button {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

.oat-fixed-tracking-wrapper #fixed-tracking-button:hover,
.oat-fixed-tracking-wrapper #fixed-tracking-button:active {
    background: transparent !important;
    box-shadow: none !important;
}

.oat-fixed-tracking-wrapper #fixed-tracking-button::before,
.oat-fixed-tracking-wrapper #fixed-tracking-button::after {
    display: none !important;
}

/* =======================
   1. Popup tra cứu đơn hàng (Mobile-first với dvh + safe-area)
   ======================= */
.tracking-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
}
.tracking-popup-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}
.tracking-popup-content {
    /* Centered positioning */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    background-color: #f8f9fa;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    /* Width responsive với safe-area */
    width: min(calc(100vw - 24px - 2 * env(safe-area-inset-left, 0px)), 980px);
    /* Max-height với safe-area - chiếm 85-95% viewport, không bao giờ tràn */
    max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(100svh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    /* REMOVED min-height: 980px - đây là nguyên nhân popup tràn mobile! */
    /* Flexbox column layout để header sticky và body cuộn */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Container không cuộn, chỉ body bên trong cuộn */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: auto;
}
.tracking-popup-header {
    /* Header cố định — không cuộn, không bị content chui vào */
    position: relative;
    z-index: 10;
    background-color: #f8f9fa;
    padding: 15px 20px 10px 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0; /* Header không co lại */
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}
.tracking-popup-content-body {
    /* Body cuộn được - chứa form và kết quả tra cứu */
    position: relative;
    z-index: 1;
    padding: 0;
    /* Thêm padding-bottom với safe-area cho iOS home indicator */
    padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
    flex: 1 1 0;        /* Cho phép co lại, không chiếm quá container */
    min-height: 0;      /* QUAN TRỌNG: cho flex item scroll đúng, tránh tràn */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.tracking-popup-close {
    position: absolute;
    top: -10px;
    right: 20px;
    width: 28px;
    height: 28px;
    font-size: 28px;
    font-weight: normal;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
}
.tracking-popup-close:hover {
    color: #333;
}

/* =======================
   2. Form tra cứu
   ======================= */
.tracking-popup .form-group {
    margin-bottom: 15px;
}
.tracking-popup h2 {
    margin: 0 0 5px 0;
    font-size: 1.5em;
    color: #343a40;
}
form#tracking-form {
    /* Form nằm trong body scroll — không sticky */
    background-color: #f8f9fa;
    padding: 20px 25px 15px 25px;
}
.tracking-popup label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.tracking-popup input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #adb5bd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.tracking-popup input[type="text"]:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 0.2rem rgba(0, 86, 179, 0.25);
}
.tracking-popup button[type="button"]#submit-tracking {
    background-color: #0056b3;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    width: 100%;
}
.tracking-popup button[type="button"]#submit-tracking:hover {
    background-color: #004080;
}

/* =======================
   3. Empty / Loading / Not-found / Result states
   ======================= */

/* --- Empty state --- */
.oat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
}

.oat-empty-state__icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f1f3f5 0%, #f8f9fa 100%);
    border-radius: 50%;
    margin-bottom: 16px;
    color: #adb5bd;
}

.oat-empty-state__icon svg {
    width: 32px;
    height: 32px;
}

.oat-empty-state__text {
    max-width: 320px;
}

.oat-empty-state__title {
    font-size: 1.05em;
    font-weight: 600;
    color: #495057;
    margin: 0 0 8px 0;
}

.oat-empty-state__desc {
    font-size: 0.9em;
    color: #868e96;
    line-height: 1.5;
    margin: 0;
}

/* --- Loading state --- */
.oat-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.oat-loading-state__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e9ecef;
    border-top-color: #0056b3;
    border-radius: 50%;
    animation: oat-trk-spin 0.7s linear infinite;
    margin-bottom: 14px;
}

@keyframes oat-trk-spin {
    to { transform: rotate(360deg); }
}

.oat-loading-state__text {
    font-size: 0.95em;
    color: #868e96;
    margin: 0;
}

/* --- Not-found state --- */
.oat-notfound-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
}

.oat-notfound-state__icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff3cd 0%, #fffbea 100%);
    border-radius: 50%;
    margin-bottom: 16px;
    color: #e67700;
}

.oat-notfound-state__icon svg {
    width: 32px;
    height: 32px;
}

.oat-notfound-state__text {
    max-width: 320px;
}

.oat-notfound-state__title {
    font-size: 1.05em;
    font-weight: 600;
    color: #495057;
    margin: 0 0 8px 0;
}

.oat-notfound-state__desc {
    font-size: 0.9em;
    color: #868e96;
    line-height: 1.5;
    margin: 0;
}

/* --- Result state --- */
#tracking-result {
    padding: 10px 25px 20px 25px;
}
#tracking-result h3 {
    margin-top: 0;
    font-size: 1.3em;
    color: #495057;
    margin-bottom: 15px;
}
#tracking-result ul {
    list-style-type: none;
    padding-left: 0;
}
#tracking-result ul li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.95em;
    color: #495057;
}
#tracking-result ul li strong {
    color: #212529;
    margin-right: 5px;
}
#tracking-result ul li:last-child {
    border-bottom: none;
}
#tracking-result .tracking-error,
#tracking-result .tracking-not-found {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-weight: 500;
}
#tracking-result .tracking-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
#tracking-result .tracking-not-found {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* =======================
   4. Chi tiết đơn hàng
   ======================= */
.tracking-order-details {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
}
.tracking-order-details .detail-item {
    margin-bottom: 8px;
}
.tracking-order-details .detail-item .label {
    font-weight: bold;
    color: #343a40;
}
.tracking-order-details .detail-item .value {
    color: #495057;
}

/* =======================
   6. Responsive - Mobile Bottom Sheet
   ======================= */

/* Desktop / large screens: tận dụng chiều cao viewport */
@media (min-width: 769px) {
    .tracking-popup-content {
        height: 85vh;
        height: 85dvh;
        max-height: calc(100vh - 48px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(100dvh - 48px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
}
@media (min-width: 769px) and (min-height: 900px) {
    .tracking-popup-content {
        height: 88vh;
        height: 88dvh;
        max-height: calc(100vh - 60px);
        max-height: calc(100dvh - 60px);
    }
}

/* Mobile: Bottom Sheet style (bám đáy màn hình) */
@media (max-width: 768px) {
    /* Popup bám đáy - bottom sheet */
    .tracking-popup-content {
        /* Bottom-sheet: bám đáy, center bằng margin (không dùng transform) */
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        transform: none; /* Tránh iOS zoom/layout bug */
        
        /* Full-width trên mobile — bottom sheet */
        width: 100%;
        max-width: none;
        
        /* Height auto + max-height: keyboard không gây jump */
        height: auto;
        min-height: 300px;
        max-height: calc(100vh - 20px - env(safe-area-inset-top, 0px));
        max-height: calc(100svh - 20px - env(safe-area-inset-top, 0px));
        max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px));
        
        /* Border-radius: Bo góc trên, không bo dưới (bottom sheet) */
        border-radius: 20px 20px 0 0;
    }
    
    /* Header bottom sheet */
    .tracking-popup-header {
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }
    
    /* Body giữ padding-bottom với safe-area */
    .tracking-popup-content-body {
        padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
    }
    
    /* iOS input zoom fix: font >=16px */
    .tracking-popup-content input,
    .tracking-popup-content select,
    .tracking-popup-content textarea {
        font-size: 16px !important;
    }
}

/* Mobile small screens: Tối ưu thêm */
@media (max-width: 600px) {
    .tracking-popup-content {
        width: 100%; /* Full width trên mobile nhỏ */
        border-radius: 16px 16px 0 0; /* Bottom-sheet consistent */
    }
    .tracking-popup-header {
        padding: 12px 15px 10px 15px;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }
    .tracking-popup-header h2 {
        font-size: 1.3em;
    }
    .tracking-popup-close {
        top: -8px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 32px;
    }
    form#tracking-form {
        padding: 15px 15px 10px 15px;
    }
    #tracking-result {
        padding: 10px 15px 15px 15px;
    }
    .tracking-order-item h4 {
        padding: 12px 15px;
        font-size: 1em;
    }
    .tracking-order-item .order-item-body {
        padding: 12px 15px 15px 15px;
    }
    .tracking-order-item .order-item-body p {
        font-size: 0.9em;
    }
    /* Product card mobile tweaks */
    .oat-tracking-product-header {
        gap: 10px;
        padding: 8px 10px;
    }
    .oat-tracking-product-item .oat-product-image img,
    .oat-tracking-product-item .oat-product-image.oat-product-image-placeholder {
        width: 48px;
        height: 48px;
    }
    .oat-tracking-product-item .oat-product-name {
        font-size: 0.88em;
    }
    .oat-product-qty-price {
        font-size: 0.84em;
    }
    .oat-tracking-product-details {
        padding: 0 10px 8px 10px;
    }
    .tracking-order-item h5 {
        font-size: 1em;
    }
    .tracking-order-item h5 + ul {
        padding-left: 20px;
    }
    .tracking-order-item h5 + ul li {
        padding-left: 15px;
        font-size: 0.85em;
        margin-left: 0;
    }
    .tracking-order-item h5 + ul li::before {
        left: -21.5px;
        top: 6px;
    }
}

/* =======================
   7. Product Card — Tracking Modal
   ======================= */
/* Card container */
.oat-tracking-product-item {
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

/* Top row: image + name + qty */
.oat-tracking-product-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
}
.oat-tracking-product-item .oat-product-image {
    flex-shrink: 0;
}
.oat-tracking-product-item .oat-product-image img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    display: block;
}
.oat-tracking-product-item .oat-product-image.oat-product-image-placeholder {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.oat-product-header-info {
    flex: 1;
    min-width: 0;
}
.oat-tracking-product-item .oat-product-name {
    font-weight: 600;
    font-size: 0.92em;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.oat-product-qty-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88em;
}
.oat-product-qty {
    color: #666;
}
.oat-product-total {
    color: #c62828;
    font-weight: 600;
}
/* Gift item styling */
.oat-tracking-gift-item {
    background: linear-gradient(135deg, #f0faf0, #e8f5e9) !important;
    border-color: #c8e6c9 !important;
}
.oat-gift-image-placeholder {
    background: linear-gradient(135deg, #66bb6a, #43a047) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.oat-gift-label {
    color: #666;
    font-size: 0.8em;
}

/* Bottom section: details, warranty, actions */
.oat-tracking-product-details {
    padding: 0 12px 10px 12px;
}

/* ─── After-sales block: Bảo hành & Đổi trả (row-based) ─── */
.oat-aftersales-block {
    margin-top: 6px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #eef0f2;
}
.oat-as-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dotted #e5e7eb;
    font-size: 0.84em;
    line-height: 1.45;
}
.oat-as-row:last-child {
    border-bottom: none;
}
.oat-as-label {
    color: #6b7280;
    flex-shrink: 0;
    margin-right: 10px;
}
.oat-as-value {
    text-align: right;
    font-weight: 600;
    color: #374151;
    word-break: break-word;
}
.oat-as-value.oat-as-ok {
    color: #16a34a;
}
.oat-as-value.oat-as-pending {
    color: #d97706;
}
.oat-as-value.oat-as-expired {
    color: #9ca3af;
    font-weight: 400;
}
/* Dòng phụ giải thích */
.oat-as-sub {
    font-size: 0.76em;
    color: #9ca3af;
    line-height: 1.4;
    padding: 2px 0 4px 0;
    border-bottom: 1px dotted #e5e7eb;
}

/* Return request section */
.oat-return-request-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}
.oat-return-request-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ff5722 0%, #e64a19 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.oat-return-request-toggle:hover {
    opacity: 0.9;
}

/* Return form */
.oat-return-request-form {
    display: none;
    margin-top: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.oat-return-request-form h6 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 0.9em;
}
.oat-return-field {
    margin-bottom: 10px;
}
.oat-return-field label {
    display: block;
    font-size: 0.85em;
    color: #555;
    margin-bottom: 4px;
}
.oat-return-field textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    resize: vertical;
    box-sizing: border-box;
}
.oat-return-field input[type="file"] {
    font-size: 0.85em;
}
.oat-return-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.oat-return-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.oat-return-cancel-btn {
    padding: 6px 12px;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
}
.oat-return-submit-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, #ff5722 0%, #e64a19 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: 500;
}
.oat-return-response {
    margin-top: 10px;
    display: none;
}

/* =======================
   8. Timeline & lịch sử trạng thái
   ======================= */
.tracking-order-item {
    border: none;
    padding: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}
.tracking-order-item h4 {
    margin-top: 0;
    padding: 14px 20px;
    margin-bottom: 0;
    font-size: 1.1em;
    color: #fff;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5f8a 100%);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    letter-spacing: 0.3px;
}
.oat-h4-label {
    font-weight: 500;
    opacity: 0.85;
    margin-right: 6px;
}
.oat-h4-code {
    font-weight: 700;
    letter-spacing: 0.5px;
}
.tracking-order-item .order-item-body {
    padding: 15px 20px 20px 20px;
}
.tracking-order-item .order-item-body p {
    margin: 0 0 10px 0;
    font-size: 0.95em;
    color: #495057;
    padding-bottom: 10px;
    border-bottom: 1px dotted #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.tracking-order-item .order-item-body p:has(+ .oat-payment-confirmation-area),
.tracking-order-item .order-item-body p:has(+ h5) {
    border-bottom: none;
    margin-bottom: 15px;
}
.tracking-order-item .order-item-body p:not(:has(~ .oat-payment-confirmation-area)):has(+ h5) {
    border-bottom: none;
    margin-bottom: 15px;
}
.tracking-order-item .order-item-body p strong {
    color: #343a40;
    margin-right: 8px;
    flex-shrink: 0;
}
.tracking-order-item .order-item-body p span.value {
    text-align: right;
    color: #212529;
    word-break: break-word;
}
.tracking-order-item .oat-payment-confirmation-content p {
    display: block;
    text-align: left;
}
.tracking-order-item .oat-payment-confirmation-content strong {
    color: #212529;
}
.tracking-order-item .oat-payment-confirmation-response-tracking {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px dashed #28a745;
    background-color: #e9f7ef;
    color: #155724;
    font-weight: 500;
    text-align: center;
    display: none;
}

/* ========== QR Payment Card (tracking popup) ========== */
.oat-trk-qr-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    animation: oat-trk-card-appear 0.4s ease-out;
}
@keyframes oat-trk-card-appear {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.oat-trk-qr-card .oat-qr-amount-block {
    text-align: center;
    padding: 18px 16px 14px;
}
.oat-trk-qr-card .oat-qr-amount-label {
    font-size: 0.78em;
    color: #757575;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.oat-trk-qr-card .oat-qr-amount-value {
    font-size: 1.65em;
    font-weight: 800;
    color: #c62828;
    line-height: 1.2;
}
.oat-trk-qr-card .oat-qr-amount-value strong {
    color: inherit;
}
.oat-trk-qr-card .oat-qr-amount-block .oat-copy-btn {
    margin-top: 8px;
}
.oat-trk-qr-card .oat-qr-code-block {
    text-align: center;
    padding: 0 16px 16px;
}
.oat-trk-qr-card .oat-qr-image-wrapper {
    position: relative;
    display: inline-block;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 8px;
    max-width: 260px;
    width: 100%;
}
.oat-trk-qr-card .oat-qr-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}
.oat-trk-qr-card .oat-qr-loading {
    padding: 60px 20px;
    color: #9e9e9e;
    font-size: 0.85em;
}
.oat-trk-qr-card .oat-qr-error {
    padding: 20px;
    color: #e65100;
    font-size: 0.82em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.oat-trk-qr-card .oat-qr-hint {
    margin: 10px 0 0;
    color: #757575;
    font-size: 0.78em;
}
.oat-trk-qr-card .oat-qr-transfer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}
.oat-trk-qr-card .oat-qr-transfer-label {
    font-size: 0.82em;
    color: #757575;
}
.oat-trk-qr-card .oat-qr-transfer-content code {
    background: #fff3e0;
    color: #bf360c;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.92em;
    border: 1px solid #ffe0b2;
}
.oat-trk-qr-card .oat-qr-details-toggle {
    padding: 0 16px;
}
.oat-trk-qr-card .oat-qr-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 6px;
    padding: 12px 0;
    background: none;
    border: none;
    color: #1976d2;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}
.oat-trk-qr-card .oat-qr-toggle-btn:hover {
    color: #0d47a1;
}
.oat-trk-qr-card .oat-qr-chevron {
    transition: transform 0.2s;
}
.oat-trk-qr-card .oat-qr-chevron.is-open {
    transform: rotate(180deg);
}
.oat-trk-qr-card .oat-qr-details-panel {
    padding: 0 16px 12px;
}
.oat-trk-qr-card .oat-qr-details-panel .receipt-bank-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    font-size: 0.83em;
    border-bottom: 1px dotted #e0e0e0;
}
.oat-trk-qr-card .oat-qr-details-panel .receipt-bank-row:last-child {
    border-bottom: none;
}
.oat-trk-qr-card .oat-qr-details-panel .receipt-bank-row span {
    color: #757575;
}
.oat-trk-qr-card .oat-qr-details-panel .receipt-bank-row strong {
    color: #212121;
    font-weight: 600;
}
.oat-trk-qr-card .oat-qr-row-value {
    display: flex;
    align-items: center;
    gap: 6px;
}
.oat-trk-qr-card .oat-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #616161;
    font-size: 0.78em;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.oat-trk-qr-card .oat-copy-btn:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1565c0;
}
.oat-trk-qr-card .oat-copy-btn.oat-copied {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}
.oat-trk-qr-card .oat-copy-btn-sm {
    padding: 2px 6px;
    font-size: 0.72em;
}
.oat-trk-qr-card .oat-qr-note {
    padding: 10px 16px;
    text-align: center;
}
.oat-trk-qr-card .oat-qr-note small {
    color: #9e9e9e;
    font-size: 0.72em;
    line-height: 1.4;
}
.oat-trk-confirm-section {
    padding: 12px 16px 16px;
    border-top: 1px solid #f0f0f0;
}
.tracking-order-item h5 {
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1em;
    color: #343a40;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}
.tracking-order-item h5 + ul {
    list-style-type: none;
    padding-left: 25px;
    position: relative;
    margin-top: 15px;
    margin-bottom: 0;
}
.tracking-order-item h5 + ul::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 5px;
    bottom: 5px;
    width: 3px;
    background-color: #e0e0e0;
    border-radius: 2px;
}
.tracking-order-item h5 + ul li {
    padding: 5px 0 15px 20px;
    position: relative;
    border-bottom: none;
    font-size: 0.9em;
    color: #555;
    line-height: 1.45;
    margin-left: 30px;
}
.tracking-order-item h5 + ul li:last-child {
    padding-bottom: 0;
}
.tracking-order-item h5 + ul li::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 7px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #28a745;
    border: 3px solid #ffffff;
    z-index: 1;
}
.tracking-order-item h5 + ul li strong {
    display: block;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 3px;
    font-size: 0.9em;
}

/* =======================
   8. Landscape mode (mobile xoay ngang)
   ======================= */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
    .tracking-popup-content {
        /* Landscape: Quay về center style vì height thấp, bottom sheet không phù hợp */
        top: 50%;
        left: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        
        width: 85vw;
        max-width: 850px;
        height: auto;
        max-height: calc(95vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(95dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        border-radius: 12px;
    }
    .tracking-popup-header {
        padding: 10px 16px 8px 16px;
        border-radius: 12px 12px 0 0;
    }
    .tracking-popup-header h2 {
        font-size: 1.1em;
    }
    .tracking-popup-close {
        width: 28px;
        height: 28px;
        font-size: 28px;
    }
    form#tracking-form {
        padding: 10px 16px 8px 16px;
    }
    #tracking-result {
        padding: 8px 16px 12px 16px;
    }
}