/*
 * Dark Theme Override CSS
 * Minimalist dark grey and red theme for admin panel
 * Preserves all original layout, sizing and responsiveness
 */

/* Global body and root styles */
body {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
    font-family: inherit;
}

html {
    background-color: #1a1a1a !important;
}

/* Modernized Main wrapper and container */
.page-wrapper {
    background: radial-gradient(ellipse at top, rgba(26, 26, 26, 1) 0%, rgba(20, 20, 20, 1) 100%) !important;
    min-height: 100vh !important;
}

.main-container {
    background-color: transparent !important;
}

.app-container {
    background: transparent !important;
    margin: 8px !important;
    border-radius: 24px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
}

.app-body {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9), rgba(30, 30, 30, 0.8)) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: 24px !important;
    margin: 8px !important;
    padding: 24px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

/* Modern footer styling */
.app-footer, 
footer {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.95), rgba(35, 35, 35, 0.9)) !important;
    border-top: 1px solid rgba(220, 53, 69, 0.2) !important;
    color: #b0b0b0 !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border-radius: 24px 24px 0 0 !important;
    margin: 8px 8px 0 8px !important;
    padding: 16px 24px !important;
    text-align: center !important;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15) !important;
    position: relative !important;
}

.app-footer::before,
footer::before {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 2px !important;
    background: linear-gradient(90deg, transparent, #dc3545, transparent) !important;
    border-radius: 0 0 24px 24px !important;
}

/* Sidebar dark theme */
.sidebar-wrapper {
    background-color: #2d2d2d !important;
    border-right: 1px solid #404040 !important;
}

/* Modernized App brand and Logo */
.app-brand {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.9), rgba(55, 55, 55, 0.8)) !important;
    border-bottom: 1px solid rgba(220, 53, 69, 0.2) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-radius: 0 0 16px 16px !important;
    margin: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

/* Logo styling - remove pressed appearance */
.logo {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    filter: drop-shadow(0 2px 8px rgba(220, 53, 69, 0.3)) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    border: none !important;
}

.logo:hover {
    transform: scale(1.05) !important;
    filter: drop-shadow(0 4px 12px rgba(220, 53, 69, 0.5)) !important;
}

.app-brand a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px !important;
    text-decoration: none !important;
}

/* Mobile logo brand */
.app-brand-sm {
    background: rgba(45, 45, 45, 0.9) !important;
    border-radius: 12px !important;
    padding: 8px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

/* Enhanced Sidebar menu styles with better active/inactive states */
.sidebar-menu li a {
    color: #b0b0b0 !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    margin: 2px 8px !important;
    padding: 12px 16px !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
}

.sidebar-menu li a:hover {
    background-color: #404040 !important;
    color: #ffffff !important;
    transform: translateX(4px) !important;
}

/* Active menu states */
.sidebar-menu li.active > a,
.sidebar-menu li a.active {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3) !important;
    font-weight: 600 !important;
}

.sidebar-menu li.active > a::before,
.sidebar-menu li a.active::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 4px !important;
    background-color: #ffffff !important;
    border-radius: 0 4px 4px 0 !important;
}

.sidebar-menu li a i {
    color: inherit !important;
    margin-right: 12px !important;
    width: 20px !important;
    text-align: center !important;
    font-size: 16px !important;
}

/* Treeview parent styles */
.sidebar-menu li.treeview > a {
    position: relative !important;
}

.sidebar-menu li.treeview > a::after {
    content: '\F282' !important;
    font-family: 'bootstrap-icons' !important;
    position: absolute !important;
    right: 16px !important;
    transition: transform 0.3s ease !important;
    font-size: 14px !important;
}

.sidebar-menu li.treeview.active > a::after {
    transform: rotate(90deg) !important;
}

/* Active treeview parent */
.sidebar-menu li.treeview.active > a {
    background-color: #404040 !important;
    color: #dc3545 !important;
}

/* Submenu item active state */
.treeview-menu li.active a {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    margin-left: 20px !important;
    border-left: 3px solid #ffffff !important;
    padding-left: 20px !important;
}

/* Inactive menu items - subtle visual feedback */
.sidebar-menu li:not(.active) a {
    opacity: 0.85 !important;
}

.sidebar-menu li:not(.active) a:hover {
    opacity: 1 !important;
}

/* Smooth animation for menu state changes */
.sidebar-menu li a,
.treeview-menu {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Visual feedback for menu loading */
.sidebar-menu li a.loading {
    opacity: 0.6 !important;
    pointer-events: none !important;
}

/* Enhanced submenu styling */
.treeview-menu li a:hover {
    background-color: #555555 !important;
    color: #ffffff !important;
    margin-left: 24px !important;
}

/* Menu breadcrumb effect for nested active items */
.sidebar-menu li.treeview.active .treeview-menu li.active a {
    box-shadow: inset 3px 0 0 #ffffff, 0 2px 8px rgba(220, 53, 69, 0.2) !important;
}

/* Modern glass-morphism container styling */
.row .col-sm-12,
.row .col-xl-4,
.row .col-xl-8,
.row .col-lg-4,
.row .col-lg-8 {
    margin-bottom: 1rem !important;
}

/* Enhanced button styling for modern look */
.btn {
    border-radius: 12px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    font-weight: 500 !important;
}

.btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
}

/* Modern page animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-body > .row,
.card {
    animation: fadeInUp 0.6s ease-out !important;
}

.card:nth-child(2) {
    animation-delay: 0.1s !important;
}

.card:nth-child(3) {
    animation-delay: 0.2s !important;
}

.card:nth-child(4) {
    animation-delay: 0.3s !important;
}

.treeview-menu {
    background-color: #373737 !important;
}

.treeview-menu li a {
    background-color: transparent !important;
    color: #b0b0b0 !important;
    padding-left: 3rem !important;
}

.treeview-menu li a:hover {
    background-color: #454545 !important;
    color: #ffffff !important;
}

/* Modernized Header styles */
.app-header {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.95), rgba(35, 35, 35, 0.9)) !important;
    border-bottom: 1px solid rgba(220, 53, 69, 0.2) !important;
    color: #e0e0e0 !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15) !important;
    border-radius: 0 0 24px 24px !important;
    margin: 0 8px 8px 8px !important;
    position: relative !important;
}

.app-header::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 2px !important;
    background: linear-gradient(90deg, transparent, #dc3545, transparent) !important;
    border-radius: 24px 24px 0 0 !important;
}

.app-header h5 {
    color: #ffffff !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
    letter-spacing: 0.5px !important;
}

.header-actions {
    background: rgba(55, 55, 55, 0.6) !important;
    border-radius: 16px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(220, 53, 69, 0.2) !important;
}

/* Modernized Single Toggle Button */
.toggle-sidebar {
    background: rgba(55, 55, 55, 0.6) !important;
    color: #b0b0b0 !important;
    border: 1px solid rgba(220, 53, 69, 0.2) !important;
    outline: none !important;
    cursor: pointer !important;
    padding: 12px !important;
    border-radius: 12px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.toggle-sidebar:hover,
.toggle-sidebar:focus {
    background: rgba(220, 53, 69, 0.8) !important;
    color: #ffffff !important;
    outline: none !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3) !important;
    border-color: rgba(220, 53, 69, 0.6) !important;
}

.toggle-sidebar i {
    font-size: 18px !important;
    transition: transform 0.3s ease !important;
}

/* Toggle button active state animation */
.toggle-sidebar.active i,
.page-wrapper.toggled .toggle-sidebar i {
    transform: rotate(90deg) !important;
}

/* Modernized Cards and content */
.card {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.9), rgba(35, 35, 35, 0.8)) !important;
    border: 1px solid rgba(220, 53, 69, 0.2) !important;
    color: #e0e0e0 !important;
    border-radius: 16px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden !important;
}

.card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(220, 53, 69, 0.4) !important;
}

.card-header {
    background: linear-gradient(135deg, rgba(55, 55, 55, 0.9), rgba(45, 45, 45, 0.8)) !important;
    border-bottom: 1px solid rgba(220, 53, 69, 0.2) !important;
    color: #ffffff !important;
    border-radius: 16px 16px 0 0 !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    position: relative !important;
}

.card-header::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 2px !important;
    background: linear-gradient(90deg, transparent, #dc3545, transparent) !important;
}

.card-body {
    background-color: inherit !important;
    color: inherit !important;
    padding: 1.5rem !important;
}

.card-footer {
    background: linear-gradient(135deg, rgba(55, 55, 55, 0.8), rgba(45, 45, 45, 0.9)) !important;
    border-top: 1px solid rgba(220, 53, 69, 0.2) !important;
    color: #e0e0e0 !important;
    border-radius: 0 0 16px 16px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

.card-title {
    color: #ffffff !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* Buttons */
.btn-primary {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

.btn-primary:hover {
    background-color: #c82333 !important;
    border-color: #bd2130 !important;
}

.btn-secondary {
    background-color: #5a5a5a !important;
    border-color: #5a5a5a !important;
    color: #ffffff !important;
}

.btn-secondary:hover {
    background-color: #6a6a6a !important;
    border-color: #6a6a6a !important;
}

.btn-success {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
}

.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.btn-warning {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #212529 !important;
}

.btn-info {
    background-color: #17a2b8 !important;
    border-color: #17a2b8 !important;
}

.btn-light {
    background-color: #5a5a5a !important;
    border-color: #5a5a5a !important;
    color: #ffffff !important;
}

.btn-dark {
    background-color: #343a40 !important;
    border-color: #343a40 !important;
}

/* Forms */
.form-control {
    background-color: #404040 !important;
    border: 1px solid #5a5a5a !important;
    color: #e0e0e0 !important;
}

.form-control:focus {
    background-color: #404040 !important;
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    color: #ffffff !important;
}

.form-control::placeholder {
    color: #888888 !important;
}

.form-select {
    background-color: #404040 !important;
    border: 1px solid #5a5a5a !important;
    color: #e0e0e0 !important;
}

.form-select:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.form-label {
    color: #b0b0b0 !important;
}

.input-group-text {
    background-color: #5a5a5a !important;
    border: 1px solid #5a5a5a !important;
    color: #e0e0e0 !important;
}

/* Tables */
.table {
    color: #e0e0e0 !important;
}

.table-dark {
    background-color: #2d2d2d !important;
}

.table thead th {
    background-color: #373737 !important;
    color: #ffffff !important;
    border-color: #404040 !important;
}

.table td,
.table th {
    border-color: #404040 !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #333333 !important;
}

.table-hover tbody tr:hover {
    background-color: #404040 !important;
    color: #ffffff !important;
}

/* DataTables specific */
.dataTables_wrapper {
    color: #e0e0e0 !important;
}

.dataTables_length select,
.dataTables_filter input {
    background-color: #404040 !important;
    border: 1px solid #5a5a5a !important;
    color: #e0e0e0 !important;
}

.dataTables_info {
    color: #b0b0b0 !important;
}

.paginate_button {
    background-color: #404040 !important;
    color: #e0e0e0 !important;
    border: 1px solid #5a5a5a !important;
}

.paginate_button:hover {
    background-color: #dc3545 !important;
    color: #ffffff !important;
}

.paginate_button.current {
    background-color: #dc3545 !important;
    color: #ffffff !important;
}

/* Modals */
.modal-content {
    background-color: #2d2d2d !important;
    border: 1px solid #404040 !important;
}

.modal-header {
    background-color: #373737 !important;
    border-bottom: 1px solid #404040 !important;
}

.modal-title {
    color: #ffffff !important;
}

.modal-body {
    background-color: #2d2d2d !important;
    color: #e0e0e0 !important;
}

.modal-footer {
    background-color: #373737 !important;
    border-top: 1px solid #404040 !important;
}

.btn-close {
    filter: invert(1) !important;
}

/* Alerts - Enhanced overrides to fix white background */
.alert,
.alert-dismissible,
div[class*="alert"],
div[class^="alert"] {
    background-color: rgba(45, 45, 45, 0.9) !important;
    color: #e0e0e0 !important;
    border: 1px solid #404040 !important;
    border-radius: 8px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

.alert-success,
.alert.alert-success {
    background-color: rgba(40, 167, 69, 0.2) !important;
    color: #4ade80 !important;
    border-color: rgba(40, 167, 69, 0.4) !important;
}

.alert-danger,
.alert.alert-danger {
    background-color: rgba(220, 53, 69, 0.2) !important;
    color: #f87171 !important;
    border-color: rgba(220, 53, 69, 0.4) !important;
}

.alert-warning,
.alert.alert-warning {
    background-color: rgba(255, 193, 7, 0.2) !important;
    color: #fbbf24 !important;
    border-color: rgba(255, 193, 7, 0.4) !important;
}

.alert-info,
.alert.alert-info {
    background-color: rgba(23, 162, 184, 0.2) !important;
    color: #38bdf8 !important;
    border-color: rgba(23, 162, 184, 0.4) !important;
}

.alert-primary,
.alert.alert-primary {
    background-color: rgba(220, 53, 69, 0.2) !important;
    color: #f87171 !important;
    border-color: rgba(220, 53, 69, 0.4) !important;
}

.alert-secondary,
.alert.alert-secondary {
    background-color: rgba(90, 90, 90, 0.2) !important;
    color: #d1d5db !important;
    border-color: rgba(90, 90, 90, 0.4) !important;
}

.alert-light,
.alert.alert-light {
    background-color: rgba(55, 55, 55, 0.2) !important;
    color: #e5e7eb !important;
    border-color: rgba(55, 55, 55, 0.4) !important;
}

.alert-dark,
.alert.alert-dark {
    background-color: rgba(26, 26, 26, 0.2) !important;
    color: #f3f4f6 !important;
    border-color: rgba(26, 26, 26, 0.4) !important;
}

/* Additional alert text and link overrides */
.alert a,
.alert .alert-link {
    color: inherit !important;
    text-decoration: underline !important;
}

.alert .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
}

/* Force override any remaining white alert backgrounds */
.alert[style*="background"],
.alert[style*="background-color"] {
    background-color: rgba(45, 45, 45, 0.9) !important;
    color: #e0e0e0 !important;
}

/* Bootstrap 5 specific alert overrides */
.alert.show,
.alert.fade.show {
    background-color: rgba(45, 45, 45, 0.9) !important;
    color: #e0e0e0 !important;
}

/* Custom captcha warning alert styling */
.alert:contains("prevent your page"),
.alert:contains("captcha"),
.alert:contains("Cloudflare") {
    background-color: rgba(255, 193, 7, 0.2) !important;
    color: #fbbf24 !important;
    border-color: rgba(255, 193, 7, 0.4) !important;
}

/* Badges */
.badge {
    border-radius: 4px !important;
}

.badge.bg-primary {
    background-color: #dc3545 !important;
}

.badge.bg-secondary {
    background-color: #5a5a5a !important;
}

/* Icon boxes */
.icon-box {
    border-radius: 8px !important;
}

.icon-box.bg-primary {
    background-color: #dc3545 !important;
}

.icon-box.bg-secondary {
    background-color: #5a5a5a !important;
}

.icon-box.bg-success {
    background-color: #28a745 !important;
}

.icon-box.bg-warning {
    background-color: #dc3545 !important;
}

.icon-box.bg-info {
    background-color: #17a2b8 !important;
}

.icon-box.bg-danger {
    background-color: #dc3545 !important;
}

/* Progress bars */
.progress {
    background-color: #404040 !important;
}

.progress-bar {
    background-color: #dc3545 !important;
}

/* Breadcrumbs */
.breadcrumb {
    background-color: transparent !important;
}

.breadcrumb-item a {
    color: #dc3545 !important;
}

.breadcrumb-item.active {
    color: #b0b0b0 !important;
}

/* Dropdowns */
.dropdown-menu {
    background-color: #2d2d2d !important;
    border: 1px solid #404040 !important;
}

.dropdown-item {
    color: #e0e0e0 !important;
}

.dropdown-item:hover {
    background-color: #404040 !important;
    color: #ffffff !important;
}

.dropdown-divider {
    border-color: #404040 !important;
}

/* Text colors */
.text-muted {
    color: #888888 !important;
}

.text-primary {
    color: #dc3545 !important;
}

.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #dc3545 !important;
}

.text-info {
    color: #17a2b8 !important;
}

.text-dark {
    color: #e0e0e0 !important;
}

.text-light {
    color: #b0b0b0 !important;
}

/* Background colors */
.bg-light {
    background-color: #373737 !important;
}

.bg-dark {
    background-color: #1a1a1a !important;
}

.bg-primary {
    background-color: #dc3545 !important;
}

.bg-secondary {
    background-color: #5a5a5a !important;
}

/* Borders */
.border {
    border-color: #404040 !important;
}

.border-primary {
    border-color: #dc3545 !important;
}

.border-secondary {
    border-color: #5a5a5a !important;
}

/* List groups */
.list-group-item {
    background-color: #2d2d2d !important;
    border: 1px solid #404040 !important;
    color: #e0e0e0 !important;
}

.list-group-item:hover {
    background-color: #373737 !important;
}

.list-group-item.active {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}

/* Scrollbar customization for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #2d2d2d;
}

::-webkit-scrollbar-thumb {
    background: #5a5a5a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #dc3545;
}

/* Ensure no layout breaks - preserve all spacing */
* {
    box-sizing: border-box;
}

/* Chart and graph background compatibility */
.apexcharts-canvas {
    background: transparent !important;
}

.apexcharts-tooltip {
    background: #2d2d2d !important;
    border: 1px solid #404040 !important;
    color: #e0e0e0 !important;
}

/* Mobile sidebar overlay and blur effect */
.sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    z-index: 1040 !important;
    display: none !important;
}

.sidebar-overlay.show {
    display: block !important;
}

/* Preserve all responsive grid behavior */
@media (max-width: 768px) {
    .sidebar-wrapper {
        background-color: #2d2d2d !important;
        z-index: 1050 !important;
    }
    
    .app-header {
        background-color: #2d2d2d !important;
    }
    
    /* Mobile sidebar when opened */
    .sidebar-wrapper.show {
        transform: translateX(0) !important;
    }
    
    /* Blur the main content when sidebar is open on mobile */
    body.sidebar-open .app-container {
        filter: blur(2px) !important;
        transition: filter 0.3s ease !important;
    }
    
    body.sidebar-open .sidebar-overlay {
        display: block !important;
    }
}

/* Additional utility overrides */
.shadow-sm {
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .4) !important;
}

.shadow {
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .4) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .5) !important;
}

/* Ensure opacity classes work properly with dark theme */
.opacity-25 {
    opacity: 0.35 !important;
}

.opacity-50 {
    opacity: 0.6 !important;
}

.opacity-75 {
    opacity: 0.85 !important;
}

/* Override all #5b4fb9 color references with red (#dc3545) */
:root {
    --bs-primary: #dc3545 !important;
    --bs-primary-rgb: 220, 53, 69 !important;
    --bs-link-color: #dc3545 !important;
    --bs-link-color-rgb: 220, 53, 69 !important;
    --bs-link-hover-color: #c82333 !important;
    --bs-link-hover-color-rgb: 200, 35, 51 !important;
}

/* Form controls override */
.form-check-input:focus {
    border-color: #f5959d !important;
    outline: 0 !important;
    box-shadow: 0 0 0 .25rem rgba(220, 53, 69, .25) !important;
}

.form-check-input:checked {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.form-check-input[type=checkbox]:indeterminate {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.form-range:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px #fff, 0 0 0 .25rem rgba(220, 53, 69, .25) !important;
}

.form-range:focus::-moz-range-thumb {
    box-shadow: 0 0 0 1px #fff, 0 0 0 .25rem rgba(220, 53, 69, .25) !important;
}

.form-range::-webkit-slider-thumb {
    background-color: #dc3545 !important;
}

.form-range::-moz-range-thumb {
    background-color: #dc3545 !important;
}

/* Button overrides */
.btn-primary {
    --bs-btn-color: #ffffff !important;
    --bs-btn-bg: #dc3545 !important;
    --bs-btn-border-color: #dc3545 !important;
    --bs-btn-hover-color: #ffffff !important;
    --bs-btn-hover-bg: #c82333 !important;
    --bs-btn-hover-border-color: #bd2130 !important;
    --bs-btn-focus-shadow-rgb: 225, 83, 97 !important;
    --bs-btn-active-color: #ffffff !important;
    --bs-btn-active-bg: #bd2130 !important;
    --bs-btn-active-border-color: #b21f2d !important;
    --bs-btn-disabled-color: #ffffff !important;
    --bs-btn-disabled-bg: #dc3545 !important;
    --bs-btn-disabled-border-color: #dc3545 !important;
}

.btn-outline-primary {
    --bs-btn-color: #dc3545 !important;
    --bs-btn-border-color: #dc3545 !important;
    --bs-btn-hover-color: #ffffff !important;
    --bs-btn-hover-bg: #dc3545 !important;
    --bs-btn-hover-border-color: #dc3545 !important;
    --bs-btn-focus-shadow-rgb: 220, 53, 69 !important;
    --bs-btn-active-color: #ffffff !important;
    --bs-btn-active-bg: #dc3545 !important;
    --bs-btn-active-border-color: #dc3545 !important;
    --bs-btn-disabled-color: #dc3545 !important;
    --bs-btn-disabled-border-color: #dc3545 !important;
}

/* Links override */
a {
    color: #dc3545 !important;
}

a:hover {
    color: #c82333 !important;
}

/* Enhanced mobile sidebar behavior */
@media (max-width: 991.98px) {
    /* Work with Bootstrap's built-in sidebar classes */
    .page-wrapper .sidebar-wrapper {
        background-color: #2d2d2d !important;
        z-index: 1050 !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    .page-wrapper.toggled .sidebar-wrapper {
        background-color: #2d2d2d !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5) !important;
    }
    
    /* Mobile overlay */
    .mobile-sidebar-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.6) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        z-index: 1040 !important;
        opacity: 1 !important;
        visibility: visible !important;
        transition: all 0.3s ease !important;
    }
    
    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden !important;
    }
    
    /* Mobile header adjustments */
    .app-header {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .app-container {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Desktop sidebar behavior */
@media (min-width: 992px) {
    /* Ensure desktop sidebar works properly */
    .page-wrapper.toggled .sidebar-wrapper {
        width: 96px !important;
    }
    
    .page-wrapper.toggled .sidebar-wrapper .menu-text {
        opacity: 0 !important;
        visibility: hidden !important;
    }
    
    .page-wrapper.toggled .sidebar-wrapper .app-brand {
        padding: 0.5rem !important;
    }
    
    .page-wrapper.toggled .sidebar-wrapper .logo {
        width: 40px !important;
        height: auto !important;
    }
}

/* ============================= */
/* DASHBOARD INDEX PAGE STYLES */
/* ============================= */

/* Dashboard Header */
.dashboard-header {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.dashboard-title {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #dc3545, #ff6b7a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0;
}

.dashboard-actions .btn {
    border-radius: 10px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.dashboard-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Modern Statistics Cards */
.stats-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-card .card {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stats-card .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stats-card:hover .card {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
}

.stats-card:hover .card::before {
    opacity: 1;
}

.stats-number h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stats-label p {
    color: #fff !important;
    font-size: 1rem;
}

.stats-label small {
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 0.85rem;
}

.icon-box-stats {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.icon-box-stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stats-card:hover .icon-box-stats {
    transform: scale(1.1) rotate(5deg);
}

.stats-card:hover .icon-box-stats::before {
    opacity: 1;
}

.progress-sm {
    height: 4px;
}

.progress {
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 2px;
    overflow: hidden;
}

/* Color variants for stats cards */
.valid-card .card {
    border-color: rgba(40, 167, 69, 0.3) !important;
}

.valid-card:hover .card {
    border-color: rgba(40, 167, 69, 0.6) !important;
    box-shadow: 0 20px 40px rgba(40, 167, 69, 0.2) !important;
}

.invalid-card .card {
    border-color: rgba(255, 193, 7, 0.3) !important;
}

.invalid-card:hover .card {
    border-color: rgba(255, 193, 7, 0.6) !important;
    box-shadow: 0 20px 40px rgba(255, 193, 7, 0.2) !important;
}

.bot-card .card {
    border-color: rgba(220, 53, 69, 0.3) !important;
}

.bot-card:hover .card {
    border-color: rgba(220, 53, 69, 0.6) !important;
    box-shadow: 0 20px 40px rgba(220, 53, 69, 0.2) !important;
}

.visitor-card .card {
    border-color: rgba(13, 110, 253, 0.3) !important;
}

.visitor-card:hover .card {
    border-color: rgba(13, 110, 253, 0.6) !important;
    box-shadow: 0 20px 40px rgba(13, 110, 253, 0.2) !important;
}

/* Modern Table Styles */
.modern-table-card {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
}

.table-title-section h4 {
    color: #fff !important;
    font-weight: 600;
}

.table-title-section p {
    color: rgba(255, 255, 255, 0.6) !important;
}

.filter-section {
    background: rgba(255, 255, 255, 0.02) !important;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-group label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.8) !important;
}

.filter-group .form-select {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border-radius: 8px;
}

.filter-group .form-select:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.filter-group .form-select option {
    background: #2a2d3a !important;
    color: #fff !important;
}

.stat-mini {
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-mini small {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.6) !important;
}

.table-container {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modern-table {
    background: rgba(0, 0, 0, 0.1) !important;
}

.modern-table thead th {
    background: rgba(0, 0, 0, 0.4) !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 600;
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.modern-table thead th:first-child {
    border-top-left-radius: 8px;
}

.modern-table thead th:last-child {
    border-top-right-radius: 8px;
}

.th-content {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.th-content i {
    color: #dc3545;
    font-size: 0.8rem;
}

.modern-table tbody td {
    border: none !important;
    padding: 0.75rem;
    vertical-align: middle;
    color: rgba(255, 255, 255, 0.8) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    background: rgba(0, 0, 0, 0.2) !important;
}

.modern-table tbody tr {
    transition: all 0.2s ease;
    background: rgba(0, 0, 0, 0.2) !important;
}

.modern-table tbody tr:hover {
    background: rgba(220, 53, 69, 0.15) !important;
    transform: translateX(4px);
}

.modern-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.3) !important;
}

.modern-table tbody tr:nth-child(even):hover {
    background: rgba(220, 53, 69, 0.18) !important;
}

.table-actions .btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.table-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* DataTables overrides for dark theme */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: rgba(255, 255, 255, 0.7) !important;
}

.dataTables_wrapper .dataTables_filter input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border-radius: 6px;
    padding: 0.25rem 2rem 0.25rem 0.5rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    border-radius: 6px;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(220, 53, 69, 0.2) !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}

/* Fix DataTables table content text colors */
#visitTable,
#visitTable * {
    color: rgba(255, 255, 255, 0.9) !important;
}

#visitTable thead th {
    color: rgba(62, 61, 61, 0.95) !important;
    font-weight: 600 !important;
}

#visitTable tbody td {
    color: rgba(255, 255, 255, 0.85) !important;
}

#visitTable tbody tr:hover td {
    color: rgba(78, 78, 78, 0.95) !important;
}

/* Ensure badges and code elements maintain their styling */
#visitTable .badge {
    color: #fff !important;
}

#visitTable .badge.bg-warning {
    color: #000 !important;
}

#visitTable code {
    color: #17a2b8 !important;
}

#visitTable .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}

#visitTable .text-info {
    color: #17a2b8 !important;
}

#visitTable .text-primary {
    color: #0d6efd !important;
}

#visitTable .text-secondary {
    color: #6c757d !important;
}

/* Hide DataTables sorting icons */
.dataTables_wrapper table.dataTable thead .sorting:before,
.dataTables_wrapper table.dataTable thead .sorting:after,
.dataTables_wrapper table.dataTable thead .sorting_asc:before,
.dataTables_wrapper table.dataTable thead .sorting_asc:after,
.dataTables_wrapper table.dataTable thead .sorting_desc:before,
.dataTables_wrapper table.dataTable thead .sorting_desc:after,
.dataTables_wrapper table.dataTable thead .sorting_asc_disabled:before,
.dataTables_wrapper table.dataTable thead .sorting_asc_disabled:after,
.dataTables_wrapper table.dataTable thead .sorting_desc_disabled:before,
.dataTables_wrapper table.dataTable thead .sorting_desc_disabled:after {
    display: none !important;
}

/* Remove sorting background highlight */
.dataTables_wrapper table.dataTable thead .sorting,
.dataTables_wrapper table.dataTable thead .sorting_asc,
.dataTables_wrapper table.dataTable thead .sorting_desc,
.dataTables_wrapper table.dataTable thead .sorting_asc_disabled,
.dataTables_wrapper table.dataTable thead .sorting_desc_disabled {
    background-image: none !important;
    background-color: transparent !important;
}

/* Force DataTables to use dark background */
.dataTables_wrapper .dataTable {
    background: transparent !important;
}

.dataTables_wrapper .dataTable tbody tr {
    background: rgba(0, 0, 0, 0.2) !important;
}

.dataTables_wrapper .dataTable tbody tr.odd {
    background: rgba(0, 0, 0, 0.2) !important;
}

.dataTables_wrapper .dataTable tbody tr.even {
    background: rgba(0, 0, 0, 0.3) !important;
}

.dataTables_wrapper .dataTable tbody tr:hover {
    background: rgba(220, 53, 69, 0.15) !important;
}

.dataTables_wrapper .dataTable tbody tr.odd:hover {
    background: rgba(220, 53, 69, 0.15) !important;
}

.dataTables_wrapper .dataTable tbody tr.even:hover {
    background: rgba(220, 53, 69, 0.18) !important;
}

/* Override any potential Bootstrap table styling */
.table-dark,
.table-dark > th,
.table-dark > td {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Fix selected/active row states */
.dataTables_wrapper .dataTable tbody tr.selected {
    background: rgba(220, 53, 69, 0.2) !important;
}

.dataTables_wrapper .dataTable tbody tr.selected:hover {
    background: rgba(220, 53, 69, 0.25) !important;
}

.dataTables_wrapper .dataTable tbody tr.active {
    background: rgba(220, 53, 69, 0.2) !important;
}

.dataTables_wrapper .dataTable tbody tr.active:hover {
    background: rgba(220, 53, 69, 0.25) !important;
}

/* Prevent any white backgrounds */
.dataTables_wrapper .dataTable tbody tr,
.dataTables_wrapper .dataTable tbody tr:hover,
.dataTables_wrapper .dataTable tbody tr.odd,
.dataTables_wrapper .dataTable tbody tr.even,
.dataTables_wrapper .dataTable tbody tr.selected,
.dataTables_wrapper .dataTable tbody tr.active {
    background-color: transparent !important;
}

/* Override Bootstrap table hover variable */
:root {
    --bs-table-hover-bg: rgba(220, 53, 69, 0.15) !important;
}

/* Apply our custom backgrounds */
.dataTables_wrapper .dataTable tbody tr {
    background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)) !important;
}

.dataTables_wrapper .dataTable tbody tr.even {
    background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)) !important;
}

.dataTables_wrapper .dataTable tbody tr:hover {
    background-image: linear-gradient(rgba(220, 53, 69, 0.15), rgba(220, 53, 69, 0.15)) !important;
}

.dataTables_wrapper .dataTable tbody tr.even:hover {
    background-image: linear-gradient(rgba(220, 53, 69, 0.18), rgba(220, 53, 69, 0.18)) !important;
}

/* Force override Bootstrap's table hover state */
.table-hover>tbody>tr:hover>* {
    --bs-table-color-state: rgba(255, 255, 255, 0.9) !important;
    --bs-table-bg-state: rgba(220, 53, 69, 0.15) !important;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 1.5rem;
        text-align: center;
    }
    
    .dashboard-title {
        font-size: 1.8rem;
    }
    
    .dashboard-actions {
        margin-top: 1rem;
    }
    
    .dashboard-actions .d-flex {
        justify-content: center;
        gap: 0.5rem;
    }
    
    .stats-number h2 {
        font-size: 2rem;
    }
    
    .filter-section {
        padding: 1rem;
    }
    
    .table-title-section,
    .table-actions {
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .table-actions .d-flex {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Loading and Animation States */
.table-container.loading {
    position: relative;
}

.table-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    z-index: 10;
    border-radius: 12px;
}

.table-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(220, 53, 69, 0.3);
    border-radius: 50%;
    border-top-color: #dc3545;
    animation: spin 1s ease-in-out infinite;
    transform: translate(-50%, -50%);
    z-index: 11;
}

.filter-group .form-select.filtering {
    background: rgba(220, 53, 69, 0.1) !important;
    border-color: #dc3545 !important;
    transform: scale(1.02);
}

.row-updated {
    animation: rowHighlight 0.5s ease-in-out;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes rowHighlight {
    0% { 
        background: rgba(220, 53, 69, 0.1) !important;
        transform: translateX(8px);
    }
    100% { 
        background: transparent !important;
        transform: translateX(0);
    }
}

/* Enhanced badge styles */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
}

.badge.bg-primary {
    background: linear-gradient(135deg, #0d6efd, #0b5ed7) !important;
}

.badge.bg-success {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14) !important;
    color: #000 !important;
}

/* Code styling for IP addresses */
code {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #17a2b8 !important;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}