/**
 * Waclaude Overrides for SB Admin 2 Theme
 * Fixes specific styling issues
 */

/* Fix sidebar nav styling */
.nav > li > a {
    color: #333 !important;
}

.nav > li > a:hover,
.nav > li > a:focus {
    background-color: rgba(125, 12, 25, 0.1) !important;
    color: #7d0c19 !important;
}

/* Fix sidebar specific classes */
.sidebar .sidebar-nav.navbar-collapse {
    background-color: #f8f8f8 !important;
}

.sidebar-nav .navbar-collapse {
    padding-right: 0;
    padding-left: 0;
}

/* Fix active states */
.sidebar ul li.active {
    background-color: transparent !important;
}

.sidebar ul li.active > a,
.sidebar ul li.active > a:hover,
.sidebar ul li.active > a:focus {
    background-color: #7d0c19 !important;
    color: white !important;
}

/* Fix icon colors in active state */
.sidebar ul li.active > a i,
.sidebar ul li.active > a .fa,
.sidebar ul li.active > a .glyphicon {
    color: white !important;
}

/* Fix metismenu backgrounds */
.metismenu {
    background: transparent !important;
}

.metismenu li {
    background: transparent !important;
}

.metismenu > li > a {
    color: #333 !important;
    background: transparent !important;
}

.metismenu > li.active > a {
    background-color: #7d0c19 !important;
    color: white !important;
}

/* Fix nav-second-level styling */
.nav-second-level {
    background-color: #f0f0f0 !important;
}

.nav-second-level li a {
    color: #333 !important;
    padding-left: 37px;
}

.nav-second-level li.active > a {
    background-color: #7d0c19 !important;
    color: white !important;
}

/* Fix top navbar */
.navbar-top-links li a {
    color: #333 !important;
}

.navbar-top-links li a:hover,
.navbar-top-links li a:focus {
    background-color: rgba(125, 12, 25, 0.05) !important;
}

/* Fix dropdown menus */
.dropdown-menu {
    background-color: white !important;
    border: 1px solid #e7e7e7 !important;
}

.dropdown-menu > li > a {
    color: #333 !important;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
    background-color: rgba(125, 12, 25, 0.1) !important;
    color: #7d0c19 !important;
}

/* Fix panel headers */
.panel-heading {
    background-color: #f8f8f8 !important;
    color: #333 !important;
}

/* Fix buttons in panels - override DefectDojo's problematic styling */
.panel-default .btn-primary {
    background-color: #7d0c19 !important;
    border: 1px solid #7d0c19 !important;
    color: white !important;
}

.panel-default .btn-primary:hover {
    background-color: #a01424 !important;
    border: 1px solid #a01424 !important;
    color: white !important;
}

/* Fix all button text visibility issues */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    color: white !important;
}

.btn-warning,
.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active {
    color: white !important;
}

.btn-danger,
.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
    color: white !important;
}

.btn-success,
.btn-success:hover,
.btn-success:focus,
.btn-success:active {
    color: white !important;
}

.btn-info,
.btn-info:hover,
.btn-info:focus,
.btn-info:active {
    color: white !important;
}

.btn-default,
.btn-default:hover,
.btn-default:focus,
.btn-default:active {
    background-color: #e7e7e7 !important;
    color: #333 !important;
}

/* Ensure button icons are visible */
.btn i,
.btn .fa,
.btn .glyphicon {
    color: inherit !important;
}

/* Fix button sizes and padding */
.btn {
    min-height: 34px;
    padding: 6px 12px !important;
    font-size: 14px !important;
    line-height: 1.42857143 !important;
}

.btn-sm {
    min-height: 30px;
    padding: 5px 10px !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
}

.btn-lg {
    min-height: 46px;
    padding: 10px 16px !important;
    font-size: 18px !important;
    line-height: 1.3333333 !important;
}

/* Ensure minimum contrast ratios for WCAG compliance */
.btn-primary {
    background-color: #7d0c19 !important;
}

.btn-warning {
    background-color: #f38a00 !important;
}

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

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

.btn-success {
    background-color: #0d6e0d !important;
}

/* Focus states for accessibility */
.btn:focus,
.btn:active:focus,
.btn.active:focus {
    outline: 3px solid rgba(125, 12, 25, 0.25) !important;
    outline-offset: 2px;
}

/* Ensure buttons in dark panel headers are visible */
.panel-default > .panel-heading .btn,
.panel-default > .panel-heading .btn-primary {
    background-color: #7d0c19 !important;
    border: 1px solid #7d0c19 !important;
    color: white !important;
    padding: 4px 12px;
    font-weight: 500;
}

.panel-default > .panel-heading .btn:hover,
.panel-default > .panel-heading .btn-primary:hover {
    background-color: #f38a00 !important;
    border: 1px solid #f38a00 !important;
    color: white !important;
}

/* Fix breadcrumbs */
.breadcrumb {
    background-color: #f8f8f8 !important;
}

.breadcrumb > li {
    color: #333 !important;
}

.breadcrumb > li > a {
    color: #7d0c19 !important;
}

/* Fix pagination */
.pagination > li > a,
.pagination > li > span {
    color: #7d0c19 !important;
}

.pagination > .active > a,
.pagination > .active > span {
    background-color: #7d0c19 !important;
    border-color: #7d0c19 !important;
}

/* Fix nav-tabs */
.nav-tabs > li > a {
    color: #333 !important;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    color: #333 !important;
    border-bottom: 3px solid #7d0c19 !important;
}

/* Ensure text is readable in all containers */
.text-muted {
    color: #666 !important;
}

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

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

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

.text-success {
    color: #0d6e0d !important;
}

/* Fix any remaining visibility issues */
a {
    color: #7d0c19 !important;
}

a:hover,
a:focus {
    color: #f38a00 !important;
}

/* Ensure proper text color in all contexts */
p, span, div, td, th, li {
    color: inherit;
}

/* Fix table text colors */
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tbody > tr > td {
    color: #333 !important;
}

/* DataTables specific fixes */
table.dataTable thead th,
table.dataTable thead td {
    background-color: #f8f8f8 !important;
    color: #333 !important;
    border-bottom: 2px solid #7d0c19 !important;
}

table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
    background-color: #fafafa !important;
}

/* Fix tag and badge colors for better contrast */
.label-default {
    background-color: #e7e7e7 !important;
    color: #333 !important;
}

.label-primary {
    background-color: #7d0c19 !important;
    color: white !important;
}

.label-success {
    background-color: #0d6e0d !important;
    color: white !important;
}

.label-warning {
    background-color: #f38a00 !important;
    color: white !important;
}

.label-danger {
    background-color: #a01424 !important;
    color: white !important;
}

.label-info {
    background-color: #5bc0de !important;
    color: white !important;
}

/* Tags in tables - ensure good contrast */
.tag, .badge {
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Product tags specifically */
.tag-product,
.product-tags span {
    background-color: #e8f4fd !important;
    color: #0066cc !important;
    border: 1px solid #b3d9f2 !important;
    padding: 2px 8px;
    margin: 2px;
    display: inline-block;
    border-radius: 4px;
}

/* Risk tags */
.tag-critical,
.risk-critical {
    background-color: #ffe6e6 !important;
    color: #a01424 !important;
    border: 1px solid #ffcccc !important;
}

.tag-high,
.risk-high {
    background-color: #ffebe6 !important;
    color: #7d0c19 !important;
    border: 1px solid #ffd4cc !important;
}

.tag-medium,
.risk-medium {
    background-color: #fff4e6 !important;
    color: #cc6600 !important;
    border: 1px solid #ffe4cc !important;
}

.tag-low,
.risk-low {
    background-color: #fff9e6 !important;
    color: #996600 !important;
    border: 1px solid #ffeecc !important;
}

/* Links in tables should be visible */
.table a {
    color: #7d0c19 !important;
    font-weight: 500;
}

.table a:hover {
    color: #f38a00 !important;
    text-decoration: underline;
}

/* Fix navbar overlap with main content */
@media (max-width: 767px) {
    /* Mobile view - navbar is not fixed to side */
    #page-wrapper {
        padding-top: 20px !important;
        margin-top: 120px !important;
    }
}

@media (min-width: 768px) {
    /* Desktop view - sidebar is visible */
    #page-wrapper {
        padding-top: 20px !important;
        margin-top: 20px !important;
    }
    
    /* When sidebar is minimized */
    body.min #page-wrapper {
        padding-top: 20px !important;
        margin-top: 20px !important;
    }
}

/* Fix sidebar overlap with navbar */
.navbar-default.sidebar,
div.navbar-default.sidebar {
    position: fixed !important;
    top: 51px !important; /* Position below navbar (navbar height is typically 50px) */
    left: 0;
    width: 175px;
    height: calc(100% - 51px) !important; /* Adjust height to account for navbar */
    overflow-y: auto;
    z-index: 1000;
}

/* Adjust minimized sidebar position */
body.min div.navbar-default.sidebar {
    top: 51px !important;
    width: 50px;
    height: calc(100% - 51px) !important;
}

/* Fix sidebar on mobile */
@media (max-width: 767px) {
    .navbar-default.sidebar,
    div.navbar-default.sidebar {
        position: relative !important;
        top: 0 !important;
        width: 100%;
        height: auto !important;
    }
}

/* Fix links in card/panel bodies for visibility */
.card-body a:not(.btn),
.panel-body a:not(.btn) {
    color: #7d0c19 !important;
    text-decoration: underline;
    font-weight: 500;
}

.card-body a:not(.btn):hover,
.panel-body a:not(.btn):hover {
    color: #f38a00 !important;
}

/* Fix buttons in card bodies - with maximum specificity */
.card-body .btn-primary,
.panel-body .btn-primary,
.card .card-body .btn.btn-primary,
.panel .panel-body .btn.btn-primary {
    background-color: #7d0c19 !important;
    border-color: #7d0c19 !important;
    color: white !important;
}

.card-body .btn-primary:hover,
.panel-body .btn-primary:hover,
.card .card-body .btn.btn-primary:hover,
.panel .panel-body .btn.btn-primary:hover {
    background-color: #961020 !important;
    border-color: #961020 !important;
    color: white !important;
}

/* Specific fix for View Test Results button */
a.btn.btn-primary {
    color: white !important;
}

.card-body .btn-secondary,
.panel-body .btn-secondary {
    background-color: #f38a00 !important;
    border-color: #f38a00 !important;
    color: white !important;
}

.card-body .btn-secondary:hover,
.panel-body .btn-secondary:hover {
    background-color: #d47700 !important;
    border-color: #d47700 !important;
    color: white !important;
}

/* Fix all button types in card bodies */
.card-body .btn,
.panel-body .btn {
    font-weight: 500 !important;
}

.card-body .btn-info,
.panel-body .btn-info {
    background-color: #17a2b8 !important;
    border-color: #17a2b8 !important;
    color: white !important;
}

.card-body .btn-danger,
.panel-body .btn-danger {
    background-color: #a01424 !important;
    border-color: #a01424 !important;
    color: white !important;
}

.card-body .btn-success,
.panel-body .btn-success {
    background-color: #0d6e0d !important;
    border-color: #0d6e0d !important;
    color: white !important;
}

.card-body .btn-warning,
.panel-body .btn-warning {
    background-color: #f38a00 !important;
    border-color: #f38a00 !important;
    color: white !important;
}

/* Special fix for scanning dashboard where background might be dark */
.severity-card .card-body a,
.severity-card-high .card-body a,
.severity-card-critical .card-body a {
    color: white !important;
    text-decoration: underline;
}

.severity-card .card-body a:hover,
.severity-card-high .card-body a:hover,
.severity-card-critical .card-body a:hover {
    color: #ffd700 !important;
}