:root {
    --primary-color: #224abe;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --danger-color: #e74c3c;
    --warning-color: #f6c23e;
    --info-color: #36b9cc;
    --light-color: #f8f9fc;
    --gray-color: #dee2e6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: var(--light-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

body {
    overflow-x: hidden;
}

#wrapper {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100%;
}

#wrapper.toggled .sidebar {
    width: 64px;
}

.sidebar {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--primary-color) 10%, #2e59a8 100%);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 225px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: margin 0.15s ease-in-out;
}

.sidebar-copyright {
    margin-top: auto;
    padding: 0.75rem 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

.sidebar.toggled {
    margin-left: -225px;
}

#wrapper.toggled #content-wrapper {
    margin-left: 64px;
}

#wrapper.toggled .sidebar-brand {
    justify-content: center;
    padding: 0 0.5rem;
}

#wrapper.toggled .sidebar-brand-logo {
    width: 48px;
}

#wrapper.toggled .sidebar-brand-label,
#wrapper.toggled .sidebar .nav-link span,
#wrapper.toggled .sidebar-heading,
#wrapper.toggled .sidebar-copyright {
    display: none;
}

#wrapper.toggled .sidebar .nav-link {
    padding: 1rem 0;
    text-align: center;
}

#wrapper.toggled .sidebar .nav-link i {
    margin-right: 0;
}

#wrapper.toggled .sidebar-divider {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

#sidebarToggle {
    position: fixed;
    left: 205px;
    bottom: 20px;
    z-index: 1100;
}

#wrapper.toggled #sidebarToggle {
    left: 44px;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(0, 0, 0, 0.1);
    border-left: 4px solid #fff;
    padding-left: calc(1rem - 4px);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
}

.sidebar .nav-item.active .nav-link {
    color: #fff;
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 4px solid #fff;
    padding-left: calc(1rem - 4px);
}

.sidebar-brand {
    height: 70px;
    flex-shrink: 0;
    padding: 0 1rem;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    transition: all 0.3s ease;
}

.sidebar-brand:hover {
    text-decoration: none;
    color: #fff;
}

.sidebar-brand-logo {
    display: block;
    width: 70px;
    height: auto;
    flex-shrink: 0;
}

.sidebar-brand-label {
    font-size: 0.85rem;
    white-space: nowrap;
}

.sidebar-brand-icon {
    margin-right: 0.5rem;
    transform: rotate(-15deg);
}

.rotate-n-15 {
    transform: rotate(-15deg);
}

.sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 1rem 0;
}

.sidebar-heading {
    padding: 0.5rem 1rem;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

.collapse-inner {
    background-color: #f8f9fc;
    border-left: 4px solid var(--primary-color);
}

.collapse-inner .collapse-item {
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    display: block;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.collapse-inner .collapse-item:hover {
    background-color: #eaecf4;
    color: var(--primary-color);
}

.collapse-inner .collapse-header {
    color: var(--secondary-color);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

#content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-left: 225px;
    overflow: visible;
    transition: margin 0.15s ease-in-out;
    max-height: 100vh;
    position: relative;
}

#wrapper.toggled #content-wrapper {
    margin-left: 64px;
}

#content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--light-color);
    min-height: 0;
    position: relative;
    z-index: 1;
}

.topbar {
    background-color: #fff;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    padding: 1.5rem 1.5rem;
    position: relative;
    z-index: 2000;
    border-bottom: 1px solid var(--gray-color);
}

.topbar-page-title {
    color: var(--dark-color);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-left: 0.25rem;
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar .navbar-search .input-group-text {
    background-color: var(--light-color);
    border: none;
}

.topbar .form-inline .form-control {
    background-color: var(--light-color);
    border: none;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.topbar .form-inline .form-control:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(34, 74, 190, 0.25);
}

.topbar .navbar-nav .nav-item.dropdown .nav-link::after {
    display: none;
}

.topbar .navbar-nav .nav-item .dropdown-menu {
    display: none;
    min-width: 10rem;
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    left: auto;
    z-index: 2100;
}

.topbar .navbar-nav .nav-item .dropdown-menu[data-bs-popper] {
    top: 100%;
    right: 0;
    left: auto;
    margin-top: 0.5rem;
}

.topbar .navbar-nav .nav-item .dropdown-menu.show {
    display: block;
}

.topbar .navbar-nav .nav-item.dropdown {
    position: relative;
}

.topbar .navbar-nav .nav-link {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.topbar .navbar-nav .nav-link:hover {
    color: var(--primary-color);
}

.topbar .navbar-nav .badge-counter {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
}

.img-profile {
    height: 2.5rem;
    width: 2.5rem;
    border: 2px solid var(--gray-color);
}

.dropdown-list {
    padding: 0;
    border: 1px solid var(--gray-color);
    min-width: 300px;
}

.dropdown-list .dropdown-header {
    padding: 0.75rem 1.5rem;
    text-align: center;
    font-weight: 600;
}

.dropdown-list .dropdown-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-color);
}

.dropdown-list .dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-list .dropdown-item:hover {
    background-color: var(--light-color);
}

.dropdown-list-image {
    position: relative;
    height: 2.5rem;
    width: 2.5rem;
}

.dropdown-list-image img {
    height: 2.5rem;
    width: 2.5rem;
    border-radius: 50%;
}

.icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    width: 2.5rem;
    border-radius: 100%;
}

.icon-circle.bg-primary {
    background-color: var(--primary-color);
}

.icon-circle.bg-success {
    background-color: var(--success-color);
}

.sticky-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 1.5rem 0;
    background-color: #fff;
    border-top: 1px solid var(--gray-color);
}

.copyright {
    color: var(--secondary-color);
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-circle {
    border-radius: 100%;
    height: 40px;
    width: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-circle:hover {
    transform: scale(1.1);
}

.btn-circle.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-circle.btn-primary:hover {
    background-color: #1e3a8a;
}

#sidebarToggle,
#sidebarToggleTop {
    cursor: pointer;
    background-color: var(--light-color);
    border: 1px solid var(--gray-color);
    color: var(--primary-color);
    transition: all 0.3s ease;
}

#sidebarToggle:hover,
#sidebarToggleTop:hover {
    background-color: var(--primary-color);
    color: #fff;
}

#sidebarToggle i {
    transition: transform 0.15s ease-in-out;
}

#wrapper.toggled #sidebarToggle i {
    transform: rotate(180deg);
}

.container-fluid {
    padding: 2rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-225px);
        transition: transform 0.15s ease-in-out;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    #content-wrapper {
        margin-left: 0;
    }

    .topbar .navbar-search {
        display: none !important;
    }

    .topbar .form-inline {
        display: none !important;
    }

    .topbar .navbar-nav .mr-auto {
        margin-right: 0 !important;
    }

    .container-fluid {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 1rem;
    }

    .sidebar-brand {
        padding: 1rem;
        font-size: 1rem;
    }

    .sidebar-brand-text {
        display: none;
    }

    .sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    #wrapper:not(.toggled) .sidebar {
        transform: translateX(0);
        width: 225px;
    }

    #wrapper.toggled .sidebar {
        transform: translateX(0);
        width: 64px;
    }

    #wrapper:not(.toggled) #content-wrapper {
        margin-left: 225px;
    }

    #wrapper.toggled #content-wrapper {
        margin-left: 64px;
    }
}

@media (max-width: 480px) {
    #wrapper:not(.toggled) .sidebar {
        width: 225px;
    }

    #wrapper.toggled .sidebar {
        width: 64px;
    }
}

/* Theme Toggle */
body.dark-theme {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-theme .topbar {
    background-color: #2d2d2d;
    border-bottom-color: #444;
}

body.dark-theme #content {
    background-color: #1a1a1a;
}

body.dark-theme .container-fluid {
    color: #e0e0e0;
}

body.dark-theme .sticky-footer {
    background-color: #2d2d2d;
    border-top-color: #444;
}

body.dark-theme .form-control {
    background-color: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-theme .form-control:focus {
    background-color: #2d2d2d;
    border-color: var(--primary-color);
    color: #e0e0e0;
}

body.dark-theme table {
    color: #e0e0e0;
}

body.dark-theme .table thead th {
    background-color: #2d2d2d;
    border-color: #444;
}

body.dark-theme .table-hover tbody tr:hover {
    background-color: #2d2d2d;
}

body.dark-theme .card {
    background-color: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-theme .bg-light {
    background-color: #3a3a3a !important;
}

body.dark-theme pre {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

/* Loading Indicator Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.spinner-container {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    margin: 10px 0 0 0;
}

body.dark-theme .spinner-container {
    background: #2d2d2d;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

body.dark-theme .loading-text {
    color: #e0e0e0;
}

/* Tab Styles */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
    gap: 10px;
}

.nav-tabs .nav-link {
    color: #666;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: rgba(34, 74, 190, 0.2);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: transparent;
    border-bottom-color: var(--primary-color);
}

.nav-tabs .badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
}

.tab-pane {
    transition: opacity 0.3s ease;
}

body.dark-theme .nav-tabs {
    border-bottom-color: #444;
}

body.dark-theme .nav-tabs .nav-link {
    color: #aaa;
}

body.dark-theme .nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: rgba(var(--primary-color-rgb), 0.2);
}

body.dark-theme .nav-tabs .nav-link.active {
    color: var(--primary-color);
}

/* JSON Scroll Container */
.json-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    margin: 0;
}

.json-scroll-container pre {
    margin: 0;
    padding: 0;
    background-color: transparent;
    border: none;
    font-size: 12px;
    line-height: 1.5;
}

.json-scroll-container code {
    color: #333;
    font-family: 'Courier New', monospace;
}

body.dark-theme .json-scroll-container {
    background-color: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-theme .json-scroll-container code {
    color: #e0e0e0;
}

/* Scrollbar styling for json containers */
.json-scroll-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.json-scroll-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.json-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body.dark-theme .json-scroll-container::-webkit-scrollbar-track {
    background: #444;
}

body.dark-theme .json-scroll-container::-webkit-scrollbar-thumb {
    background: #666;
}

body.dark-theme .json-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Sortable Table Headers */
.table thead th {
    vertical-align: middle;
    user-select: none;
}

.table thead th[style*="cursor: pointer"] {
    position: relative;
    font-weight: 600;
    color: var(--primary-color);
    transition: background-color 0.2s ease;
}

.table thead th[style*="cursor: pointer"]:hover {
    background-color: rgba(34, 74, 190, 0.08);
    border-radius: 4px;
}

.sort-indicator {
    font-weight: bold;
    margin-left: 5px;
    font-size: 0.85em;
    opacity: 0.7;
}

.sort-indicator:not(:empty) {
    opacity: 1;
    color: var(--primary-color);
}

body.dark-theme .table thead th[style*="cursor: pointer"] {
    color: #6c9fd8;
}

body.dark-theme .table thead th[style*="cursor: pointer"]:hover {
    background-color: rgba(108, 159, 216, 0.15);
}

