/* Desert Eagle Ops custom styles. Load AFTER style.min.css on every page. */
/* Small additions only; everything else uses the Darkone template as-is.  */

/* ---------- Sidebar logo (text logo, no images) ---------- */

.logo-box .de-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    line-height: normal;
    vertical-align: middle;
}

.logo-box .logo-sm.de-logo {
    justify-content: center;
    height: var(--bs-topbar-height);
}

.logo-text {
    display: inline-block;
    font-family: "Play", sans-serif;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 1px;
    line-height: 1.1;
    text-align: left;
    white-space: nowrap;
}

.logo-dark .logo-text {
    color: var(--bs-dark);
}

.logo-light .logo-text {
    color: #ffffff;
}

.logo-text .text-primary {
    color: var(--bs-primary) !important;
}

.logo-text .logo-sub {
    display: block;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 3px;
    color: var(--bs-secondary-color);
}

/* ---------- Topbar ---------- */

/* Operator avatar (initials block, 32px like the template avatar img) */
.de-operator-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

/* "Data as of" chip, filled by de-common.js; hidden while empty */
.de-asof-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 50rem;
    font-family: "Play", sans-serif;
    font-size: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    color: var(--bs-secondary-color);
    background: rgba(var(--bs-primary-rgb), 0.12);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.25);
}

.de-asof-chip:empty {
    display: none;
}

/* Pulse used by de-common v1.1 on the as-of chip when the next update lands
   while the page is visible (instead of a hard reload). */
.de-pulse {
    animation: de-pulse 1.2s ease-in-out 3;
}

@keyframes de-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0.55);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(var(--bs-primary-rgb), 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0);
    }
}

/* ---------- Page title ---------- */

/* Breadcrumb section item is informational, not a link; keep the anchor look */
.page-title-box .breadcrumb-item > span {
    color: var(--bs-body-color);
}

/* Note: source chips, empty states, and caps progress rows are rendered by the
   de-*.js pages with inline Bootstrap utility classes (badge badge-soft-*,
   .progress, text-center blocks). No dedicated css families exist for them;
   css and js are aligned on the template idioms. */

/* ================================================================== */
/* DE-OPS ENHANCEMENTS — print, scrollbars, tables, cards, animations  */
/* ================================================================== */

/* ---------- 1. Print styles ---------- */

@media print {
    .app-sidebar,
    .app-topbar,
    .footer,
    .button-toggle-menu,
    .animated-stars,
    .de-asof-chip,
    #light-dark-mode,
    #page-header-notifications-dropdown,
    #page-header-user-dropdown,
    [data-simplebar] {
        display: none !important;
    }

    .app-wrapper {
        display: block !important;
    }

    .page-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    body,
    .page-content,
    .card,
    .card-body,
    .card-header {
        background: #ffffff !important;
        color: #000000 !important;
        border-color: #cccccc !important;
        box-shadow: none !important;
    }

    .card {
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }

    h1, h2, h3, h4, h5, h6,
    p, td, th, span, li {
        color: #000000 !important;
    }

    a {
        text-decoration: underline;
        color: #000000 !important;
    }

    .table {
        color: #000 !important;
    }

    .badge {
        border: 1px solid #999 !important;
        color: #000 !important;
        background: #eee !important;
    }
}

/* ---------- 2. Custom scrollbar styling ---------- */

/* Thin themed scrollbar for dark mode */
[data-bs-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #1d2329;
    border-radius: 4px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3a4551;
    border-radius: 4px;
    border: 2px solid #1d2329;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #4a5663;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-corner {
    background: #1d2329;
}

/* Firefox */
[data-bs-theme="dark"] * {
    scrollbar-width: thin;
    scrollbar-color: #3a4551 #1d2329;
}

/* Light mode scrollbar (slightly thinner than default) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f8f7fa;
}

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

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

/* ---------- 3. Table responsive overflow wrapper ---------- */
/* Usage: wrap a <table> in <div class="table-responsive-overflow"> */

.table-responsive-overflow {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.table-responsive-overflow table {
    min-width: 600px;
}

@media (max-width: 575.98px) {
    .table-responsive-overflow table {
        min-width: 500px;
    }
}

/* ---------- 4. Card hover effects ---------- */

.card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* ---------- 4a. Table row hover highlight ---------- */

.table tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.06) !important;
    transition: background-color 0.15s ease;
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.1) !important;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}

[data-bs-theme="dark"] .card:hover {
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.4);
}

/* Don't lift cards inside dropdowns or nav */
.dropdown-menu .card:hover,
.navbar .card:hover {
    transform: none;
    box-shadow: none;
}

/* ---------- 5. Loading skeleton / shimmer ---------- */
/* Add class .de-skeleton to a placeholder element while data loads */

.de-skeleton {
    position: relative;
    overflow: hidden;
    background-color: rgba(var(--bs-secondary-rgb), 0.15);
    border-radius: 0.375rem;
    min-height: 1rem;
}

.de-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(var(--bs-body-color-rgb), 0.08),
        transparent
    );
    animation: de-shimmer 1.6s infinite;
}

.de-skeleton-line {
    height: 0.875rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.de-skeleton-line:last-child {
    width: 70%;
    margin-bottom: 0;
}

.de-skeleton-block {
    height: 3rem;
    border-radius: 0.375rem;
}

@keyframes de-shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* ---------- 6. Better status badge colors in dark mode ---------- */
/* Increase text legibility for soft badges in dark mode */

[data-bs-theme="dark"] .badge-soft-success {
    color: #7ae7a0 !important;
    background-color: rgba(33, 215, 96, 0.22) !important;
}

[data-bs-theme="dark"] .badge-soft-danger {
    color: #f48479 !important;
    background-color: rgba(237, 50, 31, 0.22) !important;
}

[data-bs-theme="dark"] .badge-soft-warning {
    color: #f6be95 !important;
    background-color: rgba(240, 147, 78, 0.22) !important;
}

[data-bs-theme="dark"] .badge-soft-info {
    color: #76d0fb !important;
    background-color: rgba(26, 176, 248, 0.22) !important;
}

[data-bs-theme="dark"] .badge-soft-primary {
    color: #b2a4fe !important;
    background-color: rgba(126, 103, 254, 0.22) !important;
}

[data-bs-theme="dark"] .badge-soft-secondary {
    color: #aab8c5 !important;
    background-color: rgba(131, 145, 162, 0.18) !important;
}

/* ---------- 7. Sidebar active link indicator ---------- */
/* Left border accent on the active nav-link */

.app-sidebar .navbar-nav .nav-item .nav-link.active {
    position: relative;
    border-left: 3px solid var(--bs-primary);
    padding-left: calc(var(--bs-sidebar-item-padding-x) - 3px);
}

.de-jobs-sidebar-badge {
    min-width: 2.4rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ---------- 8. Mobile sidebar backdrop overlay ---------- */
/* The template JS creates an .offcanvas-backdrop — style it for our dark theme */

.sidebar-enable .offcanvas-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 1 !important;
    z-index: 1050;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        z-index: 1055;
    }
}

/* ---------- 9. KPI counter numbers: tabular-nums ---------- */
/* Prevents digit-width jitter when counters animate */

.counter-value,
h3 .counter-value,
.de-kpi-num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* Also apply to KPI headings that contain counter spans */
.card-body h3:has(.counter-value) {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ---------- 10. Code block styling ---------- */

code {
    padding: 0.15em 0.4em;
    font-size: 0.85em;
    font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
    background-color: rgba(var(--bs-body-color-rgb), 0.08);
    border-radius: 0.25rem;
    color: var(--bs-code-color);
}

pre {
    padding: 0.75rem 1rem;
    background-color: rgba(var(--bs-body-color-rgb), 0.06);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    overflow-x: auto;
    font-size: 0.8125rem;
    line-height: 1.5;
}

pre code {
    padding: 0;
    background: none;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}

/* ---------- 11. Empty state styling ---------- */

.de-empty-state,
.de-jobs-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--bs-secondary-color);
}

.de-empty-state iconify-icon,
.de-empty-state .de-empty-icon,
.de-jobs-empty iconify-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.de-empty-state p,
.de-jobs-empty p {
    margin-bottom: 0;
    font-size: 0.875rem;
}

/* ---------- 12. Focus-visible styles for keyboard navigation ---------- */

*:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Don't interfere with Bootstrap's custom focus rings on form controls */
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
    outline: none;
}

/* Ensure focus ring is visible in dark mode */
[data-bs-theme="dark"] *:focus-visible {
    outline-color: #b2a4fe;
}

/* ---------- 13. Chart container min-height ---------- */
/* Prevent layout shift before chart renders */

.apex-charts,
[id$="-chart"].apex-charts {
    min-height: 280px;
}

/* ---------- 14. Smooth transitions on theme toggle ---------- */

body,
.card,
.app-sidebar,
.app-topbar,
.page-content,
.footer,
.form-control,
.form-select,
.table,
.badge,
code,
pre {
    transition: background-color 0.3s ease, color 0.3s ease,
        border-color 0.3s ease, box-shadow 0.3s ease;
}

/* The toggle button itself gets a spin */
#light-dark-mode iconify-icon {
    transition: transform 0.4s ease, opacity 0.3s ease;
}

#light-dark-mode:active iconify-icon {
    transform: rotate(180deg);
}

/* ---------- 15. Better mobile search bar styling ---------- */

@media (max-width: 767.98px) {
    /* Make the search form visible and usable on mobile */
    .app-search.d-none.d-md-block {
        display: flex !important;
        flex: 1 1 auto;
        max-width: 100%;
    }

    .app-topbar .app-search .form-control {
        height: 36px;
        border-radius: 18px;
        font-size: 0.8125rem;
    }

    .app-topbar .app-search .search-widget-icon {
        font-size: 16px;
        left: 10px;
    }
}

/* ---------- 16. Fade-in animation for page content load ---------- */

.page-content {
    animation: de-fade-in 0.35s ease-out;
}

@keyframes de-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .page-content {
        animation: none;
    }

    .card {
        transition: none;
    }

    .de-skeleton::after {
        animation: none;
    }
}

/* ================================================================== */
/* DE-OPS UX OVERHAUL — search bar, sortable headers, empty state,     */
/* breadcrumb, and solid status badge colors.                          */
/* ================================================================== */

/* ---------- 17. Search / filter bar ---------- */

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-bar .form-control {
    padding-left: 2.25rem;
}

.search-bar iconify-icon,
.search-bar .search-widget-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--bs-secondary-color);
    pointer-events: none;
}

/* ---------- 18. Sortable table headers ---------- */

.sortable-header,
th.de-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.sortable-header:hover,
th.de-sortable:hover {
    color: var(--bs-primary);
    background-color: rgba(var(--bs-primary-rgb), 0.06);
}

.sortable-header .de-sort-indicator,
th.de-sortable .de-sort-indicator {
    font-size: 0.75em;
    margin-left: 0.25rem;
}

th.de-sorted {
    color: var(--bs-primary);
}

/* ---------- 19. Empty state ---------- */

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--bs-secondary-color);
}

.empty-state iconify-icon {
    display: block;
    font-size: 2.75rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state h5 {
    margin-bottom: 0.25rem;
}

.empty-state p {
    margin-bottom: 0;
    font-size: 0.875rem;
}

/* ---------- 20. Breadcrumb ---------- */

.breadcrumb {
    font-size: 0.8125rem;
    letter-spacing: 0.2px;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--bs-secondary-color);
}

.breadcrumb-item a {
    color: var(--bs-secondary-color);
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-item a:hover {
    color: var(--bs-primary);
}

.breadcrumb-item.active {
    color: var(--bs-body-color);
    font-weight: 500;
}

/* ---------- 21. Solid status badge colors ---------- */
/* Distinct from the template's soft badges: strong, high-contrast fills */

.badge-success {
    color: #ffffff !important;
    background-color: #17c553 !important;
}

.badge-info {
    color: #ffffff !important;
    background-color: #1ab0f8 !important;
}

.badge-warning {
    color: #212529 !important;
    background-color: #f0c14e !important;
}

.badge-danger {
    color: #ffffff !important;
    background-color: #ed321f !important;
}

/* ================================================================== */
/* DE-OPS UX OVERHAUL — round 2: dashboard KPI cards, keyboard          */
/* shortcuts overlay + hint button, expandable issue rows, and inline   */
/* filter/detail links. Backs the classes wired up in de-index.js,      */
/* de-common.js, de-issues.js, de-agents.js and de-jobs.js.             */
/* ================================================================== */

/* ---------- 22. Dashboard KPI cards (larger, gradient, hover) ---------- */
/* JS (de-index.js wireKpiLinks) tags each KPI card .de-kpi-card and adds  */
/* .de-kpi-pressed briefly on click for a press animation.                */

.de-kpi-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(var(--bs-primary-rgb), 0.12);
    background-image: linear-gradient(135deg,
        rgba(var(--bs-primary-rgb), 0.07) 0%,
        rgba(var(--bs-primary-rgb), 0) 55%);
    transition: transform 0.2s ease, box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.de-kpi-card:hover,
.de-kpi-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 0.75rem 1.5rem rgba(var(--bs-primary-rgb), 0.18);
    border-color: rgba(var(--bs-primary-rgb), 0.35);
}

/* Bigger, bolder KPI numbers on the dashboard cards */
.de-kpi-card h3 {
    font-size: 2.15rem;
    line-height: 1.1;
    font-weight: 600;
}

/* Accent bar that sweeps in along the bottom edge on hover */
.de-kpi-card::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: var(--bs-primary);
    transition: transform 0.25s ease;
}

.de-kpi-card:hover::after,
.de-kpi-card:focus-visible::after {
    transform: scaleX(1);
}

.de-kpi-pressed {
    animation: de-kpi-press 0.28s ease;
}

@keyframes de-kpi-press {
    0%   { transform: scale(1); }
    40%  { transform: scale(0.97); }
    100% { transform: scale(1); }
}

/* ---------- 23. Keyboard shortcuts overlay + hint button ---------- */
/* Built on demand by de-common.js; hidden until it gains .de-open.        */

.de-shortcuts-overlay {
    position: fixed;
    inset: 0;
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.de-shortcuts-overlay.de-open {
    opacity: 1;
    visibility: visible;
}

.de-shortcuts-panel {
    width: 100%;
    max-width: 460px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color);
    border-radius: 10px;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.4);
    transform: translateY(12px);
    transition: transform 0.2s ease;
}

.de-shortcuts-overlay.de-open .de-shortcuts-panel {
    transform: translateY(0);
}

.de-shortcuts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.de-shortcuts-body {
    padding: 0.5rem 1.1rem 1rem;
}

.de-shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
}

.de-shortcut-row:last-child {
    border-bottom: 0;
}

.de-shortcut-keys {
    flex-shrink: 0;
    white-space: nowrap;
}

.de-shortcut-desc {
    color: var(--bs-secondary-color);
    font-size: 0.8125rem;
    text-align: right;
}

.de-shortcut-keys kbd,
.de-shortcuts-panel kbd {
    display: inline-block;
    min-width: 1.4em;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    font-family: var(--bs-font-monospace, monospace);
    text-align: center;
    color: var(--bs-body-color);
    background: rgba(var(--bs-primary-rgb), 0.08);
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    box-shadow: 0 1px 0 var(--bs-border-color);
}

.de-kbd-sep {
    margin: 0 0.25rem;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
}

/* Fixed "Shortcuts ?" hint button, opt-in per page (dashboard init). */
.de-shortcut-hint-btn {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 1030;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.8125rem;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.de-shortcut-hint-btn:hover {
    opacity: 1;
    transform: translateY(-2px);
    color: var(--bs-primary);
}

.de-shortcut-hint-btn kbd {
    padding: 0.05rem 0.35rem;
    font-size: 0.7rem;
    background: rgba(var(--bs-primary-rgb), 0.1);
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
}

@media (max-width: 575.98px) {
    .de-shortcut-hint-btn .de-hint-label {
        display: none;
    }
}

/* ---------- 24. Expandable issue rows ---------- */
/* de-issues.js marks summary rows .de-issue-row and toggles .de-issue-open */

.de-issue-row {
    cursor: pointer;
}

.de-issue-row:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.de-issue-caret iconify-icon {
    display: inline-block;
    transition: transform 0.2s ease;
}

.de-issue-row.de-issue-open {
    background-color: rgba(var(--bs-primary-rgb), 0.06);
}

.de-issue-row.de-issue-open .de-issue-caret iconify-icon {
    transform: rotate(90deg);
}

.de-issue-detail > td {
    background-color: rgba(var(--bs-primary-rgb), 0.03);
}

/* ---------- 25. Inline filter / detail links ---------- */
/* Agent names (de-agents.js), score bands and company names (de-jobs.js).  */

.de-agent-link,
.de-score-filter,
.de-company-filter {
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.de-agent-link:hover,
.de-score-filter:hover,
.de-company-filter:hover {
    color: var(--bs-primary);
    border-bottom-color: var(--bs-primary);
}

/* ---------- 26. Reduced-motion: disable round-2 transforms ---------- */

@media (prefers-reduced-motion: reduce) {

    .de-kpi-card,
    .de-kpi-card:hover,
    .de-kpi-card:focus-visible,
    .de-shortcut-hint-btn,
    .de-shortcut-hint-btn:hover,
    .de-shortcuts-panel {
        transition: none;
        transform: none;
    }

    .de-kpi-pressed {
        animation: none;
    }
}
