/* ==========================================================================
   HppCRM / E-Commerce Standard Form & Grid Styles (hpp-form.css)
   Reusable UI Components: Top Action Bar, Fieldsets, Grid Table, Excel Drag,
   Toolbar Buttons, and Responsive Layouts.
   ========================================================================== */

/* 1. Iframe Modal View Cleanups */
html.in-iframe .page-header,
html.in-iframe .page-header-inner,
html.in-iframe .page-sidebar-wrapper,
html.in-iframe .page-sidebar,
html.in-iframe .mobile_menu,
html.in-iframe .page-footer,
html.in-iframe .page-breadcrumb,
html.in-iframe .page-bar,
html.in-iframe .breadcrumb,
html.in-iframe header,
html.in-iframe nav.navbar {
    display: none !important;
}
html.in-iframe .page-content-wrapper {
    margin-left: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    width: 100% !important;
}
html.in-iframe .page-content {
    padding: 10px 16px !important;
    margin: 0 !important;
    background: #f8fafc !important;
    min-height: auto !important;
}
html.in-iframe body {
    padding-top: 0 !important;
    background: #f8fafc !important;
}

/* 2. Top Action Bar (Flat Header & Circular Hpp-Action Buttons) */
.hpp-top-bar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 16px;
    margin: -10px -16px 14px -16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: -10px;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.hpp-btn-circle-group {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.hpp-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}
.hpp-btn-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    padding: 0;
}
.hpp-btn-circle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.18);
    color: #ffffff;
}
.hpp-action-label {
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
    color: #334155;
    white-space: nowrap;
    text-align: center;
    line-height: 1;
}
.hpp-btn-circle.btn-sync { background: #0066ff; }
.hpp-btn-circle.btn-vacom { background: #7c3aed; }
.hpp-btn-circle.btn-map { background: #00b4d8; }
.hpp-btn-circle.btn-save { background: #10b981; }
.hpp-btn-circle.btn-close-popup { background: #e2e8f0; color: #475569; box-shadow: none; }
.hpp-btn-circle.btn-close-popup:hover { background: #cbd5e1; color: #1e293b; }

/* 3. Cards & Fieldset Layout */
fieldset.tts-fieldset {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px;
    padding: 6px 14px 10px 14px !important;
    margin-bottom: 10px;
    background: #ffffff;
}
legend.tts-legend {
    float: none !important;
    width: auto !important;
    padding: 0 8px !important;
    margin-bottom: 6px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #334155 !important;
    border-bottom: none !important;
}
.tts-card {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.tts-card-header {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    padding: 8px 14px;
}
.tts-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin: 0;
}

/* 4. Horizontal Form Groups */
.form-group-horizontal {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.form-group-horizontal:last-child {
    margin-bottom: 0;
}
.form-label-horizontal {
    width: 105px;
    min-width: 105px;
    font-size: 12px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 0;
    margin-right: 8px;
    white-space: nowrap;
}
.form-control-sm-custom {
    height: 30px;
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 5px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
}
.form-control-sm-custom:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.form-control-sm-custom[readonly] {
    background-color: #ffffff;
    color: #334155;
    border-color: #e2e8f0;
}

/* 5. Navigation Tabs */
.tts-tab-nav {
    border-bottom: 1px solid #cbd5e1;
    margin-bottom: 0;
    background: #ffffff;
    padding: 0 14px;
}
.tts-tab-nav .nav-link {
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 14px;
    cursor: pointer;
}
.tts-tab-nav .nav-link.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: transparent;
}
.tts-tab-nav .badge {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 6px;
}

/* 6. Grid Table & Khít Lề Inputs */
.sku-edit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    border: 1px solid #cbd5e1;
}
.sku-edit-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    padding: 7px 8px;
    border: 1px solid #cbd5e1;
    white-space: nowrap;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 800;
    box-shadow: inset 0 -1px 0 #cbd5e1;
}
.sku-edit-table td {
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid #cbd5e1;
    vertical-align: middle;
    background: #ffffff;
    position: relative;
    height: 34px;
}
.sku-edit-table td.static-cell {
    padding: 4px 8px !important;
}
.sku-edit-table tr:hover td {
    background-color: #f8fafc;
}

.grid-input {
    display: block !important;
    border: none !important;
    outline: none !important;
    background: transparent;
    width: 100% !important;
    height: 100% !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 4px 8px !important;
    font-size: 12px;
    color: #1e293b;
    box-shadow: none !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
}
.grid-input:focus {
    background: #ffffff !important;
    box-shadow: inset 0 0 0 2px #2563eb !important;
}
.grid-select {
    display: block !important;
    border: none !important;
    outline: none !important;
    background: transparent;
    width: 100% !important;
    height: 100% !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 3px 6px !important;
    font-size: 12px;
    color: #1e293b;
    box-shadow: none !important;
    cursor: pointer;
    border-radius: 0 !important;
    box-sizing: border-box !important;
}
.grid-select:focus {
    background: #ffffff !important;
    box-shadow: inset 0 0 0 2px #2563eb !important;
}

/* 7. Excel Drag Fill Handle Dot */
.excel-fill-handle {
    display: none;
    position: absolute;
    width: 7px;
    height: 7px;
    background-color: #2563eb;
    border: 1px solid #ffffff;
    cursor: crosshair;
    z-index: 1000;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
}
td.fill-highlight {
    background-color: #e0f2fe !important;
    outline: 1px dashed #0284c7 !important;
}
.user-select-none {
    user-select: none !important;
    -webkit-user-select: none !important;
}
.sku-img-thumb {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
}

/* 8. Table Toolbar Action Buttons Style */
.tbl-tool-btn {
    height: 30px;
    min-width: 30px;
    padding: 3px 10px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    background: #ffffff;
    cursor: pointer;
    margin-right: 4px;
}
.tbl-tool-btn:last-child {
    margin-right: 0;
}
.tbl-tool-btn-add {
    border: 1px solid #10b981 !important;
    color: #10b981 !important;
}
.tbl-tool-btn-add:hover {
    background: #10b981 !important;
    color: #ffffff !important;
}
.tbl-tool-btn-delete {
    border: 1px solid #ef4444 !important;
    color: #ef4444 !important;
}
.tbl-tool-btn-delete:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}
.tbl-tool-btn-move {
    border: 1px solid #2563eb !important;
    color: #2563eb !important;
}
.tbl-tool-btn-move:hover {
    background: #2563eb !important;
    color: #ffffff !important;
}
.tbl-tool-btn-excel {
    border: 1px solid #059669 !important;
    color: #059669 !important;
}
.tbl-tool-btn-excel:hover {
    background: #059669 !important;
    color: #ffffff !important;
}
.tbl-tool-search {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    overflow: hidden;
}
.tbl-tool-search input {
    border: none !important;
    outline: none !important;
    font-size: 12px;
    box-shadow: none !important;
}
.tbl-tool-search button {
    border: none !important;
    background: #f1f5f9;
    color: #475569;
    border-left: 1px solid #cbd5e1 !important;
    padding: 2px 8px;
}

/* 9. Floating Popover Dropdown */
.base-product-popover {
    position: absolute;
    z-index: 1050;
    background: #ffffff;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.18);
    width: 550px;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}
.base-product-popover table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.base-product-popover th {
    background: #e2e8f0;
    color: #1e293b;
    padding: 6px 10px;
    position: sticky;
    top: 0;
    z-index: 2;
}
.base-product-popover td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}
.base-product-popover tr:hover td {
    background: #e0f2fe !important;
    color: #0369a1;
}

/* 10. Modal Popup Frame Rộng Hết Màn Hình (Full Width Modal Frame ~96vw & 94vh) */
#tiktok_shop_modal .modal-dialog,
#formview_modal .modal-dialog,
#baohanh_modal .modal-dialog,
#hpp_crm_modal.modal-fullscreen-iframe .modal-dialog,
.modal:has(iframe) .modal-dialog {
    max-width: 96vw !important;
    width: 96vw !important;
    height: 94vh !important;
    margin: 15px auto !important;
}

#tiktok_shop_modal .modal-content,
#formview_modal .modal-content,
#baohanh_modal .modal-content,
#hpp_crm_modal.modal-fullscreen-iframe .modal-content,
.modal:has(iframe) .modal-content {
    height: 100% !important;
    max-height: 94vh !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    border: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

#tiktok_shop_modal .modal-body,
#formview_modal .modal-body,
#baohanh_modal .modal-body,
#hpp_crm_modal.modal-fullscreen-iframe .modal-body,
.modal:has(iframe) .modal-body {
    height: 100% !important;
    max-height: 100% !important;
    padding: 0 !important;
    overflow: hidden !important;
}

#tiktok_shop_modal iframe,
#formview_modal iframe,
#baohanh_modal iframe,
#hpp_crm_modal.modal-fullscreen-iframe iframe,
#tts-popup-iframe,
.modal:has(iframe) iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: calc(94vh - 10px) !important;
    border: none !important;
    display: block !important;
}

/* 11. Cột Tên sản phẩm Giới hạn Rộng tối đa 350px */
.column-product-name,
td.column-product-name,
th.column-product-name,
.product-name-cell {
    max-width: 350px !important;
    width: 350px;
    white-space: normal !important;
    word-break: break-word !important;
}

/* 12. Resizable Columns (Kéo thả thay đổi độ rộng cột DataTable) */
.dataTable th,
.sku-edit-table th {
    position: relative !important;
}

.table-resizer-handle {
    position: absolute;
    top: 0;
    right: -2px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 20;
}

.table-resizer-handle:hover,
.table-resizer-handle.is-resizing {
    background-color: #2563eb;
    opacity: 0.8;
}


