/* ===========================================
   ARCHITECTURE VISUALIZER — Robert Hidri Portfolio
   Matches the portfolio dark theme
   =========================================== */

:root {
    --bg:          #0a0c10;
    --bg-surface:  #12151c;
    --bg-card:     #1a1e28;
    --border:      #2d3548;
    --border-hover:#4a5568;
    --text:        #f1f5f9;
    --text-muted:  #94a3b8;
    --text-dim:    #64748b;
    --accent:      #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.1);
    --green:       #10b981;
    --yellow:      #fbbf24;
    --purple:      #a855f7;
    --red:         #ef4444;
    --font:        'DM Sans', -apple-system, sans-serif;
    --font-mono:   'JetBrains Mono', 'Courier New', monospace;
    --radius:      0.625rem;
    --transition:  0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: #60a5fa; }

/* --- Focus Indicators --- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Header --- */
.header {
    background: rgba(18, 21, 28, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition);
}
.header-back:hover { color: var(--text); }

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}

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

/* --- Theme Toggle --- */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: all var(--transition);
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* --- Main Layout --- */
.main {
    display: grid;
    grid-template-columns: 260px 1fr 280px;
    height: calc(100vh - 60px);
}

/* --- File Tree Panel --- */
.file-panel {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1rem;
}

.panel-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.file-tree {
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.tree-item {
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}
.tree-item:hover {
    background: var(--accent-soft);
}
.tree-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.tree-item.folder   { color: var(--yellow); }
.tree-item.file-html { color: #f97316; }
.tree-item.file-css  { color: #3b82f6; }
.tree-item.file-js   { color: #fbbf24; }
.tree-item.file-json { color: #10b981; }
.tree-item.file-md   { color: #94a3b8; }
.tree-item.file-jpg,
.tree-item.file-png,
.tree-item.file-svg  { color: #ec4899; }
.tree-item.file-pdf  { color: #ef4444; }
.tree-item.file-txt  { color: #94a3b8; }

.tree-children {
    margin-left: 1rem;
    border-left: 1px solid var(--border);
    padding-left: 0.5rem;
}

.file-size {
    margin-left: auto;
    font-size: 0.625rem;
    color: var(--text-dim);
}

/* --- Diagram Panel --- */
.diagram-panel {
    padding: 2rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.diagram-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.diagram-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Layer Diagram --- */
.layer-diagram {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.layer {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s;
    cursor: pointer;
}
.layer:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}
.layer.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.layer-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.layer-info { flex: 1; }

.layer-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.layer-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.layer-files {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.layer-file {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background: var(--bg);
    border-radius: 4px;
    color: var(--text-dim);
}

/* --- Flow Arrows --- */
.flow-arrow {
    text-align: center;
    color: var(--text-dim);
    font-size: 1.25rem;
    padding: 0.25rem;
}

/* --- Data Flow Diagram --- */
.flow-diagram {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.flow-node {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
    min-width: 100px;
    flex: 1;
    transition: all 0.3s;
}
.flow-node:hover {
    border-color: var(--accent);
}

.flow-node-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.flow-node-label {
    font-size: 0.6875rem;
    font-weight: 600;
}

.flow-connector {
    color: var(--accent);
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* --- Component Relationship Grid (replaces SVG) --- */
.relationship-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.rel-node {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.875rem;
    text-align: center;
    transition: all 0.3s;
}
.rel-node:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.rel-node-icon {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.rel-node-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
}

.rel-node-desc {
    font-size: 0.625rem;
    color: var(--text-dim);
    margin-top: 0.125rem;
}

.rel-node[data-color="blue"]   { border-color: #3b82f6; }
.rel-node[data-color="green"]  { border-color: #10b981; }
.rel-node[data-color="yellow"] { border-color: #fbbf24; }
.rel-node[data-color="purple"] { border-color: #a855f7; }

.rel-arrows {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 0.25rem;
}

/* --- Info Panel --- */
.info-panel {
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 1rem;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.info-card-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-card-content {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.info-card-content p + p {
    margin-top: 0.5rem;
}

.info-card-content code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--bg);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    color: var(--green);
}

/* --- Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.stat-item {
    background: var(--bg);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.625rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* --- Concept Cards --- */
.concept-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.concept-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 6px;
}

.concept-icon { font-size: 1rem; }

.concept-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.concept-text strong { color: var(--text); }

/* --- Noscript --- */
.noscript-msg {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 600px;
    margin: 2rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .main {
        grid-template-columns: 1fr;
        height: auto;
    }
    .file-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 300px;
    }
    .info-panel {
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .header h1 { font-size: 1rem; }
    .diagram-panel { padding: 1rem; gap: 1rem; }
    .diagram-section { padding: 1rem; }
    .flow-diagram {
        flex-direction: column;
    }
    .flow-connector {
        transform: rotate(90deg);
    }
    .relationship-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .header-status { display: none; }
    .relationship-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Light Mode (toggle-based) --- */
[data-theme="light"] {
    --bg:          #f8f9fb;
    --bg-surface:  #ffffff;
    --bg-card:     #ffffff;
    --border:      #d1d5db;
    --border-hover:#9ca3af;
    --text:        #1f2937;
    --text-muted:  #4b5563;
    --text-dim:    #6b7280;
    --accent:      #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.08);
    --green:       #059669;
    --yellow:      #d97706;
    --purple:      #7c3aed;
    --red:         #dc2626;
}

[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.9);
}

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