#wp-admin-bar-wpsp_view_report .switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Rainbow border animation class */
#wp-admin-bar-wpsp_view_report .rainbow-border,
.sitepulse_css_class .rainbow-border {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
}

#wp-admin-bar-wpsp_view_report .rainbow-border::before,
.sitepulse_css_class .rainbow-border::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -2px;
    right: -2px;
    bottom: -4px;
    background: conic-gradient(
        #80ff00 0deg,
        #00ff00 120deg,
        #00ff80 150deg,
        #00ffff 180deg,
        #0080ff 210deg,
        #0000ff 240deg
    );
    border-radius: 26px;
    z-index: -1;
    animation: rainbow-rotate 0.5s linear infinite;
    transition: all 0.3s ease;
}

#wp-admin-bar-wpsp_view_report .rainbow-border::after,
.sitepulse_css_class .rainbow-border::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: #212529;
    border-radius: 24px;
    z-index: -1;
}

#wp-admin-bar-wpsp_view_report .rainbow-border:hover::before,
.sitepulse_css_class .rainbow-border:hover::before {
    animation-duration: 1s;
    top: -6px;
    left: -3px;
    right: -3px;
    bottom: -6px;
}

@keyframes rainbow-rotate {
    20% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

#wp-admin-bar-wpsp_view_report .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

#wp-admin-bar-wpsp_view_report .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555555;
    border: 1px solid #777777;
    transition: .3s;
}

#wp-admin-bar-wpsp_view_report .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    top: 2px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: .3s;
}

#wp-admin-bar-wpsp_view_report input:checked + .slider {
    background-color: #00d4aa;
    border-color: #00b894;
}

#wp-admin-bar-wpsp_view_report input:focus + .slider {
    box-shadow: 0 0 2px #00d4aa;
    outline: none;
}

#wp-admin-bar-wpsp_view_report input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

#wp-admin-bar-wpsp_view_report .slider.round {
    border-radius: 24px;
}

#wp-admin-bar-wpsp_view_report .slider.round:before {
    border-radius: 50%;
}

#wp-admin-bar-wpsp_view_report .switch-container {
    display: flex;
    margin: 2px 0;
    background: transparent;
    border: none;
    min-width: 200px;
}

#wp-admin-bar-wpsp_view_report .sitepulse-container .sitepulse-ontracking {
    text-align: center;
}

#wp-admin-bar-wpsp_view_report .switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 6px;
    font-size: 13px;
    font-weight: 400;
    color: #cbd5e1;
    line-height: 24px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

#wp-admin-bar-wpsp_view_report .switch-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

#wp-admin-bar-wpsp_view_report .switch-item:last-child {
    border-bottom: none;
}

#wp-admin-bar-wpsp_view_report .switch-label {
    flex-grow: 1;
    margin-right: 8px;
    margin-left: 2px;
    font-size: 12.5px;
}

/* Admin Bar Sitepulse */
/* Constrain admin bar node to 130x30px */
#wp-admin-bar-wpsp > .ab-item {
    display:inline-flex !important;
    align-items:center;
    gap:6px;
    padding:0 !important;
    color:#e6f7ff !important;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
}

#wp-admin-bar-wpsp > .ab-item .wshp-pill{
    display: flex;
    align-items: center;
}

/* Left icon small square */
#wp-admin-bar-wpsp .wshp-left-icon {
    width:22px;
    height:22px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:5px;
    background: linear-gradient(180deg,#0f3a55,#062433);
    box-shadow: inset 0 -4px 8px rgba(255,255,255,0.02), 0 4px 10px rgba(0,0,0,0.45);
    color:#8fe9ff;
    flex:0 0 22px;
}

/* Compact label and badge */
#wp-admin-bar-wpsp .wshp-label {
    font-weight:600;
    color:#e6f7ff;
    font-size:11px;
    line-height:1;
    display:inline-block;
    margin:0;
    padding:0 3px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* Tiny circular count */
#wp-admin-bar-wpsp .wshp-count {
    display:inline-block;
    min-width:16px;
    height:16px;
    line-height:16px;
    font-size:10px;
    text-align:center;
    background:#ff6b6b;
    color:#fff;
    padding:0 4px;
    border-radius:7px;
    margin-left:6px;
}

/* Tiny circular count */
#wp-admin-bar-wpsp .wshp-site-load-time {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    font-size: 10px;
    text-align: center;
    background: #c4cebf26;
    color: #fff;
    padding: 0 4px;
    border-radius: 7px;
    margin-left: 6px;
}

#wp-admin-bar-wpsp .wshp-site-load-time.green {
    color: #04ff00;
}

#wp-admin-bar-wpsp .wshp-site-load-time.yellow {
    color: #ffec00;
}

#wp-admin-bar-wpsp .wshp-site-load-time.red {
    color: #ff3b3b;
}

.wpsp-stats {
    background:#776bff !important;
}

/* Dropdown: keep compact and readable; width limited so it remains small */
#wp-admin-bar-wpsp .ab-submenu {
    background: rgba(12,16,20,0.98);
    border-radius:10px;
    padding:6px 8px;
    min-width: 280px;
    box-shadow: 0 16px 40px rgba(2,8,16,0.85);
    border: 1px solid rgba(255,255,255,0.06);
}

/* Make each dropdown row compact */
#wp-admin-bar-wpsp .ab-submenu .ab-item {
    background:transparent;
    padding:6px 10px;
    min-width: 100% !important;
    height: auto !important;
    border-radius: 6px;
    font-size: 13px;
    color: #c8d6e5 !important;
    transition: background 0.15s ease;
}

#wp-admin-bar-wpsp .ab-submenu > li {
    margin: 1px 0;
}

/* Dashboard link: subtle accent */
#wp-admin-bar-wpsp .ab-submenu > li:first-child > .ab-item {
    font-weight: 600;
    color: #e2e8f0 !important;
}

/* Separator before Plugin Manager & Recent Errors */
#wp-admin-bar-wpsp > .ab-sub-wrapper .ab-submenu > li#wp-admin-bar-sitepulse_plugin_manager,
#wp-admin-bar-wpsp > .ab-sub-wrapper .ab-submenu > li#wp-admin-bar-sitepulse_top_errors {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

/* Event row layout tuned for tight space */
#wp-admin-bar-wpsp .wshp-event-row {
    display:flex;
    gap:8px;
    align-items:flex-start;
    padding:4px 0;
}

#wp-admin-bar-wpsp .wshp-ms {
    min-width:56px;
    text-align:right;
    color:#ff8b8b;
    font-weight:700;
    font-family:Menlo,Consolas,monospace;
    font-size:12px;
    flex:0 0 56px;
}

/* Host and meta: truncate aggressively to fit */
#wp-admin-bar-wpsp .wshp-host {
    color:#e6eef6;
    font-size:12px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width:60px;
}
#wp-admin-bar-wpsp .wshp-meta {
    color:#9fb2bd;
    font-size:10px;
    margin-top:3px;
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width:60px;
}

/* Hover states */
#wp-admin-bar-wpsp .ab-submenu .ab-item:hover,
#wp-admin-bar-wpsp .ab-submenu .ab-item:focus {
    background: rgba(255,255,255,0.06) !important;
    color: #f1f5f9 !important;
    border-radius: 6px;
}

/* Ensure SVGs inherit color and do not overflow */
#wp-admin-bar-wpsp svg { display:block; width:14px; height:14px; color:inherit; }

/* Monospace timings */
.wshp-mono{ font-family:Menlo,Consolas,monospace; }

/* ------------------------------------ SitePulse Admin Bar Menus ------------------------------------ */
#wp-admin-bar-sitepulse_plugin_manager > .ab-item,
#wp-admin-bar-sitepulse_top_errors > .ab-item {
    height: auto !important;
    line-height: 1 !important;
    padding: 7px 10px !important;
    border-radius: 8px;
    margin: 0;
    color: #c8d6e5 !important;
    background: transparent;
    border: none;
    box-shadow: none;
    transition: background 0.15s ease;
}

#wp-admin-bar-sitepulse_plugin_manager > .ab-item:hover,
#wp-admin-bar-sitepulse_plugin_manager > .ab-item:focus,
#wp-admin-bar-sitepulse_top_errors > .ab-item:hover,
#wp-admin-bar-sitepulse_top_errors > .ab-item:focus {
    color: #f1f5f9 !important;
    background: rgba(255,255,255,0.06);
    border: none;
}

#wp-admin-bar-sitepulse_plugin_manager .sp-pm-bar-item,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-trigger {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

#wp-admin-bar-sitepulse_plugin_manager .sp-pm-bar-icon,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: rgba(59, 130, 246, 0.2);
    color: #7dd3fc;
}

#wp-admin-bar-sitepulse_plugin_manager .sp-pm-bar-icon .dashicons,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-trigger-icon,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card-icon {
    font-family: dashicons !important;
    font-style: normal;
    font-weight: 400;
    text-transform: none;
    speak: none;
    display: inline-block;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#wp-admin-bar-sitepulse_plugin_manager .sp-pm-bar-icon .dashicons,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-trigger-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

#wp-admin-bar-sitepulse_plugin_manager .sp-pm-bar-label,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-trigger-label {
    font-size: 13px;
    font-weight: 500;
    color: inherit;
}

#wp-admin-bar-sitepulse_plugin_manager .sp-pm-bar-badge,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    padding: 0 7px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.4);
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-trigger.is-warning .sp-ab-error-trigger-icon {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-trigger.is-warning .sp-ab-error-badge {
    background: #f59e0b;
    box-shadow: 0 3px 12px rgba(245, 158, 11, 0.4);
}

#wp-admin-bar-sitepulse_top_errors .ab-sub-wrapper,
#wp-admin-bar-sitepulse_plugin_manager .ab-sub-wrapper {
    min-width: 380px;
}

#wp-admin-bar-sitepulse_top_errors .ab-submenu,
#wp-admin-bar-sitepulse_plugin_manager .ab-submenu {
    background: linear-gradient(160deg, rgba(8, 14, 26, 0.98), rgba(8, 18, 34, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(2, 6, 23, 0.65);
    padding: 8px 10px;
}

#wp-admin-bar-sitepulse_top_errors .ab-submenu .ab-item {
    height: auto !important;
    padding: 0 !important;
    min-width: 100% !important;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card {
    margin: 5px 0;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.6);
    padding: 10px 14px;
    color: #e2e8f0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card:hover {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(148, 163, 184, 0.22);
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card.is-warning {
    border-left: 3px solid #f59e0b;
    background: rgba(120, 53, 15, 0.22);
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card.is-fatal {
    border-left: 3px solid #ef4444;
    background: rgba(127, 29, 29, 0.24);
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card.is-warning .sp-ab-error-card-icon,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card.is-warning .sp-ab-error-card-type {
    color: #fbbf24;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card.is-fatal .sp-ab-error-card-icon,
#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card.is-fatal .sp-ab-error-card-type {
    color: #fca5a5;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card-type {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card-time {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-error-card-msg {
    font-size: 12.5px;
    line-height: 1.45;
    color: #cbd5e1;
    padding-left: 24px;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-errors-view-all {
    margin-top: 6px;
    padding: 9px 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 0 0 8px 8px;
    text-align: center;
    color: #60a5fa;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.15s ease;
}

#wp-admin-bar-sitepulse_top_errors .sp-ab-errors-view-all:hover {
    color: #93bbfc;
}

/* ------------------------------------ Alerts ------------------------------------  */
/* SitePulse frontend styles */

#sitepulse-alerts {
    position: fixed;
    top: 20px;
    right: 50%;
    transform: translateX(50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    pointer-events: none; /* allow clicks to pass except on alerts */
}

.sitepulse-alert {
    pointer-events: auto;
    padding: 10px 14px;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 180ms ease, transform 180ms ease;
    cursor: pointer;
    word-break: break-word;
}

/* visible state */
.sitepulse-alert.show {
    opacity: 1;
    transform: translateY(0);
}

/* variants */
.sitepulse-alert-info    { background: #2f86eb; color: #fff; }
.sitepulse-alert-success { background: #28a745; color: #fff; }
.sitepulse-alert-warning { background: #ffc107; color: #212529; }
.sitepulse-alert-danger  { background: #dc3545; color: #fff; }

/* Confirm dialog */
.sitepulse-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.sitepulse-confirm-box {
    background: #fff;
    color: #212529;
    padding: 18px;
    border-radius: 8px;
    min-width: 280px;
    max-width: 720px;
    box-shadow: 0 8px 26px rgba(0,0,0,0.18);
    text-align: left;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

.sitepulse-confirm-message {
    margin-bottom: 12px;
    font-size: 15px;
}

.sitepulse-confirm-actions {
    text-align: right;
}

/* Buttons */
.sitepulse-confirm-btn {
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.sitepulse-confirm-cancel {
    margin-right: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #212529;
}

.sitepulse-confirm-ok {
    border: none;
    background: #0d6efd;
    color: #fff;
}