/* ============================================================================
   SILHOUETTE ARCHITECTURE DASHBOARD
   Design System: Cyber-minimal
   ============================================================================ */

/* CSS Variables */
:root {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F5F5;
    --text-primary: #1a1a1a;
    --text-subtle: #666666;
    --accent-teal: #0066CC;
    --accent-cyan: #00796B;
    --accent-pink: #D81B60;
    --accent-magenta: #8E24AA;

    --header-height: 80px;
    --menu-width: 320px;
    --gutter: 120px;
    --padding: 160px;
    --max-width: 1440px;

    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-bounce: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    line-height: 1.78;
    font-weight: 400;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    position: relative;
}

/* Grain Overlay */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9998;
    opacity: 0.15;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: transparent;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000;
    transition: var(--transition-smooth);
}

.header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.1);
}

.header-content {
    max-width: var(--max-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-title {
    font-family: 'Orbitron', 'Roboto Mono', 'SF Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(0, 102, 204, 0.2);
}

/* Menu */
.menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    z-index: 999;
}

.menu-toggle {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1.5px solid var(--accent-teal);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    opacity: 0.92;
}

.menu-toggle:hover {
    background: var(--accent-teal);
    box-shadow: 0 0 15px rgba(0, 102, 204, 0.3),
                0 0 30px rgba(0, 102, 204, 0.2),
                0 0 45px rgba(216, 27, 96, 0.1);
    transform: scale(1.03);
}

.menu-toggle:active {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

.menu-toggle:hover .menu-label {
    color: #FFFFFF;
}

.menu-toggle:hover .hamburger span {
    background: #FFFFFF;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 20px;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--accent-teal);
    transition: var(--transition-smooth);
}

.menu-label {
    font-family: 'Roboto Mono', 'SF Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-teal);
    transition: var(--transition-smooth);
}

.menu-panel {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--menu-width);
    height: calc(100vh - var(--header-height));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.1);
}

.menu-panel.active {
    transform: translateX(0);
}

.menu-categories {
    padding: 32px 24px;
}

.category {
    margin-bottom: 24px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid rgba(0, 102, 204, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: 'Roboto Mono', 'SF Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.category-header:hover {
    background: rgba(0, 102, 204, 0.05);
    border-color: var(--accent-teal);
    box-shadow: 0 0 15px rgba(0, 102, 204, 0.2),
                0 0 25px rgba(216, 27, 96, 0.1);
}

.category-header:active {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    transform: scale(1.02);
}

.category-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.category.active .category-icon {
    transform: rotate(90deg);
    color: var(--accent-pink);
    filter: drop-shadow(0 0 8px rgba(216, 27, 96, 0.3));
}

.diagram-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.category.active .diagram-list {
    max-height: 1000px;
}

.diagram-item {
    padding: 12px 16px 12px 32px;
    margin-top: 8px;
    background: transparent;
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 14px;
    color: var(--text-subtle);
}

.diagram-item:hover {
    background: rgba(0, 102, 204, 0.05);
    border-left-color: var(--accent-teal);
    color: var(--text-primary);
    padding-left: 36px;
}

.diagram-item.active {
    background: rgba(0, 102, 204, 0.1);
    border-left-color: var(--accent-teal);
    color: var(--accent-teal);
}

/* Main Content */
.main-content {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.viewer-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.viewer-header {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 12px 32px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.1);
}

.diagram-title {
    font-family: 'Roboto Mono', 'SF Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(0, 102, 204, 0.1);
}

.svg-viewer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    overflow: visible;
}

.viewer-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.viewer-placeholder.hidden {
    opacity: 0;
    pointer-events: none;
}

.placeholder-content {
    text-align: center;
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    color: var(--text-subtle);
    opacity: 0.3;
    margin-bottom: 16px;
}

.placeholder-text {
    font-family: 'Roboto Mono', 'SF Mono', monospace;
    font-size: 14px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.svg-content {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: visible;
}

.svg-content svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    cursor: grab;
    user-select: none;
    transition: none;
}

.svg-content svg.dragging {
    cursor: grabbing;
}

/* Viewer Controls */
.viewer-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.1);
}

.control-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1.5px solid var(--accent-teal);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--accent-teal);
}

.control-btn:hover {
    background: var(--accent-teal);
    color: #FFFFFF;
    box-shadow: 0 0 15px rgba(0, 102, 204, 0.3),
                0 0 30px rgba(0, 102, 204, 0.2),
                0 0 45px rgba(216, 27, 96, 0.1);
    transform: scale(1.1);
}

.control-btn:active {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-teal);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --menu-width: 280px;
    }

    .header-content {
        padding: 0 24px;
    }

    .site-title {
        font-size: 16px;
    }

    .viewer-controls {
        bottom: 12px;
        right: 12px;
        gap: 8px;
        padding: 8px;
    }

    .control-btn {
        width: 36px;
        height: 36px;
    }

    .viewer-header {
        top: 12px;
        padding: 8px 16px;
    }

    .diagram-title {
        font-size: 12px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

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

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Loading State */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(0, 102, 204, 0.2);
    border-top-color: var(--accent-teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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