/* Modern Contacts Table Styling */

/* ── Full-height flex chain — only activates on pages that have .contacts-table-container ── */
#scrollable-container:has(.page-container) {
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
}
#scrollable-container:has(.page-container) > .content {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    padding-top: 8px !important;
    padding-bottom: 0 !important;
}
#scrollable-container:has(.page-container) > footer {
    flex-shrink: 0 !important;
    padding: 3px 15px !important;
}
#scrollable-container:has(.page-container) .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
}
#scrollable-container:has(.page-container) .users-page-top {
    flex-shrink: 0 !important;
}
#scrollable-container:has(.page-container) #filters_section {
    flex-shrink: 0 !important;
}

.contacts-table-container {
    background: #f8fafc;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 10px;
}

/* Full-height flex chain — only when inside a full-height list page */
#scrollable-container:has(.page-container) .contacts-table-container {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#scrollable-container:has(.page-container) .contacts-table-wrapper,
#scrollable-container:has(.page-container) .dataTables_wrapper {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

#scrollable-container:has(.page-container) .ct-table-wrap {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#scrollable-container:has(.page-container) .ct-table-wrap::-webkit-scrollbar {
    display: none;
}

/* Horizontal scroll for tables outside the full-height context (e.g. contact detail tabs) */
.ct-table-wrap {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.ct-table-wrap::-webkit-scrollbar {
    display: none;
}

/* Empty-state message — centered vertically */
#scrollable-container:has(.page-container) .ct-table-wrap .contacts-table {
    height: 100%;
}
.contacts-table tbody td.dataTables_empty {
    text-align: center !important;
    vertical-align: middle !important;
    color: #94a3b8;
    font-size: 0.9rem;
    font-style: italic;
    padding: 4rem 1rem !important;
}

.contacts-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 0.875rem;
    table-layout: auto;
}

.contacts-table.dataTable {
    width: 100% !important;
}

.contacts-table thead th,
.contacts-table tbody td {
    box-sizing: border-box;
}

.contacts-table thead {
    border-bottom: 2px solid #e2e8f0;
}

.contacts-table thead tr th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #334155;
    border: none;
    white-space: nowrap;
    background: #D1F4FA;
}

.contacts-table tbody tr {
    background: #f8fafc;
    transition: background 0.15s ease;
    border-bottom: 1px solid #e2e8f0;
}

.contacts-table tbody tr:hover {
    background: #f8fafc;
}

.contacts-table tbody tr td {
    padding: 1rem 1.25rem;
    color: #334155;
    border: none;
    vertical-align: middle;
    background: transparent;
}

.contacts-table tbody tr:last-child {
    border-bottom: none;
}

.contacts-table tfoot {
    border-top: 2px solid #e2e8f0;
}

.contacts-table tfoot tr td {
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: #1e293b;
    border: none;
    background: #D1F4FA;
}

.contacts-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #3b82f6;
    color: #ffffff;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.contacts-action-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.contacts-action-menu {
    min-width: 200px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
}

.contacts-action-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: #334155;
    transition: all 0.15s ease;
    font-size: 0.875rem;
}

.contacts-action-menu li a:hover {
    background: #f1f5f9;
    color: #667eea;
}

.contacts-action-menu li a i {
    width: 16px;
    text-align: center;
    color: #64748b;
}

.contacts-action-menu .divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.5rem 0;
}

.contact-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.contact-status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.contact-status-active {
    background: #d1fae5;
    color: #065f46;
}

.contact-due-amount {
    font-weight: 600;
    color: #334155;
}

.contact-due-amount[data-highlight="true"] {
    color: #dc2626;
}

.contact-return-due {
    font-weight: 500;
    color: #059669;
}

.contacts-table thead th.sorting,
.contacts-table thead th.sorting_asc,
.contacts-table thead th.sorting_desc {
    position: relative;
    padding-right: 2.5rem;
}

.contacts-table thead th.sorting:after,
.contacts-table thead th.sorting_asc:after,
.contacts-table thead th.sorting_desc:after {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.75rem;
    color: #64748b;
}

.contacts-table thead th.sorting:after {
    content: '\f0dc';
    opacity: 0.3;
}

.contacts-table thead th.sorting_asc:after {
    content: '\f0de';
    color: #0066FF;
}

.contacts-table thead th.sorting_desc:after {
    content: '\f0dd';
    color: #0066FF;
}



/* ── ct-action-bar: bulk-action buttons in one flex row ── */
.ct-action-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}
.ct-action-bar > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.ct-action-bar .tw-dw-btn {
    white-space: nowrap;
}

/* ── ct-footer: info + pagination in one row (RTL-aware) ── */
.ct-footer {
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
}
.ct-footer .dataTables_info {
    color: #64748b;
    font-size: 0.875rem;
    padding: 0 !important;
    margin: 0;
}
.ct-footer .dataTables_paginate {
    margin-top: 0 !important;
    padding: 0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    margin: 0 0.25rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Fix vendor.css right:322px override on .dropdown-menu-left */
.users-page-controls .dropdown-menu.dropdown-menu-left,
.users-page-export .dropdown-menu.dropdown-menu-left {
    right: 0 !important;
    left: auto !important;
}

/* ── Global hover elevation — box-shadow lift on all cards, boxes, modals ── */

/* AdminLTE .box */
.box {
    transition: box-shadow 0.2s ease;
}
.box:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08) !important;
}

/* AdminLTE .small-box (dashboard tiles) */
.small-box {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.small-box:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08) !important;
    transform: translateY(-1px);
}

/* AdminLTE .info-box */
.info-box {
    transition: box-shadow 0.2s ease;
}
.info-box:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08) !important;
}

/* Bootstrap modals */
.modal-content {
    transition: box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .12) !important;
}

/* Nav tabs custom containers */
.nav-tabs-custom {
    transition: box-shadow 0.2s ease;
}
.nav-tabs-custom:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08) !important;
}

/* contacts-table-container lift */
.contacts-table-container {
    transition: box-shadow 0.2s ease;
}
.contacts-table-container:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08) !important;
}

/* ── Page-specific hover additions ── */

/* contacts/import */
.import-form-card,
.import-instructions-card {
    transition: box-shadow 0.2s ease;
}
.import-form-card:hover,
.import-instructions-card:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08) !important;
}

/* contacts/37 info cards */
.ci-card {
    transition: box-shadow 0.2s ease;
}
.ci-card:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08) !important;
}

/* Product table specific styles */
.product-image-wrapper {
    display: flex;
}

.price-cell {
    white-space: nowrap;
}

/* ── Shimmer skeleton for DataTable loading ── */
@keyframes ct-shimmer-wave {
    0%   { background-position: -400px 0; }
    100% { background-position: calc(400px + 100%) 0; }
}

/* Shared shimmer gradient mixin via custom property */
.ct-skeleton-cell,
.ct-shimmer,
.ct-shimmer-btn {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 400px 100%;
    animation: ct-shimmer-wave 1.4s ease-in-out infinite;
    border-radius: 4px;
}

/* Full-cell shimmer (used by global preInit.dt handler) */
.ct-skeleton-cell {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%) !important;
    background-size: 400px 100% !important;
    animation: ct-shimmer-wave 1.4s ease-in-out infinite !important;
    border: none !important;
    padding: 1rem 1.25rem !important;
    color: transparent !important;
}

/* Inner bar for global handler */
.ct-skeleton-inner {
    height: 13px;
    border-radius: 4px;
    background: transparent;
}

/* Text-line shimmer bar (used by contact page's _ctShowSkeleton) */
.ct-shimmer {
    display: block;
    height: 13px;
    border-radius: 4px;
}

/* Button-shaped shimmer (action column) */
.ct-shimmer-btn {
    display: block;
    height: 28px;
    width: 70px;
    border-radius: 6px;
}

/* Row wrapper — keep cell spacing consistent with real rows */
.ct-skeleton-row td {
    padding: 0.875rem 1.25rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .contacts-table thead tr th,
    .contacts-table tbody tr td,
    .contacts-table tfoot tr td {
        padding: 0.75rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .contacts-action-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
}
