/* =========================================================================
   SỬA LỖI NÚT XEM ẢNH TOOLTIP (Áp dụng chung PC & Mobile)
   ========================================================================= */
#fastad-builder-container .color-swatch-node {
    position: relative !important;
}

/* Ép tooltip nổi hẳn lên trên tất cả các khối khác (như chọn kích thước, vật liệu) */
#fastad-builder-container .mat-tooltip {
    z-index: 99999 !important; 
    pointer-events: auto !important; /* Mở khóa cho phép click chuột/chạm */
}

/* Đảm bảo nút Xem ảnh xanh dương bắt được sự kiện click */
#fastad-builder-container .mat-tooltip-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 100000 !important;
}




#fastad-builder-container { display: flex; flex-wrap: wrap; gap: 24px; color: #333; margin: 20px 0; width: 100%; font-family: inherit; }
#fastad-builder-container * { box-sizing: border-box; font-family: inherit; }
.fastad-panel-left { flex: 3; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); min-width:320px; }
.fastad-panel-right { flex: 4; display: flex; flex-direction: column; gap: 20px; min-width:320px; }
.fastad-section-title { font-size: 18px; font-weight: 700; color: #1e293b; margin-bottom: 20px; text-transform: uppercase; text-align: center; }
.fastad-field-group { margin-bottom: 20px; }
.fastad-label { display: flex; align-items: center; font-size: 14px; font-weight: 700; color: #334155; margin-bottom: 8px; }

.fastad-material-tabs { display: flex; border: 1px solid #cbd5e1; border-radius: 6px; overflow: hidden; }
.material-tab-btn { flex: 1; text-align: center; padding: 10px; font-size: 13.5px; font-weight: 700; background: #f8fafc; color: #64748b; cursor: pointer; transition: all 0.2s; }
.material-tab-btn.active { background: #ff9900; color: #ffffff; }

.fastad-color-swatches-wrapper { display: flex; align-items: center; gap: 12px; }
.swatches-hint { font-size: 12px; font-weight: 600; color: #64748b; min-width:75px;}
#dynamic-swatches-container { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch-node { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #e2e8f0; cursor: pointer; transition: transform 0.15s; box-shadow: inset 0 0 3px rgba(0,0,0,0.1); position:relative; }
.color-swatch-node:hover { transform: scale(1.1); }
.color-swatch-node.active { border-color: #ff0000; transform: scale(1.1); }
.color-swatch-node[data-name]:hover::after { content: attr(data-name); position:absolute; bottom:110%; left:50%; transform:translateX(-50%); background:#333; color:#fff; font-size:10px; padding:2px 6px; border-radius:4px; white-space:nowrap; z-index:10; }

/* --- ĐOẠN CSS CHUNG CHO NÚT KÍCH THƯỚC TRÊN DESKTOP (PC) --- */
.fastad-size-grid-horizontal { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
    width: 100%; 
}

.fastad-size-row-btn { 
    display: flex; 
    flex-direction: row !important; /* Ép nội dung chữ và số tiền nằm trên 1 dòng */
    justify-content: center !important; 
    align-items: center !important; 
    gap: 6px !important; /* Khoảng cách giữa kích thước và giá tiền */
    border: 2px solid #e2e8f0; 
    border-radius: 6px; 
    padding: 10px 12px; 
    background: #fff; 
    cursor: pointer; 
    transition: all 0.2s; 
}

/* Tự động chèn dấu gạch đứng phân tách giữa kích thước và giá tiền */
.fastad-size-row-btn .size-lbl::after {
    content: " |";
    color: #cbd5e1;
    margin-left: 4px;
}

/* Các trạng thái hover và active giữ nguyên logic cũ */
.fastad-size-row-btn:hover { 
    border-color: #cbd5e1; 
    background: #f8fafc; 
}
.fastad-size-row-btn.active { 
    border-color: #ff9900; 
    background: #fffaf0; 
}
.fastad-size-row-btn .size-lbl { 
    font-weight: 700; 
    font-size: 13px; 
    color: #1e293b; 
}
.fastad-size-row-btn .price-lbl { 
    font-weight: 700; 
    font-size: 12.5px; 
    color: #ef4444; 
}

.fastad-input-color-row { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; width: 100%; }
.fastad-input { flex: 1; height: 40px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 18px; color: #1e293b; font-family: inherit; }
.fastad-input:focus { outline: none; border-color: #ff9900; }
textarea.fastad-input { line-height: 1.4; }

.fastad-line-color { width: 38px; height: 38px; border: 1px solid #cbd5e1; border-radius: 50%; cursor: pointer; background: #fff; padding:0; overflow:hidden; flex-shrink:0; }
.fastad-line-color::-webkit-color-swatch { border: none; border-radius: 50%; }
.fastad-line-color::-moz-color-swatch { border: none; border-radius: 50%; }

.fastad-row-grid { display: flex; gap: 8px; width: 100%; margin-bottom: 10px; align-items: flex-start; }
.fastad-radio-item { font-size:13px; color:#111;}
.fastad-radio-item input { margin-right:6px;}

.fastad-options-container { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 5px; }
.fastad-toggle-row { display: flex; align-items: center; justify-content: space-between; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 16px; margin-bottom: 0; height: 100%; }
.fastad-toggle-row .toggle-info { display: flex; flex-direction: column; }
.fastad-toggle-row .t-title { font-size: 13.5px; font-weight: 700; color: #1e293b; }
.fastad-toggle-row .t-desc { font-size: 11px; color: #64748b; }
.fastad-toggle-row .toggle-actions { display: flex; align-items: center; gap: 12px; }
.fastad-line-color-sm { width: 28px; height: 28px; border: 1px solid #cbd5e1; border-radius: 4px; padding: 0; cursor: pointer; }

.hw-selection { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); /* Ép chia 3 cột bằng nhau tuyệt đối */
    gap: 10px; 
    margin-top: 10px; 
}


.hw-card:hover { border-color: #cbd5e1; background: #f8fafc;}
.hw-card.active { border-color: #ff9900; background: #fffaf0; }
.hw-card input { display: none; }
.hw-radio-circle { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cbd5e1; margin-top: 2px; position: relative; flex-shrink:0; background:#fff;}
.hw-card.active .hw-radio-circle { border-color: #ff9900; }
.hw-card.active .hw-radio-circle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 8px; height: 8px; background: #ff9900; border-radius: 50%; }
.hw-content { display: flex; flex-direction: column; }
.hw-title { font-size: 12px; font-weight: 700; color: #1e293b; margin-bottom: 4px; line-height:1.2;}
.hw-desc { font-size: 10.5px; color: #ef4444; line-height:1.2;}

.fastad-preview-box, .fastad-pricing-box { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.fastad-preview-title { font-size: 16px; font-weight: 700; color: #111; margin-bottom: 14px; text-transform: uppercase; display: flex; align-items: center; }
.fastad-canvas-container { width: 100%; display: flex; justify-content: center; align-items: center; min-height: 280px; padding:20px; }

.fastad-canvas { width: 100%; max-width: 450px; border-radius: 3px; padding: 8px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 15px 35px rgba(0,0,0,0.15); border: 1px solid rgba(0,0,0,0.05); background-size: cover; background-position: 50% 50%; transition: aspect-ratio 0.3s; position: relative; overflow: hidden; container-type: inline-size; }

.drill-hole { width: 6px; height: 6px; border-radius: 50%; background: #e2e8f0; box-shadow: inset 0 2px 4px rgba(0,0,0,0.6), 0 1px 1px rgba(255,255,255,0.4); position: absolute; display: none; z-index: 10; }
.drill-hole.hole-visible { display: block; }
.hole-tl { top: 12px; left: 12px; }
.hole-tr { top: 12px; right: 12px; }
.hole-bl { bottom: 12px; left: 12px; }
.hole-br { bottom: 12px; right: 12px; }

#canvas-inner-border { border: 1.5px solid transparent; height: 100%; width: 100%; padding: 8px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; text-align: center; z-index: 2; position: relative;}
#canvas-inner-border.canvas-border-on { border-color: var(--border-color, #ffffff); }

.canvas-text-wrapper { display: inline-flex; flex-direction: column; align-items: center; max-width: 100%; margin: 2px 0; }
.canvas-sep-line { width: 100%; height: 2px; margin: 4px 0; display: none; opacity: 0.8; }
.canvas-sep-line.canvas-line-visible { display: block; }

.p-line-top { font-size: clamp(10px, 3.5cqw, 14px); font-weight: 600; text-transform: uppercase; text-align: center; }
.p-line-main-1 { font-size: clamp(14px, 5cqw, 19px); font-weight: 700; margin-top: 1cqw; text-transform: uppercase; text-align: center; }
.p-line-main-2 { font-size: clamp(20px, 8cqw, 32px); font-weight: 800; text-transform: uppercase; text-align: center; line-height: 1.1; }
.p-line-mst { font-size: clamp(10px, 3.5cqw, 13px); font-weight: 700; text-align: center; margin-bottom: 1cqw; }
.p-line-footer, .contact-line { font-size: clamp(10px, 3.2cqw, 14px); font-weight: 500; line-height: 1.3; text-align: center; }
.p-line-footer { margin-top: 2px; }
.p-line-contact-wrap { width: 100%; margin-top: 2cqw; }
.contact-phone { text-align: center; margin-bottom: 3px; }
.contact-ew { width: 100%; display: flex; justify-content: space-between; padding: 0 5%; box-sizing: border-box; }

.canvas-dimension-wrapper { width: 100%; text-align: center; margin-bottom: 10px; }
.canvas-dimension-label { font-size:11px; font-weight:700; color:#fff; background:#1e293b; padding:6px 16px; border-radius:20px; display:inline-flex; align-items:center; letter-spacing:0.5px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.canvas-note { font-size: 11px; color: #000000; text-align: center; font-style: italic; margin-bottom: 0px; }

.fastad-delivery-tabs-3, .fastad-radio-cards-3 { display: flex; gap: 8px;}
.delivery-btn-3, .radio-card-3 { flex: 1; text-align: center; padding: 10px 5px; font-size: 12px; font-weight: 700; color: #475569; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.delivery-btn-3:hover, .radio-card-3:hover { background: #f8fafc; }
.delivery-btn-3.active, .radio-card-3.active { background: #1e293b; color: #fff; border-color: #1e293b; }
.radio-card-3 input { display:none; }

.shipping-note-box { font-size:11.5px; color:#ef4444; line-height:1.4; background:#fff1f2; padding:10px; border-radius:6px; border:1px dashed #fca5a5; }
.shipping-note-box p { margin:0 0 6px 0; }
.shipping-note-box p:last-child { margin:0; }

.fastad-table-calc { width: 100%; border-collapse: collapse; }
.fastad-table-calc td { padding: 9px 0; font-size: 13.5px; color: #111; vertical-align: middle; }
.vat-subtext { display: block; font-size: 11.5px; color: #ef4444; font-weight: normal; margin-top: 2px; }
.text-right { text-align: right; }
.font-medium { font-weight: 700; color: #111; }

.fastad-qty-spinner { display: inline-flex; align-items: center; justify-content: space-between; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; padding: 2px; height: 38px; width: 120px; box-sizing: border-box; overflow:hidden;}
.qty-btn { width: 34px; height: 34px; background: #f8fafc; border: 1px solid transparent; border-radius: 4px; font-size: 18px; line-height: 1; color: #334155; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition:all 0.2s; z-index:2;}
.qty-btn:hover { background: #e2e8f0; color: #0f172a; }
#fastad-qty-input { flex: 1; height: 34px; border: none; text-align: center; font-size: 15px; font-weight: 700; color: #0f172a !important; background: transparent; padding: 0; margin: 0; outline: none; -moz-appearance: textfield; min-width:30px; opacity:1 !important; display:block !important;}
#fastad-qty-input::-webkit-outer-spin-button, #fastad-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.fastad-switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.fastad-switch input { opacity: 0; width: 0; height: 0; }
.fastad-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .3s; border-radius: 20px; }
.fastad-slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
.fastad-switch input:checked + .fastad-slider { background-color: #10b981; }
.fastad-switch input:checked + .fastad-slider:before { transform: translateX(20px); }
.fastad-divider { height: 1px; background: #e2e8f0; margin: 15px 0; }

.fastad-summary-rows { font-size: 14.5px; color: #1e293b; display: flex; flex-direction: column; gap: 3px; font-weight:500;}
.fastad-summary-rows .s-row { display: flex; justify-content: space-between; }
.fastad-total-row { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 15px; color: #111; padding-top:15px; margin-top: 10px; border-top:1px dashed #cbd5e1; }
.total-large { font-size: 24px; color: #ef4444; }

.fastad-actions { display: flex; gap: 12px; margin-top: 20px; }
.fastad-btn { flex: 1; height: 48px; border: none; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.1s; }
.fastad-btn:active { transform: scale(0.98); }
.fastad-btn-primary { background: #ef4444 !important; color: #fff !important; }
.fastad-btn-primary:hover { background: #dc2626 !important; }

#fastad-pdf-modal { display:none; position:fixed; z-index:999999; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.85); }
.modal-content { width: 800px; max-width: 95%; margin: 2vh auto; background: #fff; height: 90vh; display: flex; flex-direction: column; border-radius: 8px; }
.modal-header { padding: 15px; background: #1e293b; color: #fff; display: flex; justify-content: space-between; border-radius: 8px 8px 0 0; }
.modal-body { flex: 1; padding: 0; background: #525659; }

.fastad-brushed-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1; 
    background-image: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0.04) 1px,
        rgba(255, 255, 255, 0.05) 2px,
        rgba(0, 0, 0, 0) 3px
    );
}

.fastad-support-note { font-size: 13px; color: #64748b; text-align: center; margin-top: 5px; line-height: 1.5; font-style: italic; }
.fastad-support-actions { display: flex; gap: 12px; margin-top: 12px; }
.fastad-btn-support { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 8px; font-size: 14.5px; font-weight: 700; text-decoration: none !important; transition: transform 0.1s, opacity 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.fastad-btn-support:active { transform: scale(0.97); }
.fastad-btn-support:hover { opacity: 0.9; }

.btn-phone { background: #111; color: #fff !important; }
.btn-zalo { background: #0068ff; color: #fff !important; }

.stc-control-group input[type="text"] { padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
#stc-wrapper { width: fit-content; max-width: 100%; }

#fastad-quote-app h3, #fastad-quote-app .summary-title { border-bottom: none !important; padding-bottom: 0 !important; margin-bottom: 10px !important; }
#fastad-quote-app div:has(#fastad-vat-toggle), #fastad-quote-app .vat-toggle-container, #fastad-quote-app .form-group { border-bottom: none !important; box-shadow: none !important; margin-bottom: 0 !important; padding-bottom: 0 !important; }
#fastad-quote-app table, #fastad-quote-app table *, #fastad-quote-app tr, #fastad-quote-app td, #fastad-quote-app th, .fastad-table-calc, .fastad-table-calc td { border: none !important; border-top: none !important; border-bottom: none !important; box-shadow: none !important; }
#fastad-quote-app table, #fastad-quote-app .fastad-summary-block { margin-top: 12px !important; }
#fastad-quote-app table td { padding-top: 3px !important; padding-bottom: 3px !important; line-height: 1.4 !important; }
#fastad-quote-app div:has(#fastad-vat-toggle), #fastad-quote-app .vat-toggle-container, #fastad-quote-app .form-group:has(#fastad-vat-toggle) { margin-bottom: 0px !important; padding-bottom: 0px !important; }
#fastad-quote-app #vat-info-form { margin: 0 !important; padding: 0 !important; }
#fastad-quote-app div:has(#fastad-vat-toggle) + p, #fastad-quote-app .vat-toggle-container + p { display: none !important; margin: 0 !important; padding: 0 !important; }
#fastad-quote-app table.fastad-table-calc, #fastad-quote-app .fastad-summary-block, #fastad-quote-app table { margin-top: 12px !important; }

#fastad-builder-container *:has(> input[type="color"]) br { display: none !important; }
#fastad-builder-container *:has(> input[type="color"]):not(:has(input[type="checkbox"])) { position: relative !important; display: block !important; width: 100% !important; margin-bottom: 15px !important; }
#fastad-builder-container *:has(> input[type="color"]):not(:has(input[type="checkbox"])) > input:not([type="color"]), #fastad-builder-container *:has(> input[type="color"]):not(:has(input[type="checkbox"])) > textarea { width: 100% !important; max-width: 100% !important; padding-right: 50px !important; margin: 0 !important; box-sizing: border-box !important; }
#fastad-builder-container *:has(> input[type="color"]):not(:has(input[type="checkbox"])) > input[type="color"] { position: absolute !important; right: 10px !important; top: 50% !important; transform: translateY(-50%) !important; margin: 0 !important; z-index: 10 !important; }

#fastad-builder-container div:has(> input[type="color"]):has(input[type="checkbox"]) { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; width: 100% !important; }
#fastad-builder-container div:has(> input[type="color"]):has(input[type="checkbox"]) > *:first-child { flex: 1 1 auto !important; margin-right: auto !important; min-width: 0 !important; }
#fastad-builder-container div:has(> input[type="color"]):has(input[type="checkbox"]) > input[type="color"] { flex: 0 0 32px !important; margin-left: auto !important; margin-right: 15px !important; }

#fastad-builder-container input[type="color"] { display: inline-block !important; width: 32px !important; height: 32px !important; min-width: 32px !important; max-width: 32px !important; min-height: 32px !important; max-height: 32px !important; padding: 0 !important; border: 1px solid #cbd5e1 !important; border-radius: 50% !important; cursor: pointer !important; background-color: transparent !important; box-sizing: border-box !important; -webkit-appearance: none !important; appearance: none !important; }
#fastad-builder-container input[type="color"]::-webkit-color-swatch-wrapper { padding: 0 !important; }
#fastad-builder-container input[type="color"]::-webkit-color-swatch { border: none !important; border-radius: 50% !important; }
/* Đổi màu nền nút Color Picker thành Gradient Vàng - Xanh tinh tế */
#fastad-builder-container input[type="color"][value="#ffffff" i], 
#fastad-builder-container input[type="color"][value="#fff" i] { 
    background: linear-gradient(135deg, #fde047 0%, #22c55e 100%) !important; 
}
#fastad-builder-container input[type="color"][value="#ffffff" i]::-webkit-color-swatch, #fastad-builder-container input[type="color"][value="#fff" i]::-webkit-color-swatch { background-color: transparent !important; }

#fastad-builder-container .color-swatch-node { position: relative !important; }
#fastad-builder-container .mat-tooltip { position: absolute !important; bottom: 120% !important; left: 50% !important; transform: translateX(-50%) translateY(10px) !important; background: #fff !important; border: 2px solid #e2e8f0 !important; border-radius: 8px !important; box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important; opacity: 0 !important; visibility: hidden !important; transition: all 0.2s ease !important; z-index: 999 !important; pointer-events: none !important; overflow: hidden !important; width: 110px !important; height: auto !important; padding: 5px !important; display: flex !important; flex-direction: column !important; gap: 5px !important; box-sizing: border-box !important; }
#fastad-builder-container .mat-tooltip img { width: 100% !important; height: 100px !important; object-fit: cover !important; border-radius: 4px !important; }

/* 1. Chỉ cho phép hiệu ứng hover hoạt động trên máy tính (có chuột) */
@media (hover: hover) {
    #fastad-builder-container .color-swatch-node:hover .mat-tooltip { 
        opacity: 1 !important; visibility: visible !important; transform: translateX(-50%) translateY(0) !important; pointer-events: auto !important; 
    }
}

/* 2. Trên Mobile: Tooltip sẽ hiện ra thông qua class này do JS cấp phát */
#fastad-builder-container .color-swatch-node.show-tooltip-mobile .mat-tooltip {
    opacity: 1 !important; visibility: visible !important; transform: translateX(-50%) translateY(0) !important; pointer-events: auto !important; 
}

#fastad-builder-container .mat-tooltip::after { content: '' !important; position: absolute !important; bottom: -6px !important; left: 50% !important; transform: translateX(-50%) rotate(45deg) !important; width: 10px !important; height: 10px !important; background: #fff !important; border-right: 2px solid #e2e8f0 !important; border-bottom: 2px solid #e2e8f0 !important; }

.mat-popup-overlay { position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; background: rgba(15, 23, 42, 0.8) !important; backdrop-filter: blur(4px) !important; z-index: 99999 !important; display: flex !important; align-items: center !important; justify-content: center !important; opacity: 0; visibility: hidden; transition: all 0.3s ease !important; }
.mat-popup-overlay.active { opacity: 1 !important; visibility: visible !important; }
.mat-popup-content { position: relative !important; width: 500px !important; height: 500px !important; max-width: 90vw !important; max-height: 90vw !important; background: #fff !important; padding: 10px !important; border-radius: 16px !important; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important; transform: scale(0.9) !important; transition: all 0.3s ease !important; }
.mat-popup-overlay.active .mat-popup-content { transform: scale(1) !important; }
.mat-popup-content img { width: 100% !important; height: 100% !important; object-fit: cover !important; border-radius: 8px !important; }
.mat-popup-close { position: absolute !important; top: -15px !important; right: -15px !important; width: 36px !important; height: 36px !important; background: #ef4444 !important; color: #fff !important; font-size: 18px !important; font-weight: bold !important; border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important; cursor: pointer !important; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4) !important; transition: background 0.2s !important; }
.mat-popup-close:hover { background: #dc2626 !important; }

#fastad-builder-container .mat-tooltip-btn { background: #3b82f6 !important; color: #ffffff !important; font-size: 11px !important; font-weight: 700 !important; text-align: center !important; padding: 5px 0 !important; border-radius: 4px !important; cursor: pointer !important; width: 100% !important; }
#fastad-builder-container .mat-tooltip-name { font-size: 11px !important; font-weight: 700 !important; color: #1e293b !important; text-align: center !important; width: 100% !important; border-bottom: 1px solid #e2e8f0 !important; padding-bottom: 4px !important; margin-bottom: 2px !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }

.mobile-only, .mobile-only-flex { display: none !important; }










/* =========================================================================
   🚨 TOÀN BỘ KHỐI CODE MOBILE APP HOÀN CHỈNH (@media max-width: 768px)
   ========================================================================= */
@media (max-width: 768px) {
    /* Khung cha bọc ngoài hệ thống - Ép margin/padding về 0 để chống cộng dồn khoảng trắng */
    #fastad-builder-container {
        flex-direction: column !important;
        position: relative !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important; 
        overflow: visible !important;
        gap: 0 !important;
    }

    /* Đưa vùng Bảng vẽ Preview lên tháp trên và ghim dính khi cuộn (Sticky) */
    .fastad-panel-right {
        order: -1 !important;
        width: 100% !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 999 !important;
        background: #ffffff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        padding: 10px 15px !important;
        margin: 0 !important;
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05) !important;
    }

    .fastad-preview-box {
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    /* Đặc trị ép ẩn tuyệt đối hai nút đen và các nhãn kích thước thừa trên Mobile */
    #fastad-builder-container .fastad-panel-right .fastad-preview-box > div:first-child,
    #fastad-builder-container .fastad-panel-right .fastad-preview-title-wrap,
    #fastad-builder-container .fastad-panel-right .canvas-dimension-wrapper, 
    #fastad-builder-container .fastad-panel-right .canvas-note,
    #fastad-builder-container .fastad-panel-right *[style*="text-align:center"] .canvas-dimension-label,
    #fastad-builder-container .fastad-panel-right *[style*="text-align: center"] .canvas-dimension-label { 
        display: none !important; 
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

   

    /* Panel nhập liệu cuộn tự do phía dưới */
    #fastad-builder-container .fastad-panel-left {
        order: 2 !important;
        width: 100% !important;
        background: #ffffff !important;
        padding: 15px 15px 80px 15px !important; /* Gộp padding: Bù đúng 65px cho Footer + 15px lề */
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }
    
    /* VẮT KIỆT MỌI KHOẢNG TRỐNG THỪA CỦA CÁC THẺ BỌC Ở ĐÁY FORM */
    #fastad-builder-container #fastad-inputs-panel,
    #fastad-builder-container #mobile-delivery-vat-hook,
    #fastad-builder-container #fastad-delivery-vat-block {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    #fastad-builder-container #fastad-delivery-vat-block > div:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Ẩn bảng hạch toán tĩnh của bản Desktop */
    #desktop-pricing-container { 
        display: none !important; 
    }

    /* Chia khối kích thước thành lưới 2 cột */
    .fastad-size-grid-horizontal { 
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 8px !important; 
        width: 100% !important;
    }
    .fastad-size-row-btn { 
        padding: 10px 8px !important; 
        flex-direction: row !important; 
        justify-content: center !important;
        align-items: center !important;
        gap: 4px !important; 
        box-sizing: border-box !important;
    }
    .fastad-size-row-btn .size-lbl { font-size: 12px !important; font-weight: 700 !important; }
    .fastad-size-row-btn .size-lbl::after { content: " |"; color: #cbd5e1; margin-left: 2px; }
    .fastad-size-row-btn .price-lbl { font-size: 12px !important; font-weight: 700 !important; }

    /* Co nhỏ tabs vật liệu */
    #fastad-builder-container .fastad-material-tabs { margin-bottom: 8px !important; }
    #fastad-builder-container .material-tab-btn { padding: 6px 4px !important; font-size: 12px !important; }

    /* Ẩn chữ và căn giữa ô màu */
    #fastad-builder-container .fastad-color-swatches-wrapper .swatches-hint { display: none !important; }
    #fastad-builder-container .fastad-color-swatches-wrapper { width: 100% !important; justify-content: center !important; align-items: center !important; margin: 4px 0 10px 0 !important; }
    #fastad-builder-container #dynamic-swatches-container { justify-content: center !important; gap: 10px !important; }

    /* Lựa chọn thẻ phụ & Hình thức thi công (Ép 1 dòng trên Mobile) */
    .fastad-options-container { grid-template-columns: 1fr !important; gap: 8px !important; }
    .hw-selection { grid-template-columns: 1fr !important; gap: 6px !important; }
    .hw-card { padding: 10px 12px !important; }
    
    #fastad-builder-container .hw-content {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        margin-left: 8px !important;
    }
    #fastad-builder-container .hw-title {
        font-size: 13px !important;
        margin-bottom: 0 !important;
        white-space: nowrap !important;
    }
    /* Tự động chèn dấu gạch đứng phân tách */
    #fastad-builder-container .hw-title::after {
        content: " |" !important;
        color: #cbd5e1 !important;
        margin: 0 6px !important;
        font-weight: normal !important;
    }
    #fastad-builder-container .hw-desc {
        font-size: 12px !important;
        margin-top: 0 !important;
        white-space: nowrap !important;
    }

    /* -----------------------------------------------------------------
       🔥 CẤU TRÚC FOOTER 5 CỘT DẠNG NATIVE APP TRÊN MOBILE
       ----------------------------------------------------------------- */
    .mobile-only-flex {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 65px !important; 
        background: #ffffff !important; 
        border-top: 1px solid #e2e8f0 !important; 
        z-index: 999999 !important;
        padding: 0 4px !important;
        align-items: center !important;
        justify-content: space-between !important;
        box-shadow: 0 -5px 15px rgba(0,0,0,0.06) !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .fastad-bottom-sticky-bar .fastad-footer-col {
        flex: 1 !important; 
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        min-width: 0 !important;
    }

    .f-col-label {
        font-size: 10px !important;
        color: #64748b !important;
        font-weight: 600 !important;
        margin-bottom: 2px !important;
        white-space: nowrap !important;
    }
    
    .f-col-value {
        font-size: 11px !important;
        color: #334155 !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
    }

    .fastad-bottom-sticky-bar .fastad-bottom-info-trigger {
        flex: 1.6 !important; 
        align-items: center !important;
        justify-content: center !important;
        padding: 0 4px !important;
        cursor: pointer !important;
    }
    
    .fastad-bottom-sticky-bar .fastad-bottom-actions {
        flex: 1.4 !important;
        padding: 0 4px !important;
    }

    .fastad-bottom-sticky-bar .fastad-main-action-btn {
        background: #f97316 !important; 
        color: #ffffff !important;
        border: none !important;
        width: 100% !important;
        height: 40px !important;
        font-weight: 800 !important;
        border-radius: 50px !important; 
        font-size: 10.5px !important;
        text-transform: uppercase !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important; 
        box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3) !important;
        padding: 0 8px !important;
        cursor: pointer !important;
    }

    /* -----------------------------------------------------------------
       🔥 GIAO DIỆN POPUP HẠCH TOÁN ĐỘNG TRÊN MOBILE
       ----------------------------------------------------------------- */
    .fastad-calculation-popup-overlay { 
        position: fixed !important; 
        top: 0 !important; left: 0 !important; 
        width: 100vw !important; height: 100vh !important; 
        background: rgba(15, 23, 42, 0.5) !important; 
        backdrop-filter: blur(2px) !important;
        z-index: 999998 !important; 
    }
    .fastad-calculation-popup-content { 
        position: fixed !important; 
        bottom: 0 !important; left: 0 !important; 
        width: 100% !important; 
        background: #ffffff !important; 
        border-top: 3px solid #1e293b !important; 
        border-radius: 16px 16px 0 0 !important; 
        padding: 20px 20px 85px 20px !important; 
        box-shadow: 0 -10px 30px rgba(0,0,0,0.15) !important; 
        z-index: 999999 !important; 
        box-sizing: border-box !important; 
    }
    .fastad-popup-header-bar { 
        display: flex !important; 
        justify-content: space-between !important; 
        align-items: center !important;
        font-weight: 800 !important; 
        font-size: 14.5px !important; 
        color: #1e293b !important;
        border-bottom: 1px solid #f1f5f9 !important; 
        padding-bottom: 12px !important; 
        margin-bottom: 15px !important; 
    }
    .fastad-popup-close-trigger { cursor: pointer !important; color: #94a3b8 !important; font-size: 18px !important; padding: 0 5px; }
}

/* =========================================================================
   VŨ KHÍ HẠT NHÂN: TIÊU DIỆT KHOẢNG TRẮNG ẢO DO WORDPRESS TỰ SINH RA
   ========================================================================= */
@media (max-width: 768px) {
    /* 1. Tiêu diệt toàn bộ thẻ <p> rỗng và <br> tàng hình ở đáy form */
    #fastad-builder-container .fastad-panel-left > p,
    #fastad-builder-container .fastad-panel-left > br,
    #fastad-builder-container #fastad-inputs-panel > p,
    #fastad-builder-container #fastad-inputs-panel > br,
    #fastad-builder-container #mobile-delivery-vat-hook > p,
    #fastad-builder-container #mobile-delivery-vat-hook > br {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 2. Ép xóa khoảng cách nội tuyến (inline style) của chính dòng VAT */
    body #fastad-builder-container #fastad-delivery-vat-block > div:last-of-type {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    /* 3. Khóa chặt đáy của khung trắng, chỉ chừa đúng 20px cho đẹp */
    body #fastad-builder-container .fastad-panel-left {
        padding-bottom: 20px !important;
        margin-bottom: 0 !important;
    }
}

/* =========================================================================
   NÂNG CẤP POPUP DẠNG FLOATING CARD & HIỆU ỨNG ANIMATION (MOBILE)
   ========================================================================= */
@media (max-width: 768px) {
    /* 1. Hiệu ứng nhấp nhô cho mũi tên Tổng cộng */
    @keyframes fastadBounceUp {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-4px); }
    }
    .fastad-bounce-icon {
        display: inline-block !important;
        animation: fastadBounceUp 1.5s infinite ease-in-out !important;
        color: #f97316 !important; /* Đổi màu cam cho nổi bật */
        font-size: 13px !important;
    }

    /* 2. Thiết kế lại Nút X (Đóng) - Dạng tròn, xám nhạt hiện đại */
    .fastad-popup-close-trigger { 
        background: #f1f5f9 !important;
        color: #64748b !important;
        width: 30px !important;
        height: 30px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 16px !important; 
        font-weight: 900 !important;
        cursor: pointer !important; 
        transition: all 0.2s !important;
        padding: 0 !important;
    }
    .fastad-popup-close-trigger:active {
        background: #e2e8f0 !important;
        transform: scale(0.9) !important;
    }

    /* 3. Popup dạng Floating Card (Cách đều 2 bên và nằm ngay trên Footer) */
    body .fastad-calculation-popup-content { 
        position: fixed !important; 
        /* Cách đáy 75px (Bao gồm 65px của Footer + 10px khoảng hở) */
        bottom: 75px !important; 
        /* Cách 2 bên viền 10px */
        left: 10px !important; 
        width: calc(100% - 20px) !important; 
        background: #ffffff !important; 
        border-top: 3px solid #1e293b !important; 
        border-radius: 16px !important; /* Bo tròn đều 4 góc */
        padding: 20px !important; /* Trả padding về chuẩn, không cần độn đáy nữa */
        box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important; 
        z-index: 999999 !important; 
        box-sizing: border-box !important; 
    }
}

/* =========================================================================
   NÂNG CẤP POPUP DẠNG FLOATING CARD ĐỘNG (FLEXBOX + DVH TRỊ SAFARI)
   ========================================================================= */
@media (max-width: 768px) {
    /* 1. Hiệu ứng nhấp nhô cho mũi tên Tổng cộng */
    @keyframes fastadBounceUp {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-4px); }
    }
    .fastad-bounce-icon {
        display: inline-block !important;
        animation: fastadBounceUp 1.5s infinite ease-in-out !important;
        color: #f97316 !important; 
        font-size: 13px !important;
    }

    /* 2. Thiết kế lại Nút X (Đóng) */
    .fastad-popup-close-trigger { 
        background: #f1f5f9 !important;
        color: #64748b !important;
        width: 30px !important;
        height: 30px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 16px !important; 
        font-weight: 900 !important;
        cursor: pointer !important; 
        transition: all 0.2s !important;
        padding: 0 !important;
    }
    .fastad-popup-close-trigger:active {
        background: #e2e8f0 !important;
        transform: scale(0.9) !important;
    }

    /* 3. THAY ĐỔI CHIẾN THUẬT: Dùng màng bọc Overlay làm khung tham chiếu động */
    body .fastad-calculation-popup-overlay {
        position: fixed !important; 
        top: 0 !important; 
        left: 0 !important; 
        width: 100% !important; 
        /* Khung ngoài tự động co giãn 100% theo trình duyệt Safari */
        height: 100dvh !important; 
        background: rgba(15, 23, 42, 0.5) !important; 
        backdrop-filter: blur(2px) !important;
        z-index: 999998 !important; 
        display: flex !important;
        flex-direction: column !important;
        /* Ép thẻ Popup rớt xuống đáy màn hình */
        justify-content: flex-end !important; 
        align-items: center !important;
        /* Chừa đúng 75px ở đáy cho thanh Footer và lề */
        padding: 0 10px calc(75px + env(safe-area-inset-bottom)) 10px !important; 
        box-sizing: border-box !important;
    }

    /* 4. Thẻ Popup: Nằm ngoan ngoãn trong Overlay, không dùng Fixed nữa */
    body .fastad-calculation-popup-content { 
        position: relative !important; 
        bottom: auto !important; /* Hủy lệnh gắn đáy cứng */
        left: auto !important;
        width: 100% !important; 
        /* Tự giới hạn chiều cao không vượt quá Overlay */
        max-height: 100% !important; 
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important; 
        border-top: 3px solid #1e293b !important; 
        border-radius: 16px !important; 
        padding: 20px 20px 15px 20px !important; 
        box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important; 
        box-sizing: border-box !important; 
    }

    /* 5. Lõi cuộn bên trong Popup */
    body #mobile-calc-details-hook {
        max-height: none !important;
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        padding-bottom: 5px !important;
    }

    /* 6. Dọn dẹp tàn dư các khối tàng hình cũ */
    body #mobile-calc-details-hook::after,
    body #mobile-calc-details-hook > div:last-child {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* =========================================================================
   ĐẶC TRỊ LỖI KHÔNG ĐÓNG ĐƯỢC POPUP (VÀ HỖ TRỢ ĐÓNG KHI BẤM RA NGOÀI)
   ========================================================================= */
@media (max-width: 768px) {
    /* Mở đường cho lệnh ẩn Popup của hệ thống hoạt động */
    body .fastad-calculation-popup-overlay[style*="display: none"],
    body .fastad-calculation-popup-overlay[style*="display:none"] {
        display: none !important;
    }
}

/* =========================================================================
   ĐẶC TRỊ LỖI RỚT DÒNG MỤC ĐƯỜNG KẺ & VIỀN TRANG TRÍ (MOBILE)
   ========================================================================= */
@media (max-width: 768px) {
    /* 1. Ép toàn bộ khung nằm trên 1 hàng ngang, cấm rớt dòng */
    body #fastad-builder-container .fastad-toggle-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 12px !important;
        flex-wrap: nowrap !important;
    }

    /* 2. Trả lại không gian cho phần chứa chữ (Giãn ra chiếm hết chỗ trống) */
    body #fastad-builder-container .fastad-toggle-row .toggle-info {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        flex: 1 !important; 
        min-width: 0 !important; 
    }

    /* 3. Tinh chỉnh chữ cho đẹp, thẳng hàng */
    body #fastad-builder-container .fastad-toggle-row .t-title {
        font-size: 13px !important;
        white-space: nowrap !important;
    }
    body #fastad-builder-container .fastad-toggle-row .t-desc {
        font-size: 11.5px !important;
        white-space: nowrap !important;
    }

    /* 4. CHÌA KHÓA: Ép cục chứa nút gạt thu nhỏ lại đúng kích thước thật, không phình to 100% nữa */
    body #fastad-builder-container .fastad-toggle-row .toggle-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 10px !important;
        width: auto !important; /* Ghi đè lệnh width 100% gây lỗi */
        flex: 0 0 auto !important;
        margin: 0 !important;
    }
}




/* =========================================================================
   ĐỒNG BỘ BẢNG VẼ PC SANG MOBILE (KẾT HỢP XÓA LỆNH JS GÂY LỖI)
   ========================================================================= */
@media (max-width: 768px) {
    /* 1. Khung bọc ngoài: Chỉ làm nhiệm vụ căn giữa bảng vẽ */
    body #fastad-builder-container .fastad-canvas-container {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        padding: 10px 0 20px 0 !important;
        box-sizing: border-box !important;
    }

    /* 2. Bảng vẽ: Kế thừa 100% tính chất của PC, chỉ giới hạn độ to tối đa */
    body #fastad-builder-container .fastad-canvas {
        display: flex !important;
        width: 100% !important;
        max-width: 360px !important; /* Ép không cho tràn màn hình điện thoại */
        margin: 0 auto !important;
        /* Hủy mọi rào cản, để JS tự động bơm tỷ lệ và chiều cao vào */
        min-height: unset !important;
        max-height: unset !important;
    }
}

/* =========================================================================
   TỐI ƯU KHÔNG GIAN CHO TỶ LỆ DẸT (50x30) TRÊN MOBILE
   ========================================================================= */
@media (max-width: 768px) {
    /* 1. Ép giảm padding của bảng vẽ và khung viền để lấy thêm không gian chiều cao */
    body #fastad-builder-container .fastad-canvas {
        padding: 5px !important; /* Mặc định PC là 8px */
    }
    body #fastad-builder-container #canvas-inner-border {
        padding: 5px !important; /* Mặc định PC là 8px */
    }
    
    /* 2. Tinh chỉnh lại tỷ lệ chữ và thu gọn khoảng cách các dòng */
    body #fastad-builder-container .p-line-top { font-size: clamp(9px, 3.2cqw, 13px) !important; }
    body #fastad-builder-container .p-line-main-1 { font-size: clamp(12px, 4.5cqw, 17px) !important; margin-top: 0.5cqw !important; }
    body #fastad-builder-container .p-line-main-2 { font-size: clamp(18px, 7.5cqw, 28px) !important; line-height: 1 !important; }
    body #fastad-builder-container .p-line-mst { font-size: clamp(9px, 3.2cqw, 12px) !important; margin-bottom: 0.5cqw !important; }
    body #fastad-builder-container .p-line-footer, 
    body #fastad-builder-container .contact-line { font-size: clamp(9px, 3cqw, 13px) !important; }
    body #fastad-builder-container .p-line-contact-wrap { margin-top: 1cqw !important; } /* Thu từ 2cqw xuống 1cqw */
}

/* =========================================================================
   ĐẶC TRỊ LỖI IOS TỰ NHẬN DIỆN SỐ ĐIỆN THOẠI/MÃ SỐ THUẾ LÀM SAI MÀU
   ========================================================================= */
body #fastad-builder-container .fastad-canvas a,
body #fastad-builder-container .fastad-canvas a[href^="tel"],
body #fastad-builder-container .fastad-canvas *[x-apple-data-detectors] {
    color: inherit !important; /* Ép nhận màu do khách hàng tự chọn */
    text-decoration: none !important; /* Xóa gạch chân mặc định của link */
    pointer-events: none !important; /* Vô hiệu hóa tính năng bấm gọi trong bảng vẽ */
}


/* =========================================================================
   HIỂN THỊ ĐƯỜNG KẺ KÍCH THƯỚC (THƯỚC ĐO) BAO QUANH CANVAS
   ========================================================================= */
/* 1. Lớp vỏ bọc để chứa Canvas và Thước đo (Nó sẽ gánh max-width thay cho Canvas) */
body #fastad-builder-container .fastad-measure-wrapper {
    position: relative !important;
    width: 100% !important;
    max-width: 450px !important; /* Chuẩn Desktop */
    margin: 0 auto !important;
    display: block !important;
}

/* 2. Ép Canvas nở to 100% theo lớp vỏ bọc */
body #fastad-builder-container .fastad-canvas {
    max-width: 100% !important; 
    margin: 0 !important;
}

/* 3. Tăng padding cho khung bọc ngoài cùng để thước đo không bị lẹm viền */
body #fastad-builder-container .fastad-canvas-container {
    padding: 35px 20px 25px 35px !important; 
}

/* 4. Định dạng chung cho thước đo */
.fastad-measure-line {
    position: absolute !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10 !important;
    pointer-events: none !important;
}
.fastad-measure-line .m-line {
    position: absolute !important;
    background: #475569 !important; /* Màu xám đậm tĩnh tế */
    z-index: -1 !important;
}
.fastad-measure-line .m-val {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

/* Thước ngang (Phía trên) */
.fastad-measure-line.top {
    top: -20px !important;
    left: 0 !important;
    width: 100% !important;
    height: 8px !important;
    border-left: 1px solid #475569 !important;
    border-right: 1px solid #475569 !important;
}
.fastad-measure-line.top .m-line {
    top: 4px !important; left: 0 !important; width: 100% !important; height: 1px !important;
}
.fastad-measure-line.top .m-val { padding: 0 8px !important; }

/* Thước dọc (Bên trái) */
.fastad-measure-line.left {
    top: 0 !important;
    left: -20px !important;
    height: 100% !important;
    width: 8px !important;
    border-top: 1px solid #475569 !important;
    border-bottom: 1px solid #475569 !important;
}
.fastad-measure-line.left .m-line {
    left: 4px !important; top: 0 !important; height: 100% !important; width: 1px !important;
}
.fastad-measure-line.left .m-val {
    padding: 8px 0 !important; 
    writing-mode: vertical-rl !important; /* Xoay chữ dọc */
    transform: rotate(180deg) !important; 
}

/* 5. Ép lại max-width cho lớp vỏ trên Mobile */
@media (max-width: 768px) {
    body #fastad-builder-container .fastad-measure-wrapper {
        max-width: 360px !important; /* Chuẩn Mobile */
    }
}






/* =========================================================================
   VIỀN KHUYẾT GÓC VẬT LÝ - CHỐNG LỖI HTML2CANVAS 100%
   ========================================================================= */
/* 1. Xóa bỏ hoàn toàn lớp ảnh ảo cũ */
body #fastad-builder-container #canvas-inner-border {
    border: none !important;
    background-image: none !important;
    position: relative !important;
}

/* 2. Khung chứa hệ thống viền vật lý mới */
body #fastad-builder-container #fastad-border-layer {
    display: none;
    position: absolute !important;
    top: 0 !important; 
    left: 0 !important;
    width: 100% !important; 
    height: 100% !important;
    overflow: hidden !important; /* Lệnh cực kỳ quan trọng: Giấu đi phần thừa của vòng tròn */
    pointer-events: none !important; /* Cho phép bấm chuột xuyên qua */
    z-index: 1 !important;
}

/* Bật khung viền này lên khi khách chọn Bật Viền */
body #fastad-builder-container #canvas-inner-border.canvas-border-on #fastad-border-layer {
    display: block !important;
}

/* 3. Bốn cạnh thẳng (Dùng số nguyên 2px để chống mờ viền & lấn góc 1px) */
body #fastad-builder-container .fastad-b-line {
    position: absolute !important;
    background-color: var(--border-color, #ffffff) !important;
}
body #fastad-builder-container .fastad-b-line.top { top: 0; left: 11px; right: 11px; height: 2px; }
body #fastad-builder-container .fastad-b-line.bottom { bottom: 0; left: 11px; right: 11px; height: 2px; }
body #fastad-builder-container .fastad-b-line.left { top: 11px; bottom: 11px; left: 0; width: 2px; }
body #fastad-builder-container .fastad-b-line.right { top: 11px; bottom: 11px; right: 0; width: 2px; }

/* 4. Bốn góc khuyết (Vòng tròn bo góc - Dùng viền 2px chuẩn) */
body #fastad-builder-container .fastad-b-arc {
    position: absolute !important;
    width: 24px !important; 
    height: 24px !important;
    border-radius: 50% !important;
    border: 2px solid var(--border-color, #ffffff) !important;
    box-sizing: border-box !important;
    background: transparent !important;
}
body #fastad-builder-container .fastad-b-arc.tl { top: -12px; left: -12px; }
body #fastad-builder-container .fastad-b-arc.tr { top: -12px; right: -12px; }
body #fastad-builder-container .fastad-b-arc.bl { bottom: -12px; left: -12px; }
body #fastad-builder-container .fastad-b-arc.br { bottom: -12px; right: -12px; }













/* =========================================================================
   TINH CHỈNH LỖ KHOAN VÍT: NHỎ HƠN 30% & THỤT VÀO TRONG AN TOÀN
   ========================================================================= */
/* Thu nhỏ kích thước lỗ vít (Giảm từ 6px xuống 4.2px) */
body #fastad-builder-container .drill-hole {
    width: 5px !important;
    height: 5px !important;
    /* Giữ nguyên hiệu ứng 3D cho ốc vít thêm chân thực */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.7), 0 1px 1px rgba(255,255,255,0.4) !important;
}

/* Dịch chuyển ốc vít thụt vào trong (cách lề 10px) để nằm ngoan trên nền Mica */
body #fastad-builder-container .hole-tl { top: 7px !important; left: 7px !important; }
body #fastad-builder-container .hole-tr { top: 7px !important; right: 7px !important; }
body #fastad-builder-container .hole-bl { bottom: 7px !important; left: 7px !important; }
body #fastad-builder-container .hole-br { bottom: 7px !important; right: 7px !important; }

/* =========================================================================
   CHỐNG ZOOM MÀN HÌNH KHI BẤM VÀO Ô ĐỊA CHỈ & MÃ GIẢM GIÁ (IOS SAFARI)
   ========================================================================= */
@media (max-width: 768px) {
    /* Trị ô nhập Địa chỉ (textarea) và bất kỳ textarea nào khác bị sót */
    body #fastad-builder-container textarea,
    body #fastad-builder-container textarea.fastad-input {
        font-size: 16px !important;
    }
    
    /* Trị ô nhập Mã giảm giá (Nằm trong Popup Mobile động và khung PC) */
    body #fastad-calc-popup input[type="text"],
    body #fastad-calc-popup #m-fastad-coupon-code,
    body #fastad-builder-container #fastad-coupon-code {
        font-size: 16px !important;
    }
}

/* =========================================================================
   HIỂN THỊ LẠI DÒNG GHI CHÚ DƯỚI BẢNG VẼ TRÊN MOBILE
   ========================================================================= */
@media (max-width: 768px) {
    body #fastad-builder-container .fastad-panel-right .canvas-note {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        margin-top: 1px !important;
        margin-bottom: 1px !important;
        font-size: 11px !important;
        color: #000000!important;
        font-style: italic !important;
        text-align: center !important;
        line-height: 1.4 !important;
    }
}

/* =========================================================================
   ẨN VĨNH VIỄN KHUNG GHI CHÚ GIAO HÀNG (VIỀN ĐỎ NÉT ĐỨT)
   ========================================================================= */
body #fastad-builder-container .shipping-note-box {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* =========================================================================
   THU NHỎ KÍCH THƯỚC CHỮ MẪU (PLACEHOLDER) GIẢM KHOẢNG 30%
   ========================================================================= */
body #fastad-builder-container input[type="text"]::placeholder,
body #fastad-builder-container textarea::placeholder,
body #fastad-builder-container .fastad-input::placeholder {
    /* Dùng tỷ lệ 75% (nhỏ hơn 25-30% so với chữ thực tế) để nó tự động co giãn 
       chuẩn xác trên cả màn hình PC (13px) và Mobile (16px) */
    font-size: 75% !important; 
    
    /* (Tùy chọn) Làm chữ mỏng lại một chút để trông tinh tế hơn */
    font-weight: 400 !important;
    
    /* Làm mờ nhẹ chữ mẫu để khách dễ phân biệt với chữ thật */
    opacity: 0.7 !important; 
}

/* Hỗ trợ thêm cho các trình duyệt cũ */
body #fastad-builder-container input[type="text"]::-webkit-input-placeholder,
body #fastad-builder-container textarea::-webkit-input-placeholder {
    font-size: 85% !important; 
    font-weight: 400 !important;
    opacity: 0.7 !important; 
}

/* =========================================================================
   HIỂN THỊ NÚT HỖ TRỢ (GỌI/ZALO) DƯỚI CÙNG TRÊN MOBILE
   ========================================================================= */
/* Ẩn bản sao này trên màn hình PC (vì PC đã có bản gốc) */
@media (min-width: 769px) {
    body #fastad-builder-container .mobile-support-clone { 
        display: none !important; 
    }
}

/* Hiển thị chuẩn trên màn hình Điện thoại */
@media (max-width: 768px) {
    body #fastad-builder-container .mobile-support-clone { 
        display: block !important; 
        margin-top: 15px !important; 
        padding-top: 15px !important; 
        border-top: 1px dashed #cbd5e1 !important; 
        margin-bottom: 20px !important;
    }
}




/* =======================================================
   MASTER CSS: GIAO DIỆN BẢNG VẼ TỐI ƯU (PC & MOBILE)
   ======================================================= */

/* 1. Nền & Chữ Ghi chú (Canvas Note) */
.fastad-preview-box {
    position: relative;
    overflow: hidden;
    background-color: #ffffff;
    padding: 20px 10px;
    margin-bottom: 0 !important;
}

.fastad-preview-box .canvas-note {
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 12px;
    border-radius: 6px;
    display: block !important;
    width: fit-content;
    margin: 15px auto 5px auto !important; /* Căn giữa tuyệt đối */
    text-align: center;
    color: #000000;
    font-weight: 500;
}

/* 2. Tiêu diệt thẻ thừa & Cứu thẻ ngắt dòng (BR) cho địa chỉ */
#fastad-builder-container p.wp-block-paragraph,
#fastad-builder-container p:empty {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
}

/* Ép thẻ ngắt dòng hoạt động trong mục địa chỉ */
#fastad-builder-container #out-address br {
    display: block !important;
    height: auto !important;
    visibility: visible !important;
}

/* 3. Tối ưu Mobile (Co giãn linh hoạt & Fix khoảng trắng) */
@media (max-width: 768px) {
    /* Khối bảng vẽ co giãn sát tỷ lệ, không giữ khoảng trống */
    #fastad-builder-container .fastad-panel-right,
    #fastad-builder-container .fastad-preview-box,
    #fastad-builder-container .fastad-canvas-container {
        height: auto !important;
        min-height: 0 !important;
        flex: 0 0 auto !important;
        padding: 5px !important;
    }

    /* Chữ ghi chú trên mobile: Màu đen, dễ đọc, căn giữa */
    .fastad-preview-box .canvas-note {
        color: #000000 !important;
        width: 92% !important;
        margin: 10px auto 5px auto !important;
        text-align: center !important;
        font-size: 11.5px !important;
        line-height: 1.4 !important;
    }

    /* Ép sát khối form nhập liệu vào bảng vẽ */
    #fastad-builder-container { gap: 0 !important; }
    .fastad-panel-left { padding-top: 15px !important; margin-top: 0 !important; }
}

/* 4. Đồng bộ kích thước 3 nút Thi công */
.hw-selection { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 10px; 
    margin-top: 10px; 
}

.hw-card { 
    border: 2px solid #e2e8f0; 
    border-radius: 8px; 
    padding: 10px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    background: #fff;
    width: 100%; 
    height: 100%; 
    box-sizing: border-box;

}







/* =======================================================
   STYLE TAG "PHỔ BIẾN" (CHỮ TRÊN PC - NGÔI SAO TRÊN MOBILE)
   ======================================================= */
#fastad-size-grid {
    padding-top: 12px;
}

.fastad-size-row-btn {
    position: relative;
}

/* Khung bọc ngoài bám kịch mép */
.fastad-popular-tag {
    position: absolute;
    top: -1px;
    right: -1px;
    z-index: 5;
    pointer-events: none;
}

/* 1. HIỂN THỊ CHỮ "PHỔ BIẾN" TRÊN MÁY TÍNH (PC) */
.fastad-popular-tag .pop-text {
    background-color: #22c55e;
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    padding: 4px 7px;
    border-radius: 0 8px 0 6px;
    text-transform: uppercase;
    box-shadow: -1px 1px 3px rgba(34, 197, 94, 0.2);
    letter-spacing: 0.5px;
    display: block;
}

/* Ẩn ngôi sao trên PC */
.fastad-popular-tag .pop-star {
    display: none; 
}

/* 2. ĐỔI SANG ICON "NGÔI SAO XANH" TRÊN ĐIỆN THOẠI (MOBILE) */
@media (max-width: 768px) {
    .fastad-popular-tag {
        top: -10px;
        right: -10px;
    }
    
    /* Ẩn chữ trên Mobile */
    .fastad-popular-tag .pop-text {
        display: none !important; 
    }
    
    /* Hiện ngôi sao trên Mobile */
    .fastad-popular-tag .pop-star {
        display: block !important;
        width: 25px;
        height: 25px;
        filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
    }
}