/* ============================================================
   1. RESET & LAYOUT CHÍNH
   ============================================================ */
:root {
    --ba-primary: #d0021b; /* Màu đỏ chủ đạo */
    --ba-text: #333;       /* Màu chữ */
    --ba-border: #e1e1e1;  /* Màu viền */
    --ba-bg-gray: #f9f9f9; /* Màu nền xám nhẹ */
}

.ba-main-wrapper { 
    background: #fff; 
    padding: 40px 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; 
    color: var(--ba-text); 
    line-height: 1.6;
}

.ba-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 15px; 
    box-sizing: border-box;
}

/* Chia cột: Trái 55% - Phải 40% (Gap 5%) */
.ba-product-layout { 
    display: flex; 
    gap: 40px; 
    margin-bottom: 50px; 
    align-items: flex-start;
}

/* ============================================================
   2. CỘT TRÁI: ẢNH SẢN PHẨM & GALLERY
   ============================================================ */
.ba-gallery { flex: 1; min-width: 0; /* Fix lỗi flex tràn */ }

.ba-main-image { 
    margin-bottom: 15px; 
    border: 1px solid var(--ba-border); 
    border-radius: 8px; 
    overflow: hidden; 
    background: #fff;
}

.ba-main-image img { 
    width: 100%; 
    height: auto; 
    display: block; 
    transition: opacity 0.3s ease; 
}

/* Album ảnh nhỏ */
.ba-thumb-list { 
    display: flex; 
    gap: 10px; 
    overflow-x: auto; 
    padding-bottom: 5px; 
}

.ba-thumb-item { 
    width: 70px; 
    height: 70px; 
    flex-shrink: 0; 
    cursor: pointer; 
    border: 1px solid var(--ba-border); 
    border-radius: 4px; 
    overflow: hidden; 
    transition: all 0.2s; 
    opacity: 0.7;
}

.ba-thumb-item img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.ba-thumb-item:hover, .ba-thumb-item.active { 
    border-color: var(--ba-primary); 
    opacity: 1; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ============================================================
   3. CỘT PHẢI: THÔNG TIN & FORM ĐẤU GIÁ
   ============================================================ */
.ba-summary { flex: 1; min-width: 0; }

.ba-title { 
    font-size: 28px; 
    font-weight: 700; 
    margin: 0 0 10px 0; 
    line-height: 1.3; 
    color: #000; 
}

.ba-meta-info { 
    color: #666; 
    font-size: 14px; 
    margin-bottom: 20px; 
    padding-bottom: 15px;
    border-bottom: 1px solid var(--ba-border);
}

.ba-meta-info strong { color: var(--ba-primary); }

/* Đồng hồ đếm ngược */
.ba-countdown-box {
    background: #fff8e1; /* Vàng nhạt */
    border: 1px solid #ffe58f;
    color: #d48806;
    padding: 15px;
    text-align: center;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}
.ba-timer {
    font-size: 26px;
    font-weight: 700;
    margin-top: 5px;
    color: #333;
    letter-spacing: 1px;
}

/* Box Giá */
.ba-price-wrapper { 
    background: var(--ba-bg-gray); 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 25px; 
    border: 1px solid var(--ba-border); 
}

.ba-label { margin: 0; font-size: 14px; color: #555; }
.ba-price-current { 
    font-size: 34px; 
    color: var(--ba-primary); 
    font-weight: 800; 
    line-height: 1.2; 
    margin: 5px 0 10px 0; 
}
.ba-sub-price { font-size: 13px; color: #888; }

/* Box Hỗ trợ */
.ba-support-box { 
    background: #e6f7ff; 
    padding: 12px; 
    border: 1px dashed #1890ff; 
    margin-bottom: 25px; 
    border-radius: 4px; 
    color: #0050b3; 
    font-size: 14px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

/* ============================================================
   4. FORM NHẬP GIÁ (STYLE PHẲNG, HIỆN ĐẠI)
   ============================================================ */
.ba-bid-action { margin-bottom: 30px; }

/* Flexbox để Input và Nút nằm ngang */
.ba-form-flex { 
    display: flex; 
    gap: 10px; /* Khoảng cách giữa ô nhập và nút */
    align-items: center;
}

/* Wrapper cho ô input (để chứa biểu tượng tiền) */
.ba-input-group { 
    position: relative; 
    flex: 1; /* Chiếm hết chỗ trống */
}

/* Biểu tượng ₫ */
.ba-input-group .currency-symbol {
    position: absolute;
    transform: translateY(-50%);
    font-weight: bold;
    color: #000000;
    font-size: 18px;
    z-index: 2;
    pointer-events: none;
    line-height: 1;
    right: 10px;
    top: calc(50% - 9px);
}

/* Ô nhập liệu */
.ba-input-group input { 
    width: 100%; 
    height: 50px; /* Chiều cao cố định */
    padding: 0 15px 0 35px; /* Padding trái chừa chỗ cho ₫ */
    
    font-size: 18px; 
    font-weight: 600; 
    color: #333;
    
    border: 1px solid #ccc; 
    border-radius: 4px; 
    box-sizing: border-box;
    background: #fff;
    transition: border-color 0.3s;
}

.ba-input-group input:focus {
    outline: none;
    border-color: #333;
}

/* Nút bấm (Màu đen, chữ trắng, phẳng) */
.ba-btn-primary {
    height: 100%;
    background: #000;
    color: #fff;
    border: none;
    padding: 2px 25px;
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.3s;
    margin-right: 0;
}

.ba-btn-primary:hover { 
    background: var(--ba-primary); /* Hover thành màu đỏ */
}

.ba-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Thông báo lỗi/thành công */
.ba-msg { padding: 12px; margin-bottom: 20px; border-radius: 4px; font-weight: 500; font-size: 14px; }
.ba-msg.error { background: #fff2f0; border: 1px solid #ffccc7; color: #d0021b; }
.ba-msg.success { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.ba-closed-box { background: #eee; padding: 15px; text-align: center; font-weight: bold; color: #888; border-radius: 4px; }

/* ============================================================
   5. LỊCH SỬ ĐẤU GIÁ & POPUP MODAL
   ============================================================ */

/* Widget Lịch sử */
.ba-history-widget {
    background: #fff;
    border: 1px solid var(--ba-border);
    border-radius: 8px;
    margin-top: 30px;
    overflow: hidden;
}

.ba-history-header {
    background: #f8f8f8;
    padding: 12px 15px;
    border-bottom: 1px solid var(--ba-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ba-history-title {
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    color: #555;
}

.ba-view-all-link {
    font-size: 13px;
    color: #0073aa;
    text-decoration: none;
    cursor: pointer;
}
.ba-view-all-link:hover { text-decoration: underline; }

.ba-history-list { list-style: none; margin: 0; padding: 0; }

.ba-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.ba-history-item:last-child { border-bottom: none; }
.ba-history-item.top-bid { background: #fffbfb; } /* Top 1 hơi hồng nhẹ */

.ba-his-user { font-weight: 600; color: #333; }
.ba-his-price { font-weight: 700; color: var(--ba-primary); }
.ba-his-time { display: block; font-size: 12px; color: #999; margin-top: 3px; }

/* --- MODAL (POPUP) --- */
.ba-modal {
    display: none; 
    position: fixed; 
    z-index: 99999; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.6); /* Nền tối mờ */
    backdrop-filter: blur(2px); /* Hiệu ứng mờ nền sau */
}

.ba-modal-content {
    background-color: #fff;
    margin: 5% auto; /* Cách trên 5% */
    padding: 0;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

/* Header Modal */
.ba-modal-content h3 {
    margin: 0;
    padding: 15px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    color: #333;
}

/* Body Modal (Scroll) */
.ba-modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Nút đóng Modal */
.ba-close-modal {
    position: absolute;
    right: 15px; 
    top: 12px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}
.ba-close-modal:hover { color: #000; }

/* Bảng trong Modal */
.ba-table-history { width: 100%; border-collapse: collapse; font-size: 14px; }
.ba-table-history th { 
    text-align: left; 
    padding: 12px; 
    background: #f2f2f2; 
    border-bottom: 2px solid #ddd; 
    color: #333; font-weight: 600;
}
.ba-table-history td { 
    padding: 12px; 
    border-bottom: 1px solid #eee; 
    color: #444;
}

/* ============================================================
   6. TAB MÔ TẢ & MOBILE
   ============================================================ */
.ba-content-tabs { margin-top: 20px; }
.tab-title { 
    border-bottom: 2px solid #000; 
    display: inline-block; 
    padding-bottom: 8px; 
    margin-bottom: 20px; 
    text-transform: uppercase; 
    font-size: 18px; 
    font-weight: 700; 
    color: #000;
}
.ba-content-body { line-height: 1.8; font-size: 16px; color: #333; }
.ba-content-body img { max-width: 100%; height: auto; }

/* ============================================================
   7. AUTHENTICATION FORM (LOGIN/REGISTER)
   ============================================================ */
.ba-auth-wrapper {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* Tabs */
.ba-auth-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f5f5f5;
}
.ba-tab-item {
    flex: 1;
    text-align: center;
    padding: 15px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    transition: 0.2s;
}
.ba-tab-item:hover { background: #eee; }
.ba-tab-item.active {
    background: #fff;
    color: #000;
    border-bottom: 2px solid #d0021b; /* Gạch chân đỏ */
}

/* Form Body */
.ba-auth-form { padding: 20px; }

.ba-field { margin-bottom: 15px; }
.ba-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #444; }
.ba-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

/* 2 cột trên 1 hàng */
.ba-field-row { display: flex; gap: 10px; }
.ba-field-row .ba-field { flex: 1; }

/* Checkbox */
.ba-field-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}
.ba-field-checkbox input { width: auto; }

/* ============================================================
   8. AUTH BUTTONS & MODAL STYLES
   ============================================================ */

/* Khu vực nút kích hoạt */
.ba-auth-triggers {
    background: #f9f9f9;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    text-align: center;
}

.ba-trigger-row {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.ba-btn-auth {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
}

.ba-btn-auth.login {
    background: #fff;
    border: 2px solid #000;
    color: #000;
}
.ba-btn-auth.login:hover { background: #f0f0f0; }

.ba-btn-auth.register {
    background: #000;
    border: 2px solid #000;
    color: #fff;
}
.ba-btn-auth.register:hover { background: #333; border-color: #333; }

/* Modal Auth Riêng (Gọn hơn modal lịch sử) */
.ba-auth-modal-content {
    max-width: 650px !important; /* Nhỏ gọn hơn */
    padding: 0 !important;      /* Reset padding để Tabs sát lề */
    overflow: hidden;
}

.ba-auth-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Fix lại style Tabs cho đẹp trong modal */
.ba-auth-tabs {
    background: #f1f1f1;
    border-bottom: 1px solid #ddd;
}
.ba-tab-item { padding: 15px 0; }

/* ============================================================
   9. PRO GRID VIEW 
   ============================================================ */

.ba-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin: 40px 0;
}
@media (max-width: 992px) { .ba-grid-container { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .ba-grid-container { grid-template-columns: 1fr; } }

/* Card Style */
.ba-pro-card {
    background: #fff;
    border: 2px solid #000; /* Viền đen đậm như ảnh */
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}

.ba-pro-card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transform: translateY(-5px);
}

/* Ảnh */
.ba-pro-thumb {
    position: relative;
    padding-top: 80%; /* Tỷ lệ ảnh gần vuông */
    overflow: hidden;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.ba-pro-thumb img {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%; 
    max-height: 90%;
    object-fit: contain;
}

/* Đồng hồ Overlay (Góc trên phải) */
.ba-overlay-countdown {
    position: absolute;
    top: 10px; 
    right: 10px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 5;
}

.digit-box {
    text-align: center;
    min-width: 18px;
}
.digit-box span {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    font-family: monospace; /* Font số điện tử */
}
.digit-box small {
    display: block;
    font-size: 7px;
    opacity: 0.7;
    margin-top: 2px;
    text-transform: uppercase;
}
.sep {
    font-size: 12px;
    font-weight: bold;
    margin-top: -8px; /* Căn chỉnh dấu : lên trên chút */
}

/* Body */
.ba-pro-body {
    padding: 15px 20px 20px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ba-pro-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px;
    color: #000;
}
.ba-pro-title a { color: #000; text-decoration: none; }
.ba-pro-title a:hover { color: #d0021b; }

.ba-pro-price {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
}
.ba-pro-price strong {
    color: #d0021b; /* Giá màu đỏ */
    font-size: 18px;
    font-weight: 800;
}

.ba-pro-days {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #000;
}

/* Nút Đỏ To */
.ba-pro-btn {
    display: block;
    background: #df0000; /* Đỏ rực */
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 12px 0;
    border-radius: 6px;
    text-decoration: none;
    transition: 0.2s;
    width: 100%;
}
.ba-pro-btn:hover {
    background: #b00000;
    color: #fff;
}
/* ============================================================
   10. SINGLE PAGE COUNTDOWN (HEADER)
   ============================================================ */

/* Khung bao quanh Tiêu đề và Đồng hồ */
.ba-header-flex {
    display: flex;
    justify-content: space-between; /* Đẩy sang 2 bên */
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

/* Phần bên trái (Tiêu đề + Meta) */
.ba-header-left {
    flex: 1; /* Chiếm phần lớn diện tích */
}

/* Đồng hồ số (Giao diện Digital) */
.ba-single-countdown {
    color: #d0021b;
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Courier New', Courier, monospace;
    border: 1px solid #000000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Ẩn đi nếu hết giờ */
.ba-single-countdown[style*="display: none"] {
    display: none !important;
}

/* Các chữ số bên trong */
.ba-single-countdown .digit-box { text-align: center; line-height: 1; min-width: 24px; }
.ba-single-countdown .digit-box span { display: block; font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.ba-single-countdown .digit-box small {
    display: block;
    font-size: 0.7rem;
    opacity: 1;
    margin-top: 3px;
    color: #ad0000;
    font-weight: 600;
}
.ba-single-countdown .sep { font-size: 20px; font-weight: bold; margin-top: -12px; color: #d0021b; }

/* Responsive: Mobile xuống dòng */
@media (max-width: 600px) {
    .ba-header-flex { flex-direction: column; }
    .ba-single-countdown { width: 100%; justify-content: center; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ba-product-layout { flex-direction: column; gap: 30px; }
    
    .ba-form-flex { flex-direction: column; align-items: stretch; }
    .ba-btn-primary { width: 100%; }
    
    .ba-title { font-size: 24px; }
    .ba-price-current { font-size: 28px; }
}