/* PDNS Console Custom CSS */

/* Bootstrap Icons Fix - Ensure proper font loading */
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css');

/* Additional Bootstrap Icons loading fixes */
@font-face {
    font-family: "bootstrap-icons";
    src: url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/fonts/bootstrap-icons.woff2") format("woff2"),
         url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/fonts/bootstrap-icons.woff") format("woff");
}

[class^="bi-"], [class*=" bi-"] {
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: -.125em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure Bootstrap Icons are visible */
.bi::before {
    display: inline-block;
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: -.125em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Remove all card styling to let themes control appearance completely */

/* Ensure background opacity classes work properly - with fallback colors */
.bg-primary.bg-opacity-10 {
    background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.1) !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(var(--bs-success-rgb, 25, 135, 84), 0.1) !important;
}

.bg-info.bg-opacity-10 {
    background-color: rgba(var(--bs-info-rgb, 13, 202, 240), 0.1) !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(var(--bs-warning-rgb, 255, 193, 7), 0.1) !important;
}

/* Additional fallback using hex colors for better compatibility */
.bg-primary.bg-opacity-10 {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.bg-info.bg-opacity-10 {
    background-color: rgba(13, 202, 240, 0.1) !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Form enhancements */
.form-floating > label {
    opacity: 0.65;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: 1;
}

/* Remove button enhancements to let theme control styling */
/* No custom button styling - let Bootstrap handle it */

/* Alert enhancements */
.alert {
    border: 0;
    border-radius: 0.35rem;
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
}

/* Responsive table */
@media (max-width: 767.98px) {
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }
    
    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .table-responsive tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
    }
    
    .table-responsive td {
        border: none;
        position: relative;
        padding-left: 50% !important;
    }
    
    .table-responsive td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        font-weight: bold;
    }
}

/* ===== LAYOUT & NAVIGATION STYLES ===== */

/* Sidebar styles */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - 48px);
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Navbar styles */
.navbar-brand {
    padding-top: .75rem;
    padding-bottom: .75rem;
}

/* Remove navbar color overrides to let themes control colors */
.navbar-nav .nav-link:hover {
    opacity: 0.8;
}

.navbar-nav .nav-link.active {
    font-weight: bold;
}

/* Let themes handle border colors */
.border-start-primary {
    border-left: .25rem solid var(--bs-primary) !important;
}

.border-start-success {
    border-left: .25rem solid var(--bs-success) !important;
}

.border-start-info {
    border-left: .25rem solid var(--bs-info) !important;
}

.border-start-warning {
    border-left: .25rem solid var(--bs-warning) !important;
}

/* Main content area */
main {
    margin-left: 0; /* Remove sidebar margin */
    padding: 1rem;
}

@media (max-width: 767.98px) {
    .sidebar {
        top: 5rem;
    }
    main {
        margin-left: 0;
    }
}

/* ===== UTILITY CLASSES ===== */

.text-xs {
    font-size: .7rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

/* ===== ICON STYLES ===== */

/* Ensure Font Awesome icons display properly */
.fas, .far, .fab, .fal, .fad, .fa {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 5 Free", "Font Awesome 5 Pro", FontAwesome !important;
    font-weight: 900;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

.far {
    font-weight: 400;
}

/* Fallback for missing icons */
.fas:before, .far:before, .fab:before {
    content: attr(data-fallback) !important;
}

/* Icon loading test */
.icon-test:after {
    content: " ✓";
    color: green;
}

/* ===== LAYOUT STRUCTURE ===== */

/* Sticky footer layout */
html, body {
    height: 100%;
}

/* Stabilize informational cards to avoid vertical shift on hover/focus */
.card.border-info {
    position: relative;
}
.card.border-info:hover {
    /* Prevent any theme hover border enlargement causing reflow */
    border-width: 1px;
}
.card.border-info .card-header {
    /* Ensure consistent padding so line-height changes don't shift layout */
    line-height: 1.2;
}

/* Prevent layout shift on info card hover */
.no-hover-effect {
    transition: none !important;
    box-shadow: none !important;
}
.no-hover-effect:hover,
.no-hover-effect:focus,
.no-hover-effect:active {
    box-shadow: none !important;
    transform: none !important;
    border-color: inherit !important;
}

/* Stronger stabilization for info card (prevents vertical reflow on hover in some Bootswatch themes) */
.no-hover-effect,
.no-hover-effect:hover,
.no-hover-effect:focus {
    border: 1px solid var(--bs-border-color, rgba(0,0,0,.125)) !important; /* consistent border */
    background-color: var(--bs-body-bg) !important; /* keep background stable */
    margin-top: 0 !important;
    margin-bottom: 1.25rem !important;
    transform: none !important;
    box-shadow: none !important;
    outline: none !important;
    position: relative;
}
.no-hover-effect * { transition: none !important; }
.no-hover-effect .card-header { padding: .55rem .85rem !important; }
.no-hover-effect .card-body { padding: .85rem .85rem !important; }
.no-hover-effect:hover .card-header, .no-hover-effect:hover .card-body { padding: .55rem .85rem !important; }

/* Fallback if theme removes border on hover */
.no-hover-effect:hover { border: 1px solid var(--bs-border-color, rgba(0,0,0,.125)) !important; }

/* Global card stabilization to prevent vertical jump on hover */
/* Card spacing stabilization: use only top margins between siblings to avoid collapse jitter */
.card {
    border-width: 1px !important;
    margin: 0 !important; /* remove individual margins */
    transition: none !important;
}
.card + .card { margin-top: 1.25rem !important; }
.card:hover, .card:focus { border-width: 1px !important; }
/* Explicitly neutralize Bootswatch hover shadows that alter box metrics */
.card:hover { box-shadow: none !important; }

/* Static cards: completely neutralize hover-induced visual/layout changes */
.static-card,
.static-card:hover,
.static-card:focus {
    border: 0 !important; /* remove border entirely */
    box-shadow: none !important;
    background-color: var(--bs-body-bg) !important;
    transform: none !important;
    margin-bottom: 1.25rem !important;
}
.static-card .card-header { padding: .55rem .85rem !important; }
.static-card .card-body { padding: .85rem .85rem !important; }

body {
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Prevent horizontal scrollbar from any wide child element */
}

.container-fluid {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
}

/* ===== THEME-FRIENDLY ENHANCEMENTS ===== */

/* Let themes control card styling completely */
/* Remove all card-header and card-footer styling */

/* ===== DASHBOARD-SPECIFIC STYLES ===== */

/* List group enhancements */
.list-group-item {
    border-left: none;
    border-right: none;
}

.list-group-item:first-child {
    border-top: none;
}

.list-group-item:last-child {
    border-bottom: none;
}

/* Use CSS variables for theme compatibility */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary) 100%) !important;
}

.card-body .row.no-gutters .col-auto {
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-xs {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Remove card styling that overrides theme styles */

/* Icon circle styling for statistics cards */
.icon-circle {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-circle i {
    font-size: 1.5rem !important;
}

/* Consistent spacing for all stat cards */
.stat-card .col-auto {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Use CSS variables for theme-compatible borders */
.border-left-primary {
    border-left: 4px solid var(--bs-primary) !important;
}

.border-start-success {
    border-left: 4px solid var(--bs-success) !important;
}

.border-start-info {
    border-left: 4px solid var(--bs-info) !important;
}

.border-start-warning {
    border-left: 4px solid var(--bs-warning) !important;
}

/* Status badges with pulse effect */
.badge.bg-success {
    animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* Responsive improvements for dashboard */
@media (max-width: 768px) {
    .hover-lift:hover {
        transform: none;
    }
    
    .card-body .row.no-gutters {
        text-align: center;
    }
    
    .card-body .row.no-gutters .col-auto {
        margin-bottom: 1rem;
    }
}

/* Disable hover-lift effects for all screen sizes */
.hover-lift,
.hover-lift:hover {
    transform: none !important;
    transition: none !important;
    box-shadow: inherit !important;
}

/* ===== ALERT & NOTIFICATION STYLES ===== */

/* Alert positioning for theme switcher notifications */
.alert-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
}

/* ===== NAVIGATION SPECIFIC STYLES ===== */

/* Navbar dropdown styling */
.navbar .dropdown-toggle {
    text-decoration: none !important;
}

/* Primary top navbar sizing & spacing (moved from inline styles) */
.navbar-main { min-height:64px; }
.navbar-main .navbar-brand { font-size:1.15rem; line-height:1; }
.navbar-main .navbar-brand .brand-logo { height:40px; max-height:42px; width:auto; }
.navbar-main .navbar-dropdown-toggle { padding-top:0.35rem; padding-bottom:0.35rem; }
.navbar-main .brand-text { max-width:220px; line-height:1; }

/* ===== FOOTER SPECIFIC STYLES ===== */

/* Full-width footer styling (revised)
   Removed previous 100vw + negative margin technique that caused horizontal overflow.
   Using standard width:100% so it aligns with page content and relies on container-fluid.
*/
.footer-full-width {
    width: 100%;
    margin: 0;
}

/* ===== LOGIN PAGE STYLES ===== */

/* Login page specific styling */
body.login-page {
    background: linear-gradient(135deg, #667eea 0%, #0d0483 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header img {
    max-height: 60px;
    margin-bottom: 1rem;
}

.login-header h2 {
    color: #333;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    margin: 0;
}

.login-page .form-floating {
    margin-bottom: 1rem;
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
}

.login-page .alert {
    border-radius: 8px;
    margin-bottom: 1rem;
}

.footer-text {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    color: #666;
    font-size: 0.875rem;
}

/* ===== DARK MODE OVERLAY STYLES ===== */

/* Dark mode CSS variables and overrides */
body.dark-mode {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #e9ecef;
    --bs-border-color: #343a40;
    --bs-secondary-bg: #2d3748;
    --bs-tertiary-bg: #343a40;
}

/* Dark mode overrides */
.dark-mode {
    background-color: #1a1a1a !important;
    color: #e9ecef !important;
}

.dark-mode .card {
    background-color: var(--bs-dark) !important;
    border-color: var(--bs-dark-border-subtle) !important;
}

/* Use theme variables for card headers in dark mode */
.dark-mode .card-header {
    border-bottom-color: var(--bs-dark-border-subtle) !important;
    color: var(--bs-white) !important;
}

.dark-mode .navbar-dark {
    background-color: #000 !important;
}

.dark-mode .bg-white {
    background-color: #2d3748 !important;
}

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

.dark-mode .text-muted {
    color: #a0aec0 !important;
}

.dark-mode .border {
    border-color: #4a5568 !important;
}

.dark-mode .list-group-item {
    background-color: #2d3748 !important;
    border-color: #4a5568 !important;
    color: #e9ecef !important;
}

.dark-mode .list-group-item:hover {
    background-color: #343a40 !important;
}

.dark-mode .table {
    color: #e9ecef !important;
}

.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > td,
.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > th {
    background-color: #343a40 !important;
}

.dark-mode .form-control {
    background-color: #343a40 !important;
    border-color: #4a5568 !important;
    color: #e9ecef !important;
}

.dark-mode .form-control:focus {
    background-color: #2d3748 !important;
    border-color: #718096 !important;
    color: #e9ecef !important;
}

.dark-mode .btn-outline-secondary {
    color: #a0aec0 !important;
    border-color: #4a5568 !important;
}

.dark-mode .btn-outline-secondary:hover {
    background-color: #4a5568 !important;
    border-color: #718096 !important;
}

.dark-mode .dropdown-menu {
    background-color: #2d3748 !important;
    border-color: #4a5568 !important;
}

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

.dark-mode .dropdown-item:hover {
    background-color: #343a40 !important;
}

.dark-mode .modal-content {
    background-color: #2d3748 !important;
    border-color: #4a5568 !important;
}

.dark-mode .modal-header {
    border-bottom-color: #4a5568 !important;
}

.dark-mode .modal-footer {
    border-top-color: #4a5568 !important;
}

/* Dark mode login page adjustments */
.dark-mode.login-page .login-container {
    background: rgba(45, 55, 72, 0.95) !important;
    color: #e9ecef !important;
}

.dark-mode.login-page .login-header h2 {
    color: #e9ecef !important;
}

.dark-mode.login-page .login-header p {
    color: #a0aec0 !important;
}

.dark-mode.login-page .footer-text {
    color: #a0aec0 !important;
    border-top-color: #4a5568 !important;
}

/* Target only layout-shifting hover effects */

/* ===== Preserve contextual backgrounds on card headers ===== */
/* Some themes or our dark-mode overlay set generic card-header backgrounds. Ensure
    contextual utilities like bg-success/bg-secondary applied to card-header stick. */
.card .card-header.bg-success { background-color: var(--bs-success) !important; }
.card .card-header.bg-secondary { background-color: var(--bs-secondary) !important; }
.card .card-header.bg-primary { background-color: var(--bs-primary) !important; }
.card .card-header.bg-warning { background-color: var(--bs-warning) !important; }
.card .card-header.bg-info { background-color: var(--bs-info) !important; }
/* Dark mode variants (same enforcement) */
body.dark-mode .card .card-header.bg-success { background-color: var(--bs-success) !important; }
body.dark-mode .card .card-header.bg-secondary { background-color: var(--bs-secondary) !important; }
body.dark-mode .card .card-header.bg-primary { background-color: var(--bs-primary) !important; }
body.dark-mode .card .card-header.bg-warning { background-color: var(--bs-warning) !important; }
body.dark-mode .card .card-header.bg-info { background-color: var(--bs-info) !important; }

/* DNS hero band — honors theme via Bootstrap CSS variables */
.dns-hero {
    /* Lighter sides -> darker middle (theme-aware) */
    background:
        radial-gradient(80% 120% at 50% 50%,
            rgba(var(--bs-primary-rgb), .95) 0%,
            rgba(var(--bs-primary-rgb), .8) 40%,
            rgba(var(--bs-primary-rgb), .45) 60%,
            rgba(var(--bs-primary-rgb), .18) 80%,
            rgba(var(--bs-primary-rgb), .04) 100%
        ),
        linear-gradient(90deg,
            rgba(var(--bs-primary-rgb), .06) 0%,
            rgba(var(--bs-primary-rgb), .06) 100%
        );
    color: var(--bs-white);
    border-radius: .75rem;
}
.dns-hero .hero-inner {
    padding: 2rem 1rem;
}
@media (min-width: 992px) {
    .dns-hero .hero-inner { padding: 3rem 2rem; }
}
.dns-hero .hero-tile {
    width: 100%;
    max-width: 960px;
    min-height: 160px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: 1.5rem;
}
.dns-hero .icon-wrap { margin-bottom: .75rem; }
.dns-hero .title { color: var(--bs-body-color); }
.dns-hero small { color: var(--bs-secondary-color); }

/* Specific fix for Search and Filters card shifting issue */
.card.mb-4:hover {
    transform: none !important;
    margin-bottom: 1.5rem !important; /* Force consistent bottom margin */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; /* Consistent shadow */
}

/* Ensure the search card doesn't change dimensions on hover */
.card.mb-4 {
    margin-bottom: 1.5rem !important; /* Force consistent bottom margin */
}

/* === Info Panel component (non-card) to avoid hover-induced layout shift === */
.info-panel { border: 0 !important; background: var(--bs-body-bg); padding: 0; margin: 0 0 1.25rem 0; }
.info-panel-title { font-weight:600; font-size:.95rem; display:flex; align-items:center; gap:.4rem; padding:.4rem .6rem .35rem .6rem; background: rgba(var(--bs-info-rgb,13,202,240),0.12); border-radius:.25rem .25rem 0 0; line-height:1.2; }
.info-panel-body { font-size:.8rem; line-height:1.25rem; padding:.65rem .75rem .75rem .75rem; border:1px solid rgba(0,0,0,.08); border-top:0; border-radius:0 0 .25rem .25rem; }
.info-panel-body ol { margin:0 0 .5rem 1.1rem; padding:0; }
.info-panel-body li { margin-bottom:.25rem; }
.info-panel-body .note { margin:0; color: var(--bs-secondary-color,#6c757d); font-size:.75rem; }
.info-panel:hover, .info-panel:focus { background: var(--bs-body-bg); }

