/* NE8000 BGP Monitor - Part 3: Extra Components & Responsive */

/* Loading */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 40px 0;
    width: 100%;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(34, 211, 238, 0.15);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(136, 146, 176, 0.08) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 14px;
    width: 80%;
    margin-bottom: 8px;
}

.skeleton-stat {
    height: 36px;
    width: 100px;
    margin-bottom: 8px;
}

/* Detail panel */
.detail-panel {
    display: none;
}

.detail-panel.active {
    display: block;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(136, 146, 176, 0.06);
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.detail-value {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 500;
}

/* Donut chart */
.chart-container {
    position: relative;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-chart {
    position: relative;
    width: 160px;
    height: 160px;
}

.donut-chart svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-chart .center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-chart .center-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    display: block;
    line-height: 1;
}

.donut-chart .center-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-top: 4px;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-left: 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.green {
    background: var(--accent-green);
}

.legend-dot.red {
    background: var(--accent-red);
}

.legend-dot.amber {
    background: var(--accent-amber);
}

.legend-dot.blue {
    background: var(--accent-blue);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    animation: slideInToast 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
}

.toast.success {
    border-left: 3px solid var(--accent-green);
}

.toast.error {
    border-left: 3px solid var(--accent-red);
}

.toast.info {
    border-left: 3px solid var(--accent-cyan);
}

.toast-message {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

@keyframes slideInToast {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

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

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    background: rgba(10, 14, 26, 0.4);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent-cyan);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Traceroute */
.hop-row {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(136, 146, 176, 0.06);
    transition: background var(--transition-fast);
}

.hop-row:hover {
    background: rgba(34, 211, 238, 0.03);
}

.hop-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: 16px;
    position: relative;
}

.hop-number.ok {
    background: rgba(52, 211, 153, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.hop-number.timeout {
    background: rgba(248, 113, 113, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.hop-info {
    flex: 1;
}

.hop-ip {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.88rem;
}

.hop-hostname {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.hop-times {
    display: flex;
    gap: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.hop-time {
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(10, 14, 26, 0.5);
}

.hop-time.good {
    color: var(--accent-green);
}

.hop-time.medium {
    color: var(--accent-amber);
}

.hop-time.bad {
    color: var(--accent-red);
}

.hop-row:not(:last-child) .hop-number::after {
    content: '';
    position: absolute;
    bottom: -26px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 18px;
    background: var(--border-color);
    z-index: -1;
}

/* Peer actions */
.peer-actions {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.05);
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

/* Ping stats */
.ping-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.ping-stat {
    text-align: center;
    padding: 16px;
    background: rgba(10, 14, 26, 0.4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.ping-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.ping-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* Search */
.search-box {
    position: relative;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box .form-input {
    padding-left: 38px;
}

/* Info boxes */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.info-box.info {
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
}

.info-box.warning {
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.15);
    color: var(--accent-amber);
}

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 0.88rem;
}

/* Refresh indicator */
.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.refresh-indicator .last-update {
    font-family: 'JetBrains Mono', monospace;
}

/* Fade animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-cyan {
    color: var(--accent-cyan);
}

.text-green {
    color: var(--accent-green);
}

.text-red {
    color: var(--accent-red);
}

.text-amber {
    color: var(--accent-amber);
}

.text-purple {
    color: var(--accent-purple);
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 16px;
}

.w-full {
    width: 100%;
}

/* Responsive */
@media (max-width: 1200px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .form-row {
        flex-direction: column;
    }

    .header-info {
        display: none;
    }

    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .ping-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .top-header {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .ping-stats {
        grid-template-columns: 1fr;
    }
}