/* =====================================================
   TMR Checkout — Phong cách Shopee/Lazada
   ===================================================== */

/* Layout 2 cột */
#tmr-checkout-wrap {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
    align-items: start;
}

/* Section chung */
.tmr-section {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
}
.tmr-section__title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tmr-icon { font-size: 16px; }
.tmr-link {
    margin-left: auto;
    color: #c0392b;
    font-weight: 400;
    cursor: pointer;
    font-size: 13px;
}
.tmr-link:hover { text-decoration: underline; }

/* Form fields */
.tmr-form-group {
    margin-bottom: 12px;
}
.tmr-form-group label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
    font-weight: 500;
}
.tmr-form-group input[type="text"],
.tmr-form-group input[type="tel"],
.tmr-form-group select,
#tmr-note {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 7px;
    font-size: 14px;
    color: #333;
    transition: border-color .2s;
    background: #fafafa;
    box-sizing: border-box;
}
.tmr-form-group input:focus,
.tmr-form-group select:focus,
#tmr-note:focus {
    border-color: #c0392b;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(192,57,43,.08);
}
.tmr-form-group select:disabled {
    color: #aaa;
    background: #f5f5f5;
}
.req { color: #c0392b; }

.tmr-form-row--2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Checkbox */
.tmr-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400 !important;
    color: #666 !important;
}

/* Địa chỉ đã lưu */
.tmr-addr-box {
    background: #fff8f8;
    border: 1px solid #f5c6c6;
    border-radius: 8px;
    padding: 12px 14px;
}
.tmr-addr-info { display: flex; flex-direction: column; gap: 3px; }
.tmr-addr-info strong { font-size: 14px; color: #222; }
.tmr-addr-info span { font-size: 13px; color: #666; }

/* Ghi chú */
#tmr-note {
    resize: vertical;
    min-height: 60px;
}

/* Phương thức thanh toán */
.tmr-pay-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all .2s;
}
.tmr-pay-option:hover { border-color: #c0392b; background: #fff8f8; }
.tmr-pay-option--active { border-color: #c0392b; background: #fff8f8; }
.tmr-pay-icon {
    width: 32px; height: 32px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.tmr-pay-label { flex: 1; font-size: 14px; color: #333; }
.tmr-pay-check {
    color: #c0392b;
    font-weight: 700;
    opacity: 0;
    transition: opacity .2s;
}
.tmr-pay-option--active .tmr-pay-check { opacity: 1; }

/* Sản phẩm */
.tmr-product-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.tmr-product-row:last-child { border-bottom: none; }
.tmr-product-img img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.tmr-product-info { flex: 1; }
.tmr-product-name { font-size: 13px; color: #333; font-weight: 500; }
.tmr-product-price { font-size: 13px; color: #c0392b; margin-top: 3px; }
.tmr-product-qty { font-size: 13px; color: #888; white-space: nowrap; }

/* Tóm tắt */
.tmr-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #555;
    padding: 5px 0;
}
.tmr-summary-row--total {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    border-top: 1px solid #eee;
    margin-top: 6px;
    padding-top: 10px;
}
.tmr-summary-row--total span:last-child { color: #c0392b; }
.tmr-points-notice {
    background: #fff9e6;
    border: 1px solid #ffd700;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #856404;
    margin-top: 10px;
}

/* Nút đặt hàng */
.tmr-btn-order {
    width: 100%;
    padding: 14px;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background .2s, transform .1s;
    letter-spacing: .3px;
}
.tmr-btn-order:hover { background: #a93226; }
.tmr-btn-order:active { transform: scale(.98); }
.tmr-btn-order:disabled { background: #ccc; cursor: not-allowed; }

/* Error & Loading */
.tmr-error {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5c6c6;
    border-radius: 7px;
    padding: 10px 14px;
    font-size: 13px;
    margin-top: 8px;
}
.tmr-loading {
    text-align: center;
    padding: 12px;
    color: #666;
    font-size: 14px;
}

/* Loyalty dashboard */
.tmr-loyalty-dashboard { padding: 10px 0; }
.tmr-loyalty-cards {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.tmr-card {
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}
.tmr-card--points  { background: linear-gradient(135deg,#c0392b,#e74c3c); color:#fff; }
.tmr-card--rank    { background: linear-gradient(135deg,#f39c12,#f1c40f); color:#fff; }
.tmr-card--spent   { background: linear-gradient(135deg,#2ecc71,#27ae60); color:#fff; }
.tmr-card__label   { font-size: 12px; opacity: .85; margin-bottom: 6px; }
.tmr-card__value   { font-size: 18px; font-weight: 700; }
.tmr-card__sub     { font-size: 11px; opacity: .8; margin-top: 4px; }

.tmr-rank-progress { margin-bottom: 16px; font-size: 13px; color: #555; }
.tmr-progress-bar  { background: #eee; border-radius: 20px; height: 8px; margin: 8px 0 4px; }
.tmr-progress-fill { background: #c0392b; height: 100%; border-radius: 20px; transition: width .5s; }

.tmr-history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tmr-history-table th { text-align: left; color: #888; font-weight: 500; padding: 6px 0; border-bottom: 1px solid #eee; }
.tmr-history-table td { padding: 7px 0; border-bottom: 1px solid #f5f5f5; color: #444; }

/* Responsive */
@media (max-width: 768px) {
    #tmr-checkout-wrap { grid-template-columns: 1fr; }
    .tmr-form-row--2col { grid-template-columns: 1fr; }
    .tmr-loyalty-cards { grid-template-columns: 1fr; }
    #tmr-checkout-right { order: -1; }
}

/* ===== CUSTOM DROPDOWN — tránh bị Astra override ===== */
.tmr-dropdown {
    position: relative;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
}
.tmr-dropdown__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    cursor: pointer;
    transition: border-color .2s;
    min-height: 40px;
}
.tmr-dropdown__trigger:hover { border-color: #c0392b; }
.tmr-dropdown--open .tmr-dropdown__trigger {
    border-color: #c0392b;
    background: #fff;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.tmr-dropdown--disabled .tmr-dropdown__trigger {
    background: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
    border-color: #e0e0e0;
}
.tmr-dropdown__text { flex: 1; }
.tmr-dropdown__arrow {
    font-size: 11px;
    color: #999;
    transition: transform .2s;
    margin-left: 8px;
}
.tmr-dropdown--open .tmr-dropdown__arrow { transform: rotate(180deg); }

.tmr-dropdown__list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #c0392b;
    border-top: none;
    border-bottom-left-radius: 7px;
    border-bottom-right-radius: 7px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.tmr-dropdown--open .tmr-dropdown__list { display: block; }

.tmr-dropdown__search {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
}
.tmr-dropdown__item {
    padding: 9px 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background .1s;
}
.tmr-dropdown__item:hover { background: #fff5f5; color: #c0392b; }
.tmr-dropdown__item--selected { background: #fff5f5; color: #c0392b; font-weight: 500; }
.tmr-dropdown__loading,
.tmr-dropdown__empty {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: #999;
}

/* ===================================================
   TMR Custom Select — đẹp như Shopee, không bị Astra override
   =================================================== */
.tmr-select-wrap {
    position: relative;
    width: 100%;
}
.tmr-select-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: border-color .15s, box-shadow .15s;
    min-height: 42px;
    user-select: none;
    -webkit-user-select: none;
}
.tmr-select-box:hover {
    border-color: #c0392b;
}
.tmr-select-wrap.tmr-select-open .tmr-select-box {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192,57,43,.1);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.tmr-select-disabled .tmr-select-box {
    background: #f5f5f5;
    color: #bbb;
    cursor: not-allowed;
    border-color: #e8e8e8;
}
.tmr-select-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
}
.tmr-select-value.tmr-placeholder { color: #aaa; }
.tmr-select-arrow {
    flex-shrink: 0;
    margin-left: 8px;
    color: #aaa;
    transition: transform .2s;
}
.tmr-select-open .tmr-select-arrow { transform: rotate(180deg); color: #c0392b; }

/* Dropdown panel */
.tmr-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #c0392b;
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    z-index: 999999;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    overflow: hidden;
}
.tmr-select-open .tmr-select-dropdown { display: block; }

/* Search box */
.tmr-select-search-wrap {
    padding: 8px 10px;
    border-bottom: 1px solid #f5f5f5;
}
.tmr-select-search {
    width: 100% !important;
    padding: 7px 10px !important;
    border: 1px solid #eee !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    color: #333 !important;
    background: #fafafa !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    outline: none !important;
}
.tmr-select-search:focus { border-color: #c0392b !important; background: #fff !important; }

/* Options list */
.tmr-select-options {
    max-height: 200px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.tmr-select-options::-webkit-scrollbar { width: 4px; }
.tmr-select-options::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.tmr-select-option {
    padding: 10px 14px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background .1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tmr-select-option:hover { background: #fff5f5; color: #c0392b; }
.tmr-select-option.active { background: #fff0ee; color: #c0392b; font-weight: 600; }
.tmr-select-option.hidden { display: none; }

.tmr-select-no-result, .tmr-select-loading {
    padding: 14px;
    text-align: center;
    font-size: 13px;
    color: #bbb;
}

/* VAT Invoice Section Premium Styles */
.tmr-vat-section {
    border-left: 4px solid #2ecc71;
    transition: all 0.3s ease;
}
.tmr-vat-tab {
    transition: all 0.2s ease;
    outline: none;
}
.tmr-vat-tab:hover {
    background-color: #f9fbf9 !important;
    border-color: #2ecc71 !important;
}
.tmr-vat-tab--active {
    box-shadow: 0 4px 6px rgba(46, 204, 113, 0.15);
}
.tmr-input-with-button button {
    transition: all 0.2s ease;
}
.tmr-input-with-button button:hover {
    background-color: #2ecc71 !important;
    color: #fff !important;
}
.tmr-vat-inputs .tmr-form-group input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 7px;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    box-sizing: border-box;
    transition: all 0.2s ease;
}
.tmr-vat-inputs .tmr-form-group input:focus {
    border-color: #2ecc71;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}
