:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #d946ef;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning-bg: rgba(245, 158, 11, 0.1);
    --error-bg: rgba(239, 68, 68, 0.1);
    --hover-bg: rgba(99, 102, 241, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
    --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6, #d946ef);
    --gradient-2: linear-gradient(135deg, #10b981, #34d399);
    --gradient-3: linear-gradient(135deg, #f59e0b, #ef4444);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-light: #1e293b;
    --accent-primary: #818cf8;
    --accent-secondary: #a78bfa;
    --accent-tertiary: #f472b6;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    --success-bg: rgba(52, 211, 153, 0.1);
    --warning-bg: rgba(251, 191, 36, 0.1);
    --error-bg: rgba(248, 113, 113, 0.1);
    --hover-bg: rgba(129, 140, 248, 0.06);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.nav-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient 6s ease infinite;
}

@keyframes gradient {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.nav-links {
    list-style: none;
}

.nav-link {
    display: block;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--hover-bg);
    color: var(--accent-primary);
    transform: translateX(4px);
}

.nav-link.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    max-width: 1400px;
    width: 100%;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: var(--shadow-lg);
}

/* Page Header */
.page-header {
    margin-bottom: 40px;
}

.page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-1);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient 6s ease infinite;
    margin-bottom: 12px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.card-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.card-link {
    display: inline-block;
    padding: 10px 20px;
    background: var(--gradient-1);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.card-link:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.badge-info {
    background: var(--hover-bg);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

/* Status Indicator */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-dot.success {
    background: var(--success-color);
}

.status-dot.warning {
    background: var(--warning-color);
}

.status-dot.error {
    background: var(--error-color);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 0.95rem;
}

.tab:hover {
    color: var(--accent-primary);
    background: var(--hover-bg);
}

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Entity Cards */
.entity-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.entity-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.entity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.entity-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.entity-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.detail-item {
    font-size: 0.875rem;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Search Box */
.search-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    width: 100%;
    max-width: 400px;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.search-box:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Architecture Diagram */
.architecture-diagram {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 32px;
    padding: 40px;
    margin: 40px 0;
}

.arch-component {
    text-align: center;
    padding: 32px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    min-width: 200px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.arch-component:hover {
    border-color: var(--accent-primary);
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.arch-component::after {
    content: '→';
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--accent-primary);
    animation: arrowPulse 2s ease-in-out infinite;
}

.arch-component:last-child::after {
    display: none;
}

@keyframes arrowPulse {
    0%, 100% { opacity: 0.5; transform: translateY(-50%) translateX(0); }
    50% { opacity: 1; transform: translateY(-50%) translateX(8px); }
}

.arch-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.arch-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.arch-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* JSON Viewer */
.json-viewer {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre;
    color: var(--text-primary);
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Select Dropdown */
.select-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    width: 100%;
    max-width: 400px;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    cursor: pointer;
}

.select-box:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Button */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

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

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        margin-left: 0;
        padding: 24px;
    }
    
    .architecture-diagram {
        flex-direction: column;
    }
    
    .arch-component::after {
        content: '↓';
        right: auto;
        top: auto;
        bottom: -40px;
        left: 50%;
        transform: translateX(-50%);
    }
}
