/* =====================================================================
   DESIGN SYSTEM & GLOBAL VARIABLES
   ===================================================================== */
:root {
    --bg-primary: #0a0a0f;
    --bg-gradient: radial-gradient(circle at 50% 50%, #151525 0%, #08080f 100%);
    --card-bg: rgba(22, 22, 35, 0.6);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-border-glow: rgba(124, 58, 237, 0.15);
    
    --text-primary: #eef2f6;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #8b5cf6;
    --accent-primary-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    
    --color-success: #10b981;
    --color-success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
    
    --color-warning: #f59e0b;
    --color-warning-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    
    --color-error: #ef4444;
    --color-error-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    
    --color-info: #0ea5e9;
    --color-info-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================================
   BASE STYLES
   ===================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
}

.glass-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    z-index: -2;
}

.glass-background::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    filter: blur(80px);
}

.glass-background::after {
    content: '';
    position: absolute;
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.06) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    filter: blur(80px);
}

/* =====================================================================
   CONTAINER & LAYOUT
   ===================================================================== */
.app-container {
    width: 100%;
    max-width: 1300px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 1;
}

/* =====================================================================
   HEADER STYLES
   ===================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-radius: 16px;
    background: rgba(18, 18, 30, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    background: var(--accent-primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-text span {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.health-badge-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    font-size: 13px;
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-indicator.healthy {
    background-color: var(--color-success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.status-indicator.unhealthy {
    background-color: var(--color-error);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.pulses {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 14px currentColor; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* =====================================================================
   GLASS CARDS SYSTEM
   ===================================================================== */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.09);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* =====================================================================
   DASHBOARD GRID STRUCTURE
   ===================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    align-items: start;
}

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

.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    min-height: 500px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 10px;
}

/* =====================================================================
   FORM & CONTROLS STYLES
   ===================================================================== */
.control-card {
    padding: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

input, select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px;
    font-family: var(--font-main);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition-smooth);
    outline: none;
    width: 100%;
}

input:focus, select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.help-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: -4px;
    margin-bottom: 4px;
}

.btn-primary {
    background: var(--accent-primary-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* =====================================================================
   SIDEBAR HISTORY LIST
   ===================================================================== */
.history-card {
    padding: 20px;
    max-height: 350px;
    display: flex;
    flex-direction: column;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.history-item.active {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.3);
}

.history-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-ip {
    font-size: 13px;
    font-weight: 600;
}

.history-time {
    font-size: 10px;
    color: var(--text-muted);
}

.history-status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.history-status-badge.passed {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
}

.history-status-badge.failed {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-error);
}

.empty-state-text {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 0;
}

/* =====================================================================
   MAIN LOADER RADAR SCREEN
   ===================================================================== */
.main-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    max-width: 320px;
}

.radar-scan {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.radar-scan .circle {
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.15);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radar-scan .c1 { width: 30px; height: 30px; }
.radar-scan .c2 { width: 60px; height: 60px; }
.radar-scan .c3 { width: 90px; height: 90px; }

.radar-scan .scan-line {
    width: 50%;
    height: 50%;
    background: linear-gradient(45deg, rgba(139, 92, 246, 0.4) 0%, rgba(139, 92, 246, 0) 80%);
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: bottom right;
    animation: radar-sweep 2s linear infinite;
}

@keyframes radar-sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loader-content h3 {
    font-size: 18px;
    font-weight: 600;
}

.loader-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =====================================================================
   SUMMARY EVALUATION CARD
   ===================================================================== */
.summary-status-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.summary-status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
}

.summary-status-card.passed::before { background: var(--color-success); }
.summary-status-card.failed::before { background: var(--color-error); }

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.summary-target-ip {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-top: 2px;
}

.summary-timestamp {
    font-size: 11px;
    color: var(--text-secondary);
}

.status-stamp {
    font-size: 16px;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.passed .status-stamp {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.05);
}

.failed .status-stamp {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--color-error);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.05);
}

.summary-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
}

.stat-pill .label {
    color: var(--text-secondary);
}

.stat-pill .val {
    font-weight: 700;
}

/* Anomalies section */
.anomalies-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 14px;
}

.anomalies-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-warning);
    text-transform: uppercase;
}

.anomalies-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.anomaly-badge {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: var(--color-warning);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

/* =====================================================================
   METRICS GRID & WIDGET CARDS
   ===================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 4px;
}

.metric-widget-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.widget-header i {
    font-size: 16px;
}

.widget-value-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

.metric-main-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1;
}

.metric-main-value .unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 3px;
}

.metric-details {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 8px;
    gap: 12px;
}

.detail-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.det-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.det-val {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Colors for widgets */
.icon-blue { color: var(--color-info); }
.icon-red { color: var(--color-error); }
.icon-yellow { color: var(--color-warning); }
.icon-green { color: var(--color-success); }

/* Progress bar for packet loss widget */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--color-success-gradient);
    transition: var(--transition-smooth);
}

.progress-bar-fill.warning {
    background: var(--color-warning-gradient);
}

.progress-bar-fill.error {
    background: var(--color-error-gradient);
}

/* =====================================================================
   TABS PANEL SYSTEM
   ===================================================================== */
.details-tab-card {
    display: flex;
    flex-direction: column;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tab-btn {
    background: none;
    border: none;
    padding: 16px 24px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.01);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.02);
}

.tab-content {
    display: none;
    padding: 24px;
}

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

/* =====================================================================
   SLA TEST LIST CARDS
   ===================================================================== */
.sla-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.sla-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.sla-item:hover {
    background: rgba(255, 255, 255, 0.02);
    transform: translateX(2px);
}

.sla-item-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sla-status-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
}

.sla-item.passed .sla-status-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.sla-item.failed .sla-status-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.sla-item-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sla-name {
    font-size: 14px;
    font-weight: 600;
}

.sla-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.sla-error {
    font-size: 11px;
    color: var(--color-error);
    margin-top: 4px;
    font-family: monospace;
    background: rgba(239, 68, 68, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 2px solid var(--color-error);
}

.sla-duration {
    font-size: 12px;
    color: var(--text-muted);
}

/* =====================================================================
   PCAP INSPECTOR LAYOUT
   ===================================================================== */
.pcap-inspector-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pcap-stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.pcap-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.pcap-stat-val {
    font-size: 18px;
    font-weight: 700;
}

.pcap-stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

.pcap-details-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 800px) {
    .pcap-details-sections {
        grid-template-columns: 1fr;
    }
}

.pcap-sub-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pcap-sub-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.handshakes-list, .pcap-anomalies-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.handshake-item, .anomaly-item {
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    font-size: 12px;
}

.handshake-item {
    border-left: 3px solid var(--color-info);
}

.anomaly-item {
    border-left: 3px solid var(--color-warning);
}

.handshake-meta, .anomaly-meta {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 4px;
}

.handshake-flow, .anomaly-flow {
    color: var(--text-primary);
}

.handshake-rtt, .anomaly-delay {
    color: var(--color-success);
}

.anomaly-delay.high {
    color: var(--color-error);
}

.handshake-time, .anomaly-time {
    font-size: 10px;
    color: var(--text-muted);
}

.empty-list-text {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    padding: 10px 0;
}

.empty-list-text.text-green {
    color: var(--color-success);
    font-style: normal;
}
