/* ==================================== 
   DATATABLE THEME - VIOLET/PURPLE STYLED
   Updated to match existing theme
   ==================================== */

/* ==================================== 
   DATATABLE CONTAINER 
   ==================================== */
.datatable-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 0 0 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ==================================== 
   TABLE HEADER CONTROLS (DataTables Native)
   ==================================== */
.datatable-container .datatable-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 0;
	width: 100%;
	border-bottom: 2px solid #f6edfd;
	border-top: 2px solid #f6edfd;
	flex-wrap: wrap;
	gap: 16px;
}

/* Left side - Records per page + Buttons */
.datatable-container .table-controls {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
	flex: 1;
	transform: translateZ(0);
}

.datatable-right {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 58%;
}

/* ==================================== 
   RECORDS PER PAGE SELECT
   ==================================== */
.dt-length {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #64748b;
}

.dt-length label {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-weight: 600;
	color: #444;
}

.dt-length select {
	padding: 8px 32px 8px 14px;
	border: 2px solid #e9ddf5;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	color: #5c2d90;
	cursor: pointer;
	transition: all 0.2s ease;
	background: #f8f4fc url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%235c2d90" d="M6 9L1 4h10z"/></svg>') no-repeat right 12px center;
	background-size: 12px;
	appearance: none;
}

.dt-length select:hover {
	border-color: #6b4c9a;
	background-color: #ffffff;
}

.dt-length select:focus {
	outline: none;
	border-color: #5c2d90;
	box-shadow: 0 0 0 3px rgba(92, 45, 144, 0.1);
}
/* ==================================== 
   ACTION BUTTONS (DataTables Buttons)
   ==================================== */

.dt-buttons {
	display: flex;
	gap: 10px;
}

.btn-action,
.dt-button,
.buttons-copy,
.buttons-excel,
.buttons-csv,
.buttons-pdf {
	padding: 2px 12px;
	border: 1.6px solid;
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.3s ease;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: inherit;
	letter-spacing: 0.3px;
	box-shadow: none;
	text-decoration: none;
}

/* Copy Button - Blue */
.btn-copy,
.dt-button.buttons-copy,
.dt-button.buttons-copyHtml5 {
	background: #3b82f6 !important;
	color: #ffffff !important;
}

.btn-copy:hover,
.dt-button.buttons-copy:hover,
.dt-button.buttons-copyHtml5:hover {
	background: #2563eb !important;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4) !important;
}

/* Excel Button - Green */
.btn-excel,
.dt-button.buttons-excel,
.dt-button.buttons-excelHtml5 {
	background: #10b981 !important;
	color: #ffffff !important;
}

.btn-excel:hover,
.dt-button.buttons-excel:hover,
.dt-button.buttons-excelHtml5:hover {
	background: #059669 !important;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
}

/* PDF Button - Red */
.btn-pdf,
.dt-button.buttons-pdf,
.dt-button.buttons-pdfHtml5 {
	background: #ef4444 !important;
	color: #ffffff !important;
}

.btn-pdf:hover,
.dt-button.buttons-pdf:hover,
.dt-button.buttons-pdfHtml5:hover {
	background: #dc2626 !important;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4) !important;
}

/* Button Active State */
.btn-action:active,
.dt-button:active {
	transform: translateY(0);
}

/* Remove default button styling */
.dt-button span {
	pointer-events: none;
}

/* ==================================== 
   SEARCH BOX (DataTables Native)
   ==================================== */
.dt-search {
	margin: 0;
	position: relative;
	display: flex;
	justify-content: space-between;
	gap: 10px;
	align-items: center;
}

.dt-search input {
	border: 2px solid #f6edfd !important;
	border-radius: 12px !important;
	font-size: 14px !important;
	min-width: 180px;
	transition: all 0.3s ease;
	background: #ffffff;
	color: #334155;
	font-family: inherit;
}

.dt-search input::placeholder {
	color: #94a3b8;
	font-weight: 400;
}

.dt-search input:focus {
	outline: none !important;
	border-color: #5c2d90 !important;
	box-shadow: 0 0 0 3px rgba(92, 45, 144, 0.1) !important;
	background: #ffffff;
}

div.dt-container select.dt-input {
    padding: 5px 0px 5px 11px;
    width: 60px;
    border: 1px solid #5c2d90;
    font-size: 13px;
    font-weight: 300;
    border-radius: 8px;
}

.dataTables_filter input:hover:not(:focus),
.table-search-input:hover:not(:focus) {
	border-color: #6b4c9a !important;
	background: #ffffff;
}

/* Search icon */
.dataTables_filter label::after {
	content: '\f002'; /* FontAwesome search icon */
	font-family: 'Font Awesome 6 Free';
	font-weight: 900;
	position: absolute;
	right: 16px;
	color: #94a3b8;
	pointer-events: none;
	font-size: 14px;
}

.dataTables_filter input:focus + label::after {
	color: #5c2d90;
}

/* ==================================== 
   DATATABLE BASE STYLES 
   ==================================== */
.datatable-container .table {
	margin-bottom: 0;
	margin-top: 16px;
	width: 100%;
}

.datatable-container .table thead {
	border-top: 2px solid #f6edfd;
	border-bottom: 2px solid #f6edfd;
	background: #faf8fc;
}

.datatable-container .table thead th {
	color: #5c2d90;
	text-align: center;
	background: #fff;;
	font-weight: 750;
	font-size: 15px;
	letter-spacing: 0.2px;
	padding: 5px 5px 16px;
	white-space: nowrap;
	vertical-align: middle;
}

div.dt-container .dt-paging .dt-paging-button.first, div.dt-container .dt-paging .dt-paging-button.last {
	display: none;
}

table.dataTable thead>tr>td.dt-orderable-asc:hover,
table.dataTable thead>tr>td.dt-orderable-desc:hover,
table.dataTable thead>tr>th.dt-orderable-asc:hover,
table.dataTable thead>tr>th.dt-orderable-desc:hover {
    outline: none;
}

/* Sorting indicators */
.datatable-container .table thead th.sorting,
.datatable-container .table thead th.sorting_asc,
.datatable-container .table thead th.sorting_desc {
	cursor: pointer;
	position: relative;
	padding-right: 30px;
}

.datatable-container .table thead th.sorting:after,
.datatable-container .table thead th.sorting_asc:after,
.datatable-container .table thead th.sorting_desc:after {
	position: absolute;
	right: 12px;
	font-family: 'Font Awesome 6 Free';
	font-weight: 900;
	font-size: 12px;
	color: #94a3b8;
}

.datatable-container .table thead th.sorting:after {
	content: '\f0dc';
}

.datatable-container .table thead th.sorting_asc:after {
	content: '\f0de';
	color: #5c2d90;
}

.datatable-container .table thead th.sorting_desc:after {
	content: '\f0dd';
	color: #5c2d90;
}

.datatable-container .table tbody td {
	padding: 6px;
	color: #334155;
	font-size: 14px;
	border-bottom: 1px solid #f8f4fc;
	vertical-align: middle;
}

.datatable-container .table tbody tr {
	transition: background 0.2s ease, transform 0.1s ease;
}

.datatable-container .table tbody tr:hover {
	background: #faf8fc;
}

.datatable-container .table tbody tr:last-child td {
	border-bottom: none;
}

/* ==================================== 
   DATATABLE PAGINATION - VIOLET THEME 
   ==================================== */
.dt-paging nav {
    display: inline-flex;
    justify-content: space-between;
    gap: 10px;
}

div.dt-container .dt-paging .dt-paging-button {
    box-sizing: border-box;
    display: inline-block;
    margin-left: 12px;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    color: #5c2d90 !important;
	font-size: 16px;
	font-weight: 650;
    border: 1px solid transparent;
    border-radius: 2px;
    background: 0 0;
}

div.dt-container .dt-paging .dt-paging-button.next,
div.dt-container .dt-paging .dt-paging-button.paginate_button.previous {
	color: #5c2d90;
}

div.dt-container .dt-paging .dt-paging-button:hover,
div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover {
	transform: translateY(-2px);
	background: #4a2473 !important;
	color: #fff !important;
	border-radius: 12px;
}

div.dt-container .dt-paging .dt-paging-button.disabled, div.dt-container .dt-paging .dt-paging-button.disabled:active, div.dt-container .dt-paging .dt-paging-button.disabled:hover {
    cursor: default;
	transform: none;
    color: rgba(0, 0, 0, .5) !important;
    border: 1px solid transparent;
    background: #fff !important;
    box-shadow: none;
}

.dt-containe .dt-paging .paginate_button.previous:hover,
.dt-containe .dt-paging .paginate_button.next:hover {
	transform: translateY(-2px);
	background: #4a2473 !important;
}

.dt-containe .dt-paging .paginate_button:not(.current):not(.previous):not(.next):hover {
	background: #f8f4fc !important;
	border-color: #e9ddf5 !important;
	color: #5c2d90 !important;
	transform: translateY(-2px);
}

.dt-containe .dt-paging .paginate_button.current,
.dt-containe .dt-paging .paginate_button.current:hover {
	background: #6b4c9a !important;
	border-color: #6b4c9a !important;
	color: #ffffff !important;
	transform: translateY(0);
	box-shadow: 0 4px 12px rgba(107, 76, 154, 0.5);
}

.dt-containe .dt-paging .paginate_button.disabled,
.dt-containe .dt-paging .paginate_button.disabled:hover {
	background: #f8f4fc !important;
	border-color: #e9ddf5 !important;
	color: #cbd5e1 !important;
	cursor: not-allowed;
	opacity: 0.6;
	transform: none;
	box-shadow: none;
}

/* Bootstrap pagination overrides */
.page-link {
	position: relative;
	display: block;
	color: #5c2d90;
	border-radius: 10px;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	border: 2px solid transparent;
}

.active > .page-link,
.page-link.active {
	z-index: 3;
	color: #fff;
	background-color: #6b4c9a;
	border-color: #6b4c9a;
	box-shadow: 0 4px 12px rgba(107, 76, 154, 0.5);
}

.page-item:last-child .page-link,
.page-item:first-child .page-link {
	display: none;
}

.page-link:hover {
	color: #f8f4fc;
	background-color: #5c2d90;
	border-color: #5c2d90;
}

/* ==================================== 
   DATATABLE INFO 
   ==================================== */
div.dt-container .dt-info {
	padding-top: 20px;
	color: #64748b;
	font-size: 14px;
	font-weight: 600;
	display: none; /* for now*/
}

/* ==================================== 
   DATATABLE PROCESSING/LOADING 
   ==================================== */
.dt-containe .dataTables_processing {
	background: #ffffff;
	border-radius: 12px;
	padding: 24px;
	box-shadow: 0 8px 24px rgba(92, 45, 144, 0.15);
	color: #5c2d90;
	font-weight: 600;
	border: 2px solid #e9ddf5;
}


/* ====================================
   LOADING STATE OVERLAY (Optional Enhancement)
   ==================================== */

.datatable-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border-radius: 12px;
}

.datatable-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.datatable-loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top-color: #5c2d90;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================================== 
   TOAST NOTIFICATION 
   ==================================== */
.toast-notification {
	position: fixed;
	bottom: 50px;
    right: 30px;
	background: #ffffff;
	padding: 18px 24px;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	gap: 14px;
	z-index: 9999;
	opacity: 0;
	transform: translateX(400px);
	transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
	border-left: 5px solid #10b981;
	min-width: 320px;
}

.toast-notification.show {
	opacity: 1;
	transform: translateX(0);
}

.toast-icon {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	flex-shrink: 0;
}

.toast-icon.success {
	background: #dcfce7;
	color: #16a34a;
}

.toast-icon.excel {
	background: #dcfce7;
	color: #059669;
}

.toast-icon.copy {
	background: #dbeafe;
	color: #3b82f6;
}

.toast-content {
	flex: 1;
}

.toast-title {
	font-weight: 700;
	font-size: 16px;
	color: #1e293b;
	margin-bottom: 3px;
}

.toast-message {
	font-size: 14px;
	color: #64748b;
	font-weight: 500;
}

.toast-close {
	background: none;
	border: none;
	color: #94a3b8;
	cursor: pointer;
	font-size: 20px;
	padding: 0;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: all 0.2s ease;
}

.toast-close:hover {
	background: #f1f5f9;
	color: #475569;
}

/* Toast color variants */
.toast-notification.toast-excel {
	border-left-color: #10b981;
}

.toast-notification.toast-copy {
	border-left-color: #3b82f6;
}

.toast-notification.toast-pdf {
	border-left-color: #ef4444;
}

.toast-icon.pdf {
	background: #fee2e2;
	color: #dc2626;
}

/* ==================================== 
   TABLE-SPECIFIC STYLES 
   ==================================== */
/* Status badges */
.status-badge {
	display: inline-block;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 700;
	text-align: center;
	min-width: 100px;
	letter-spacing: 0.3px;
}

.status-started {
	background: #E5E5FD;
	color: #6919CC;
}

.status-assigned {
	background: #DBEAFE;
	color: #1E40AF;
}

.status-pending {
	background: #8496a7;
	color: #64748b;
}

.status-progress {
	background: #FFFFCD;
	color: #ADAD0E;
}

.status-failed {
	background: #FEE2E2;
	color: #DC2626;
}

.status-completed {
	background: #D9FFCE;
	color: #008516;
}

.status-reopened {
	background: #FFEDD5;
	color: #C2410C;
}

/* Table action buttons */
.btn-table-action {
	padding: 5px 13px;
	font-size: 12px;
	font-weight: 700;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	letter-spacing: 0.3px;
}

.btn-download {
	background: #BCFBBC;
	color: #0C8A27;
	border-radius: 17px;
	box-shadow: rgba(0, 0, 0, 0.15) 0.5px 1.4px 1.4px 1.4px;
}

.btn-download:hover {
	background: #BCFBBC;
	color: #0C8A27;
	transform: translateY(0.8px);
	text-decoration: none;
	box-shadow: rgba(0, 0, 0, 0.15) 0.4px 1.1px 1.1px 1.1px;
}

.btn-grey {
	background: #EAEAE8;
	color: #84847F;
	border-radius: 17px;
	box-shadow: rgba(0, 0, 0, 0.15) 0.8px 1.8px 1.8px 1.8px;
}

.btn-grey:hover {
	background: #e1e1e1;
	color: #848484;
	transform: translateY(-1px);
	box-shadow: rgba(0, 0, 0, 0.15) 0.8px 1.5px 1.5px 1.5px;
}

.btn-no-data {
	background: transparent;
	color: #ababab;
	font-weight: 700;
	cursor: not-allowed;
	padding: 8px 0;
}

/* Filter display in cells */
.filter-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.filter-display {
	font-size: 13px;
	line-height: 1.6;
	font-weight: 500;
	color: #475569;
	background: #f8f4fc;
	padding: 4px 10px;
	border-radius: 6px;
	border-left: 3px solid #5c2d90;
}

.error-note {
	color: #dc2626;
	font-size: 12px;
	font-weight: 600;
	padding: 6px 12px;
	background: #fee2e2;
	border-radius: 6px;
	border-left: 3px solid #dc2626;
}

/* Cell alignment helpers */
.align-center {
	text-align: center !important;
}

.align-left {
	text-align: left !important;
}

.align-right {
	text-align: right !important;
}

.whitespace-nowrap {
	white-space: nowrap !important;
}

.dt-scroll-body {
    max-height: 590px;
    border-bottom: 1px solid rgba(0, 0, 0, .3);
    overflow-y: auto;
    overflow-x: hidden;
    
    /* CRITICAL: Smooth height transition with optimized performance */
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: max-height;
    transform: translateZ(0); /* Force GPU acceleration */
    backface-visibility: hidden;
    
    scrollbar-width: thin;
    scrollbar-color: rgba(92, 45, 144, 0.3) #f8f4fc;
}

.dt-scroll-body:focus-within {
    box-shadow: inset 0 0 0 2px rgba(92, 45, 144, 0.2);
}

* Custom scrollbar for scroll body */
.dt-scroll-body::-webkit-scrollbar {
    width: 8px;
}

.dt-scroll-body::-webkit-scrollbar-track {
    background: #f8f4fc;
    border-radius: 4px;
}

.dt-scroll-body::-webkit-scrollbar-thumb {
    background: rgba(92, 45, 144, 0.3);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.dt-scroll-body::-webkit-scrollbar-thumb:hover {
    background: rgba(92, 45, 144, 0.5);
}


@media (max-width: 991px) and (min-width: 768px) {
    
    .page-body {
        padding: 10px 10px 10px 24px;
    }
}

@media (max-width: 767px) {
    .page-body {
        padding: 10px 10px 10px 16px;
    }
}

@media (max-width: 480px) {
    .page-body {
        padding: 10px 10px 10px 24px;
    }
}


/* ==================================== 
   PRINT STYLES 
   ==================================== */
@media print {
	.table-header,
	.toast-notification,
	.dt-buttons,
	.dataTables_filter,
	.dt-paging,
	.dt-info,
	.dt-length {
		display: none !important;
	}
	
	.datatable-container {
		box-shadow: none;
		padding: 0;
        max-height: none;
        overflow: visible;
	}
    .dt-scroll-body {
        max-height: none !important;
        overflow: visible !important;
        border-bottom: none;
    }
	
	.datatable-container .table {
		font-size: 10pt;
	}
	
	.datatable-container .table thead th {
		background: #f0f0f0 !important;
		color: #000 !important;
	}
}


/* ====================================
   RAISED BY BADGE - DataTable Cell
   ==================================== */

.raised-by-badge {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #faf8fc 0%, #f8f4fc 100%);
    border-radius: 12px;
    border-left: 4px solid #5c2d90;
    min-width: 180px;
    box-shadow: 0 2px 6px rgba(92, 45, 144, 0.08);
    transition: all 0.2s ease;
}

/* Header with Role Badge */
.raised-by-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Role Badge Color Variants */
.role-badge.role-admin {
    background: #FEE2E2;
    color: #DC2626;
}

.role-badge.role-manager {
    background: #DBEAFE;
    color: #1E40AF;
}

.role-badge.role-user {
    background: #D9FFCE;
    color: #008516;
}

.role-badge.role-default {
    background: #E5E5FD;
    color: #6919CC;
}

/* User Name Row */
.raised-by-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.raised-by-user i {
    color: #5c2d90;
    font-size: 13px;
    width: 16px;
}

/* Date Row */
.raised-by-date {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
}

.raised-by-date i {
    color: #94a3b8;
    font-size: 11px;
    width: 16px;
}

/* Compact Variant (Optional) */
.raised-by-badge.compact {
    padding: 8px 10px;
    gap: 6px;
}

.raised-by-badge.compact .role-badge {
    padding: 3px 10px;
    font-size: 10px;
}

.raised-by-badge.compact .raised-by-user {
    font-size: 13px;
}

.raised-by-badge.compact .raised-by-date {
    font-size: 11px;
}

/* ====================================
   RESPONSIVE ADJUSTMENTS
   ==================================== */

@media (max-width: 991px) {
    .raised-by-badge {
        min-width: 160px;
        padding: 10px;
    }
    
    .raised-by-user {
        font-size: 13px;
    }
    
    .raised-by-date {
        font-size: 11px;
    }
}

@media (max-width: 767px) {
    .raised-by-badge {
        min-width: 140px;
        padding: 8px;
        gap: 6px;
    }
    
    .role-badge {
        font-size: 10px;
        padding: 3px 10px;
    }
}