@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap');

* {
    font-family: 'Montserrat', sans-serif !important;
}

/* Base Light Mode Adjustments */
:root {
    --bs-primary: #A18BF2;
    --bs-primary-rgb: 161, 139, 242;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #0d1117 !important;
    color: #c9d1d9 !important;
}

/* Navbar */
body.dark-mode .navbar {
    background-color: #161b22 !important;
    border-bottom: 1px solid #30363d !important;
}

body.dark-mode .navbar .navbar-brand-wrapper {
    background-color: #161b22 !important;
    border-bottom: 1px solid #30363d !important;
}

body.dark-mode .navbar .navbar-menu-wrapper {
    background-color: #161b22 !important;
    color: #ffffff !important;
}

body.dark-mode .navbar .navbar-menu-wrapper .nav-link i,
body.dark-mode .navbar .navbar-menu-wrapper .navbar-toggler span {
    color: #ffffff !important;
}

/* Sidebar - Premium Dark Look */
body.dark-mode .sidebar {
    background-color: #0d1117 !important;
    border-right: 1px solid #30363d !important;
}

body.dark-mode .sidebar .nav .nav-item .nav-link {
    color: #ffffff !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

body.dark-mode .sidebar .nav .nav-item .nav-link i {
    color: #A18BF2 !important;
}

body.dark-mode .sidebar .nav .nav-item .nav-link .menu-title {
    color: #ffffff !important;
}

body.dark-mode .sidebar .nav .nav-item.active>.nav-link {
    background-color: #21262d !important;
    color: #ffffff !important;
}

body.dark-mode .sidebar .nav .nav-item.active>.nav-link .menu-title,
body.dark-mode .sidebar .nav .nav-item.active>.nav-link i {
    color: #A18BF2 !important;
    font-weight: 700;
}

body.dark-mode .sidebar .nav .nav-item .nav-link:hover {
    background-color: #1a1f26 !important;
}

/* Sub-menu */
body.dark-mode .sidebar .nav.sub-menu {
    background-color: #0d1117 !important;
}

body.dark-mode .sidebar .nav.sub-menu .nav-item .nav-link {
    color: #8b949e !important;
}

body.dark-mode .sidebar .nav.sub-menu .nav-item .nav-link:hover {
    color: #A18BF2 !important;
}

/* Content Area */
body.dark-mode .content-wrapper {
    background-color: #0d1117 !important;
}

/* Cards */
body.dark-mode .card {
    background-color: #161b22 !important;
    color: #c9d1d9 !important;
    border: 1px solid #30363d !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .card .card-title {
    color: #ffffff !important;
}

/* Tables */
body.dark-mode .table {
    color: #c9d1d9 !important;
}

body.dark-mode .table thead th {
    background-color: #21262d !important;
    color: #A18BF2 !important;
    border-bottom: 2px solid #30363d !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

body.dark-mode .table td {
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

body.dark-mode .table tbody tr {
    background-color: transparent !important;
}

body.dark-mode .table tbody tr td {
    background-color: transparent !important;
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd),
body.dark-mode .table-striped tbody tr:nth-of-type(odd) td {
    background-color: #161b22 !important;
}

body.dark-mode .table-striped tbody tr:nth-of-type(even),
body.dark-mode .table-striped tbody tr:nth-of-type(even) td {
    background-color: #0d1117 !important;
}

body.dark-mode .table-hover tbody tr:hover,
body.dark-mode .table-hover tbody tr:hover td {
    background-color: #21262d !important;
    transition: background-color 0.2s ease;
}

/* Footer */
body.dark-mode .footer {
    background-color: #0d1117 !important;
    border-top: 1px solid #30363d !important;
    color: #8b949e !important;
}

/* Forms */
body.dark-mode .form-control {
    background-color: #0d1117 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
}

body.dark-mode .form-control:focus {
    background-color: #0d1117 !important;
    border-color: #A18BF2 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.2rem rgba(161, 139, 242, 0.25) !important;
}

body.dark-mode label {
    color: #ffffff !important;
}

/* Text helpers */
body.dark-mode .text-black,
body.dark-mode .welcome-text,
body.dark-mode .welcome-sub-text {
    color: #ffffff !important;
}

body.dark-mode .text-muted {
    color: #8b949e !important;
}

/* Buttons */
body.dark-mode .btn-primary {
    background-color: #A18BF2 !important;
    border-color: #A18BF2 !important;
}

body.dark-mode .btn-outline-dark {
    color: #A18BF2 !important;
    border-color: #30363d !important;
}

body.dark-mode .btn-outline-dark:hover {
    background-color: #21262d !important;
    border-color: #A18BF2 !important;
}

body.dark-mode .btn-light {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #ffffff !important;
}

body.dark-mode .btn-light:hover {
    background-color: #30363d !important;
    border-color: #A18BF2 !important;
    color: #ffffff !important;
}

body.dark-mode .btn-light svg {
    stroke: #ffffff !important;
}

/* Theme Toggle Button */
.theme-toggle-container {
    display: flex;
    align-items: center;
    padding: 0 15px;
}

#theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #A18BF2;
    transition: transform 0.3s ease;
}

#theme-toggle-btn:hover {
    transform: scale(1.1);
}

/* User Profile Fixes */
body.dark-mode .dropdown-menu {
    background-color: #161b22 !important;
    border: 1px solid #30363d !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .dropdown-item {
    color: #c9d1d9 !important;
}

body.dark-mode .dropdown-item:hover {
    background-color: #21262d !important;
    color: #ffffff !important;
}

/* User Icon Theme Colors */
.user-icon-header {
    color: #A18BF2 !important;
}

body.dark-mode .user-icon-header {
    color: #ffffff !important;
}

/* Modals */
body.dark-mode .modal-content {
    background-color: #161b22 !important;
    color: #c9d1d9 !important;
    border: 1px solid #30363d !important;
}

body.dark-mode .modal-header {
    background-color: #21262d !important;
    border-bottom: 1px solid #30363d !important;
    color: #ffffff !important;
}

body.dark-mode .modal-header .modal-title {
    color: #ffffff !important;
}

body.dark-mode .modal-body {
    background-color: #161b22 !important;
    color: #c9d1d9 !important;
}

body.dark-mode .modal-footer {
    background-color: #21262d !important;
    border-top: 1px solid #30363d !important;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Purple icon and text-primary helpers */
.purple-icon {
    color: #A18BF2 !important;
}

.iconBig {
    font-size: 1.5rem !important;
}

body.dark-mode .text-primary {
    color: #A18BF2 !important;
}

/* Ensure button primary colors are consistent */
.btn-primary {
    background-color: #A18BF2 !important;
    border-color: #A18BF2 !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #8b6fd9 !important;
    border-color: #8b6fd9 !important;
    color: #ffffff !important;
}

body.dark-mode .btn-primary:hover,
body.dark-mode .btn-primary:focus,
body.dark-mode .btn-primary:active {
    background-color: #8b6fd9 !important;
    border-color: #8b6fd9 !important;
    color: #ffffff !important;
}

/* CodeMirror Editor in Dark Mode */
body.dark-mode .CodeMirror {
    background-color: #0d1117 !important;
    color: #c9d1d9 !important;
    border: 1px solid #30363d !important;
}

body.dark-mode .CodeMirror-gutters {
    background-color: #161b22 !important;
    border-right: 1px solid #30363d !important;
}

body.dark-mode .CodeMirror-linenumber {
    color: #8b949e !important;
}

body.dark-mode .CodeMirror-cursor {
    border-left: 1px solid #c9d1d9 !important;
}

body.dark-mode #prompt-code-editor-container {
    border-color: #30363d !important;
}

/* DataTables Dark Mode Enhancements */
body.dark-mode .dataTables_wrapper {
    color: #c9d1d9 !important;
}

body.dark-mode .dataTables_wrapper .dataTables_info {
    color: #8b949e !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #c9d1d9 !important;
    background-color: transparent !important;
    border: 1px solid #30363d !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #ffffff !important;
    background-color: #21262d !important;
    border: 1px solid #A18BF2 !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    color: #ffffff !important;
    background-color: #A18BF2 !important;
    border: 1px solid #A18BF2 !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #484f58 !important;
    background-color: transparent !important;
}

body.dark-mode .dt-search input,
body.dark-mode .dataTables_filter input {
    background-color: #0d1117 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
}

body.dark-mode .dt-search input:focus,
body.dark-mode .dataTables_filter input:focus {
    border-color: #A18BF2 !important;
    outline: none !important;
    box-shadow: 0 0 0 0.2rem rgba(161, 139, 242, 0.25) !important;
}

/* Forzar fondo oscuro en todas las celdas y filas de tabla */
body.dark-mode table.dataTable tbody tr,
body.dark-mode table.dataTable tbody td,
body.dark-mode #prompts-table tbody tr,
body.dark-mode #prompts-table tbody td {
    background-color: transparent !important;
}

body.dark-mode table.dataTable.table-striped tbody tr:nth-of-type(odd),
body.dark-mode table.dataTable.table-striped tbody tr:nth-of-type(odd) td,
body.dark-mode #prompts-table tbody tr:nth-of-type(odd),
body.dark-mode #prompts-table tbody tr:nth-of-type(odd) td {
    background-color: #161b22 !important;
}

body.dark-mode table.dataTable.table-striped tbody tr:nth-of-type(even),
body.dark-mode table.dataTable.table-striped tbody tr:nth-of-type(even) td,
body.dark-mode #prompts-table tbody tr:nth-of-type(even),
body.dark-mode #prompts-table tbody tr:nth-of-type(even) td {
    background-color: #0d1117 !important;
}

body.dark-mode table.dataTable tbody tr:hover,
body.dark-mode table.dataTable tbody tr:hover td,
body.dark-mode #prompts-table tbody tr:hover,
body.dark-mode #prompts-table tbody tr:hover td {
    background-color: #21262d !important;
}

/* Asegurar que no haya fondos blancos en ningún elemento de DataTables */
body.dark-mode .dataTables_wrapper .dataTable,
body.dark-mode .dataTables_wrapper .dataTable tbody,
body.dark-mode .dataTables_wrapper .dataTable tbody tr,
body.dark-mode .dataTables_wrapper .dataTable tbody td {
    background-color: transparent !important;
}