/* Base CSS Customizations for Base2026 - Compact Modern CRM Theme */

html {
    font-size: 13.5px; /* Refined compact base font size */
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #334155;
    background-color: #f8fafc;
    -webkit-font-smoothing: antialiased;
}

/* Compact Headings */
h1, .h1 { font-size: 1.25rem !important; font-weight: 700; letter-spacing: -0.2px; }
h2, .h2 { font-size: 1.15rem !important; font-weight: 700; }
h3, .h3 { font-size: 1.05rem !important; font-weight: 600; }
h4, .h4 { font-size: 0.95rem !important; font-weight: 600; }
h5, .h5 { font-size: 0.88rem !important; font-weight: 600; }
h6, .h6 { font-size: 0.82rem !important; font-weight: 600; }

/* Sidebar Custom styling for Desktop and Mobile responsiveness */
#sidebar {
    height: 100vh;
    position: sticky;
    top: 0;
    font-size: 0.82rem;
}

#sidebar .nav-link {
    font-weight: 500;
    border-radius: 5px;
    padding: 0.42rem 0.65rem;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

#sidebar .nav-link:hover {
    background-color: #f1f5f9;
}

#sidebar .nav-link.active {
    background-color: #0d6efd; /* Solid color only, no gradients */
    color: #ffffff !important;
}

#sidebar .nav-link.active i {
    color: #ffffff !important;
}

/* Mobile responsive overlay sidebar */
@media (max-width: 767.98px) {
    #sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        height: 100vh;
        width: 260px !important;
        opacity: 1 !important;
    }
    
    #sidebar.mobile-show {
        left: 0;
    }
}

/* Minimalist Flat Card Design */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background-color: #ffffff;
    overflow: hidden;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
}

.card-body {
    padding: 0.9rem;
}

/* Compact Table Styling across the entire CRM */
.table {
    font-size: 0.82rem;
}

.table th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
    padding: 0.55rem 0.65rem;
    background-color: #f8fafc;
}

.table td {
    padding: 0.55rem 0.65rem;
    vertical-align: middle;
}

/* Badges */
.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.22rem 0.45rem;
    border-radius: 4px;
}

/* Simple Button Styling - Compact */
.btn {
    font-weight: 500;
    font-size: 0.82rem;
    border-radius: 5px;
    padding: 0.35rem 0.75rem;
    box-shadow: none !important;
}

.btn-sm {
    font-size: 0.76rem;
    padding: 0.22rem 0.5rem;
    border-radius: 4px;
}

.btn-lg {
    font-size: 0.9rem;
    padding: 0.45rem 1rem;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Form controls - Compact height */
.form-control, .form-select {
    font-size: 0.83rem;
    padding: 0.32rem 0.65rem;
    border-radius: 5px;
    min-height: 33px;
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #475569;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Tom Select layout correction for clean Bootstrap 5 theme - Compact */
.ts-wrapper {
    padding: 0 !important;
    height: 33px !important;
    min-height: 33px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 5px !important;
    background-color: #fff !important;
    box-shadow: none !important;
}

.ts-wrapper .ts-control {
    height: 38px !important;
    padding: 0 30px 0 12px !important;
    border: none !important;
    background: transparent !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px 12px !important;
    color: #212529 !important;
    display: flex !important;
    align-items: center !important;
    font-size: 0.9rem !important;
    box-shadow: none !important;
}

.ts-wrapper.focus {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Prevent wrapping and show ellipsis */
.ts-wrapper .ts-control .item {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 85% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.ts-wrapper .ts-control input {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    font-size: 0.9rem !important;
}

/* Align dropdown menu */
.ts-dropdown {
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    border-radius: 0.375rem !important;
    z-index: 2000 !important;
}

/* Hide clear button and its vertical separator */
.ts-wrapper .clear-button,
.ts-wrapper .ts-control .item .remove {
    display: none !important;
}
.ts-wrapper.single .ts-control {
    padding-right: 30px !important;
}

/* Sticky First Column (Cột Thao tác đầu tiên) for Tables */
.table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table th,
.table td {
    border-bottom: 1px solid #e2e8f0 !important;
}

.table th:first-child,
.table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background-clip: padding-box; /* Fixes background bleeding over borders */
}

.table th:first-child {
    background-color: #fafafa !important; /* Matches table-light / header theme */
}

.table td:first-child {
    background-color: #ffffff !important;
    box-shadow: 4px 0 8px -4px rgba(0, 0, 0, 0.12); /* Clear separation shadow on right edge */
}

/* Maintain hover effect on the sticky 1st cell */
.table-hover > tbody > tr:hover > td:first-child {
    background-color: #f1f5f9 !important;
}

/* Legacy Sticky Last Column fallback */
.table-sticky-actions th:last-child,
.table-sticky-actions td:last-child {
    position: sticky;
    right: 0;
    z-index: 10;
    background-clip: padding-box;
}

.table-sticky-actions th:last-child {
    background-color: #f8f9fa !important;
}

.table-sticky-actions td:last-child {
    background-color: #ffffff !important;
    box-shadow: -6px 0 10px -6px rgba(0, 0, 0, 0.15);
}

.table-hover > tbody > tr:hover > td:last-child {
    background-color: #f1f5f9 !important;
}

