/* Spectre Analytics Dashboard - Federated Architecture Styles */
/* Post-Quantum Security & Byzantine Consensus UI */

:root {
    /* Primary Color - Teal/Cyan */
    --color-primary-50: #f0fdfa;
    --color-primary-100: #ccfbf1;
    --color-primary-200: #99f6e4;
    --color-primary-300: #5eead4;
    --color-primary-400: #2dd4bf;
    --color-primary-500: #14b8a6;
    --color-primary-600: #0d9488;
    --color-primary-700: #0f766e;
    --color-primary-800: #115e59;
    --color-primary-900: #134e4a;
    --color-primary-950: #042f2e;
    
    /* Security Colors */
    --color-security-high: #10b981;
    --color-security-warning: #f59e0b;
    --color-security-danger: #ef4444;
    --color-security-purple: #8b5cf6;
    
    /* Secondary Color - Slate */
    --color-secondary-50: #f8fafc;
    --color-secondary-100: #f1f5f9;
    --color-secondary-200: #e2e8f0;
    --color-secondary-300: #cbd5e1;
    --color-secondary-400: #94a3b8;
    --color-secondary-500: #64748b;
    --color-secondary-600: #475569;
    --color-secondary-700: #334155;
    --color-secondary-800: #1e293b;
    --color-secondary-900: #0f172a;
    --color-secondary-950: #020617;
    
    /* Risk Colors */
    --color-danger-500: #ef4444;
    --color-danger-600: #dc2626;
    --color-warning-500: #f59e0b;
    --color-success-500: #22c55e;
}

/* Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--color-secondary-950);
    color: #f8fafc;
    line-height: 1.5;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
}

/* Custom Utility Classes */
.glass {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(51, 65, 85, 0.5);
}

.pattern-grid {
    background-image: 
        linear-gradient(rgba(20, 184, 166, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 184, 166, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Advanced Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

@keyframes scan-line {
    0% { top: 0; }
    50% { top: calc(100% - 2px); }
    100% { top: 0; }
}

@keyframes data-flow {
    0% { stroke-dashoffset: 20; }
    100% { stroke-dashoffset: 0; }
}

@keyframes node-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

@keyframes consensus-flash {
    0% { background-color: rgba(20, 184, 166, 0); }
    50% { background-color: rgba(20, 184, 166, 0.2); }
    100% { background-color: rgba(20, 184, 166, 0); }
}

@keyframes security-breach {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.5); }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

.animate-pulse-ring {
    animation: pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-node-active {
    animation: node-pulse 2s infinite;
}

.animate-consensus {
    animation: consensus-flash 3s infinite;
}

.animate-security-breach {
    animation: security-breach 1s infinite;
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary-500), transparent);
    animation: scan-line 2s linear infinite;
}

/* Federated Node Grid */
#node-grid {
    display: grid;
    gap: 4px;
    padding: 8px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(51, 65, 85, 0.3);
}

#node-grid > div {
    transition: all 0.3s ease;
}

#node-grid > div:hover {
    transform: scale(1.5);
    z-index: 10;
}

/* Quantum Encryption Indicator */
.quantum-indicator {
    background: linear-gradient(90deg, #8b5cf6, #14b8a6);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    font-weight: 700;
}

/* Byzantine Consensus Badge */
.consensus-badge {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(20, 184, 166, 0.5);
    color: #2dd4bf;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Graph Node Styles */
.graph-node {
    cursor: pointer;
    transition: all 0.2s ease;
}

.graph-node:hover {
    filter: brightness(1.2);
    transform: scale(1.1);
}

.graph-link {
    stroke: var(--color-primary-500);
    stroke-opacity: 0.4;
    fill: none;
    stroke-width: 1.5;
}

.graph-link.flowing {
    stroke-dasharray: 5 5;
    animation: data-flow 0.5s linear infinite;
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.active {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.status-indicator.active::before {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.status-indicator.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.status-indicator.warning::before {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.status-indicator.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.status-indicator.danger::before {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

/* Card Styles */
.card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 0.75rem;
    backdrop-filter: blur(12px);
}

.card-hover {
    transition: all 0.2s ease;
}

.card-hover:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(20, 184, 166, 0.3);
    transform: translateY(-2px);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    scrollbar-width: thin;
}

.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--color-secondary-800);
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--color-secondary-600);
    border-radius: 3px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary-400);
    background: rgba(51, 65, 85, 0.3);
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(51, 65, 85, 0.3);
}

/* Form Elements */
.input-field {
    background: var(--color-secondary-800);
    border: 1px solid var(--color-secondary-700);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: #f8fafc;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.input-field::placeholder {
    color: var(--color-secondary-500);
}

.select-field {
    background: var(--color-secondary-800) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 0.75rem center;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-appearance: none;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.btn-primary {
    background: var(--color-primary-500);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-600);
}

.btn-secondary {
    background: var(--color-secondary-700);
    color: #f8fafc;
}

.btn-secondary:hover {
    background: var(--color-secondary-600);
}

.btn-danger {
    background: var(--color-danger-500);
    color: white;
}

.btn-danger:hover {
    background: var(--color-danger-600);
}

.btn-ghost {
    background: transparent;
    color: var(--color-secondary-400);
}

.btn-ghost:hover {
    background: var(--color-secondary-800);
    color: #f8fafc;
}

/* Chart Container Styles */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.chart-container canvas {
    max-width: 100%;
}

/* Scrollbar Styles */
.scrollable {
    overflow-y: auto;
    scrollbar-width: thin;
}

.scrollable::-webkit-scrollbar {
    width: 6px;
}

.scrollable::-webkit-scrollbar-track {
    background: var(--color-secondary-900);
}

.scrollable::-webkit-scrollbar-thumb {
    background: var(--color-secondary-700);
    border-radius: 3px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary-600);
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
}

.tooltip-container .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--color-secondary-900);
    border: 1px solid var(--color-secondary-700);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.tooltip-container:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-secondary-700);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar .progress {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Risk Score Indicator */
.risk-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.risk-score .score-bar {
    flex: 1;
    height: 6px;
    background: var(--color-secondary-700);
    border-radius: 9999px;
    overflow: hidden;
}

.risk-score .score-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.risk-score .score-value {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 2rem;
    text-align: right;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-primary {
    background: rgba(20, 184, 166, 0.15);
    color: #2dd4bf;
    border: 1px solid rgba(20, 184, 166, 0.3);
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(
        90deg,
        var(--color-secondary-800) 25%,
        var(--color-secondary-700) 50%,
        var(--color-secondary-800) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.375rem;
}

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

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-secondary-700);
    border-top-color: var(--color-primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 1280px) {
    aside.right-panel {
        display: none;
    }
}

@media (max-width: 1024px) {
    aside.sidebar {
        width: 64px;
    }
    
    aside.sidebar .nav-text,
    aside.sidebar .logo-text {
        display: none;
    }
    
    aside.sidebar .nav-item {
        justify-content: center;
        padding: 0.75rem;
    }
    
    aside.sidebar .nav-item span {
        display: none;
    }
}

@media (max-width: 768px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    .col-span-2 {
        grid-column: span 1;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .sidebar,
    .right-panel {
        display: none;
    }
    
    .card {
        background: white;
        border: 1px solid #e2e8f0;
    }
}

/* Focus States for Accessibility */
.btn:focus-visible,
.input-field:focus-visible,
.select-field:focus-visible {
    outline: 2px solid var(--color-primary-500);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .card {
        border-width: 2px;
    }
    
    .graph-link {
        stroke-width: 2;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}