:root {
    --primary: #00d4ff;
    --secondary: #7000ff;
    --accent: #ff00aa;
    --dark: #12171f;
    --dark-lighter: #192231;
    --text: #e0e7ff;
    --glow: 0 0 10px var(--primary), 0 0 20px rgba(0, 212, 255, 0.3);
    --purple-glow: 0 0 10px var(--secondary), 0 0 20px rgba(112, 0, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Roboto', sans-serif;
}

body {
    background-color: var(--dark);
    color: var(--text);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

header {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--primary);
    box-shadow: var(--glow);
    z-index: 10;
    position: relative;
}

h1 {
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
}

h1 span {
    color: var(--primary);
    font-weight: 700;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.credits {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.credits a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.credits a:hover {
    opacity: 1;
    text-decoration: underline;
    text-shadow: 0 0 8px var(--primary);
}

/* Tab navigation */
.tab-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-navigation {
    display: flex;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem 0;
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
    z-index: 10;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.tab-navigation::-webkit-scrollbar {
    height: 5px;
}

.tab-navigation::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 5px;
}

.tab-button {
    background-color: transparent;
    border: none;
    color: var(--text);
    padding: 0.7rem 1.5rem;
    margin-right: 0.5rem;
    cursor: pointer;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    font-weight: 500;
    position: relative;
    bottom: -1px;
    transition: all 0.3s ease;
    opacity: 0.7;
    white-space: nowrap;
}

.tab-button:hover {
    opacity: 1;
    background-color: rgba(0, 212, 255, 0.1);
}

.tab-button.active {
    background-color: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.5);
    border-bottom: 1px solid var(--dark);
    box-shadow: 0 -2px 8px rgba(0, 212, 255, 0.2);
    opacity: 1;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--dark);
    z-index: 2;
}

.tab-button:nth-child(2) {
    border-color: rgba(112, 0, 255, 0.5);
}

.tab-button:nth-child(2).active {
    background-color: rgba(112, 0, 255, 0.2);
    box-shadow: 0 -2px 8px rgba(112, 0, 255, 0.2);
}

.tab-button:nth-child(3) {
    border-color: rgba(255, 0, 170, 0.5);
}

.tab-button:nth-child(3).active {
    background-color: rgba(255, 0, 170, 0.2);
    box-shadow: 0 -2px 8px rgba(255, 0, 170, 0.2);
}

.tab-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: calc(100vh - 115px);
}

.tab-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.tab-panel.active {
    opacity: 1;
    visibility: visible;
    z-index: 5;
}

/* Visualization elements common across tabs */
.visualization {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

svg {
    width: 100%;
    height: 100%;
}

.grid {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -2;
}

.pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0.5;
    animation: pulse 8s infinite ease-in-out;
}

/* Grid and pulse styles for each tab */
#graph-panel .grid {
    background-image: 
        linear-gradient(rgba(0, 212, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
}

#graph-panel .pulse {
    background: radial-gradient(circle at center, rgba(0, 212, 255, 0.05) 0%, transparent 60%);
}

#architecture-panel .grid {
    background-image: 
        linear-gradient(rgba(112, 0, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(112, 0, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

#architecture-panel .pulse {
    background: radial-gradient(circle at center, rgba(112, 0, 255, 0.05) 0%, transparent 60%);
}

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

/* Knowledge Graph Specific Styles */
.link {
    stroke-opacity: 0.5;
    transition: stroke-opacity 0.3s;
}

.link:hover {
    stroke-opacity: 0.8;
}

.node text {
    fill: var(--text);
    font-size: 10px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.cluster-node {
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.7));
}

.info-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 300px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--primary);
    border-radius: 5px;
    padding: 1rem;
    box-shadow: var(--glow);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
    max-width: calc(100% - 2rem);
}

.info-panel.visible {
    opacity: 1;
    pointer-events: auto;
}

.info-panel-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: var(--primary);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
}

.info-title {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
    padding-bottom: 0.5rem;
    padding-right: 20px;
}

.info-content {
    font-size: 0.9rem;
    line-height: 1.4;
}

.info-content p {
    margin-bottom: 0.5rem;
}

.info-content strong {
    color: var(--primary);
}

.legend {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--primary);
    border-radius: 5px;
    padding: 0.8rem;
    font-size: 0.9rem;
    box-shadow: var(--glow);
    z-index: 100;
    max-width: calc(100% - 2rem);
    overflow-y: auto;
    max-height: 40vh;
}

.legend-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.4rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border-radius: 50%;
}

.control-panel {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

.control-btn {
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 5px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
    box-shadow: var(--glow);
}

.control-btn:hover {
    background-color: rgba(0, 212, 255, 0.2);
}

.hover-glow {
    transition: all 0.3s;
}

.hover-glow:hover {
    filter: drop-shadow(0 0 8px var(--primary));
}

/* Architecture Panel Specific Styles */
.mermaid-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 1rem;
}

.mermaid-wrapper {
    flex: 1;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--secondary);
    border-radius: 5px;
    padding: 1rem;
    box-shadow: var(--purple-glow);
    display: flex;
    align-items: center;
    justify-content: center;
}

#data-flow-panel .mermaid-wrapper {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(255, 0, 170, 0.3);
}

/* Zoom controls for sequence diagram */
.zoom-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

.zoom-btn {
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 5px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(255, 0, 170, 0.3);
}

.zoom-btn:hover {
    background-color: rgba(255, 0, 170, 0.2);
}

#data-flow-panel .zoom-btn {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(255, 0, 170, 0.3);
}

#architecture-panel .zoom-btn {
    border-color: var(--secondary);
    color: var(--secondary);
    box-shadow: 0 0 10px var(--secondary), 0 0 20px rgba(112, 0, 255, 0.3);
}

#architecture-panel .zoom-btn:hover {
    background-color: rgba(112, 0, 255, 0.2);
}

.diagram-description {
    text-align: center;
    margin: 1rem auto;
    max-width: 800px;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* Override mermaid styles to match our theme */
.mermaid {
    background-color: transparent !important;
    font-family: 'Segoe UI', 'Roboto', sans-serif !important;
    min-width: 800px;
    transition: transform 0.3s ease;
}

#architecture-diagram-wrapper .mermaid {
    min-width: 900px;
}

#sequence-diagram-wrapper .mermaid {
    min-width: 1000px;
}

.mermaid text {
    fill: var(--text) !important;
}

.mermaid .edgeLabel {
    color: var(--text) !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
}

.mermaid .node rect, 
.mermaid .node circle, 
.mermaid .node ellipse, 
.mermaid .node polygon, 
.mermaid .node path {
    fill: var(--dark-lighter) !important;
    stroke: var(--secondary) !important;
}

/* Responsive Styles */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .legend {
        font-size: 0.8rem;
        padding: 0.6rem;
        max-height: 35vh;
    }
    
    .legend-title {
        font-size: 0.9rem;
    }
    
    .legend-item {
        margin-bottom: 0.3rem;
    }
    
    .control-panel {
        flex-direction: column;
        gap: 0.3rem;
        bottom: auto;
        top: 5rem;
        right: 0.5rem;
        width: auto;
    }
    
    .control-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .info-panel {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .info-panel-close {
        display: block;
    }
    
    .node text {
        font-size: 8px;
    }
    
    .mermaid-wrapper {
        padding: 0.5rem;
    }
    
    .diagram-description {
        font-size: 0.9rem;
        margin: 0.5rem auto;
    }
    
    .zoom-controls {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .zoom-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    #sequence-diagram-wrapper .mermaid {
        min-width: 800px;
        transform-origin: top left;
    }
}

@media (max-width: 576px) {
    header {
        padding: 0.8rem 1rem;
    }
    
    h1 {
        font-size: 1.2rem;
    }
    
    .subtitle {
        font-size: 0.7rem;
    }
    
    .credits {
        font-size: 0.7rem;
    }
    
    .tab-navigation {
        padding: 0.3rem 0.5rem 0;
    }
    
    .tab-button {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
        margin-right: 0.3rem;
    }
    
    .legend {
        bottom: 0.5rem;
        left: 0.5rem;
        padding: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    footer {
        padding: 0.8rem 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .footer-logo {
        font-size: 1rem;
    }
    
    .footer-credit {
        font-size: 0.7rem;
    }
}

/* Touch optimizations */
@media (pointer: coarse) {
    .hover-glow:hover {
        filter: none;
    }
    
    .tab-button {
        padding: 0.7rem 1rem;
    }
}