/* Games Ontology - Styles */
/* Catppuccin Mocha dark theme */

:root {
    /* Catppuccin Mocha palette */
    --ctp-base: #1e1e2e;
    --ctp-mantle: #181825;
    --ctp-crust: #11111b;
    --ctp-surface0: #313244;
    --ctp-surface1: #45475a;
    --ctp-subtext0: #a6adc8;
    --ctp-text: #cdd6f4;
    --ctp-lavender: #b4befe;
    --ctp-blue: #89b4fa;
    --ctp-mauve: #cba6f7;
    --ctp-green: #a6e3a1;
    --ctp-red: #f38ba8;
    --ctp-peach: #fab387;
    --ctp-yellow: #f9e2af;
    --ctp-flint: #9399b2;
    --ctp-rosewater: #f5c2e7;

    /* Node type colors */
    --color-game: var(--ctp-mauve);
    --color-genre: var(--ctp-green);
    --color-year: var(--ctp-blue);
    --color-studio: var(--ctp-lavender);
    --color-publisher: var(--ctp-peach);
    --color-engine: var(--ctp-yellow);
    --color-gamemode: var(--ctp-flint);
    --color-feature: var(--ctp-rosewater);

    /* Layout */
    --sidebar-width: 300px;
    --header-height: 70px;
    --footer-height: 40px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--ctp-base);
    color: var(--ctp-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Header */
header {
    height: var(--header-height);
    background-color: var(--ctp-mantle);
    border-bottom: 1px solid var(--ctp-surface1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 10;
}

header h1 {
    font-size: 1.4rem;
    color: var(--ctp-mauve);
    font-weight: 600;
    letter-spacing: -0.5px;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

#search-input {
    background-color: var(--ctp-surface0);
    border: 1px solid var(--ctp-surface1);
    border-radius: 8px;
    padding: 8px 40px 8px 16px;
    color: var(--ctp-text);
    font-size: 0.9rem;
    width: 280px;
    outline: none;
    transition: border-color 0.2s;
}

#search-input:focus {
    border-color: var(--ctp-blue);
}

#search-input::placeholder {
    color: var(--ctp-subtext0);
}

#search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--ctp-subtext0);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

#search-clear:hover {
    color: var(--ctp-text);
}

/* Main Layout */
.layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Graph Container */
.graph-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#graph-container svg {
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--ctp-mantle);
    border-left: 1px solid var(--ctp-surface1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px 20px 8px;
}

.sidebar-header h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ctp-subtext0);
    font-weight: 600;
}

/* Legend */
.legend {
    padding: 8px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--ctp-subtext0);
}

.legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-swatch.circle {
    border-radius: 50%;
}

/* Detail Panel */
.detail-panel {
    border-top: 1px solid var(--ctp-surface1);
    padding: 16px 20px;
    flex: 1;
    overflow-y: auto;
}

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

.panel-header h2 {
    font-size: 1rem;
    color: var(--ctp-lavender);
    font-weight: 600;
}

#detail-close {
    background: none;
    border: none;
    color: var(--ctp-subtext0);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

#detail-close:hover {
    color: var(--ctp-text);
}

.detail-placeholder {
    color: var(--ctp-subtext0);
    font-size: 0.85rem;
    font-style: italic;
}

.detail-section {
    margin-bottom: 12px;
}

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

.detail-value {
    font-size: 0.9rem;
    color: var(--ctp-text);
}

.detail-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-list li {
    font-size: 0.85rem;
    color: var(--ctp-subtext0);
    padding-left: 12px;
    position: relative;
}

.detail-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--ctp-blue);
}

/* Tooltip */
.tooltip {
    position: fixed;
    background-color: var(--ctp-crust);
    border: 1px solid var(--ctp-surface1);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--ctp-text);
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.15s;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip.visible {
    opacity: 1;
}

.tooltip-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.tooltip-type {
    color: var(--ctp-subtext0);
    text-transform: capitalize;
}

/* Footer */
footer {
    height: var(--footer-height);
    background-color: var(--ctp-mantle);
    border-top: 1px solid var(--ctp-surface1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

footer a {
    color: var(--ctp-blue);
    text-decoration: none;
    font-size: 0.85rem;
}

footer a:hover {
    text-decoration: underline;
}

/* SVG Styles */
.link {
    stroke: var(--ctp-surface1);
    stroke-width: 1.5;
    transition: stroke 0.2s, opacity 0.2s;
}

.node-group {
    cursor: grab;
}

.node-group:active {
    cursor: grabbing;
}

.node-shape {
    transition: stroke 0.2s, stroke-width 0.2s, opacity 0.2s;
}

.node-label {
    font-size: 10px;
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: central;
    transition: opacity 0.2s, fill 0.2s;
}

/* Game node labels (below circles) - light text on dark background */
.node-label-game {
    fill: var(--ctp-text);
    font-size: 10px;
}

/* Attribute node labels (inside rectangles) - dark text on colored background */
.node-label-attribute {
    fill: var(--ctp-crust);
    font-weight: 600;
    font-size: 9px;
}

/* Highlighted label states */
.graph-highlighted .node-label-game {
    fill: var(--ctp-text);
}

.graph-highlighted .node-label-attribute {
    fill: var(--ctp-crust);
}

/* Highlight / dim states */
.graph-dimmed .link {
    opacity: 0.1;
}

.graph-dimmed .node-shape {
    opacity: 0.15;
}

.graph-dimmed .node-label {
    opacity: 0.15;
}

.graph-highlighted .link {
    opacity: 1;
    stroke: var(--ctp-blue);
}

.graph-highlighted .node-shape {
    opacity: 1;
    stroke: var(--ctp-text) !important;
    stroke-width: 2.5px !important;
}

.graph-highlighted .node-label {
    opacity: 1;
}

/* Search highlight */
.search-highlight .node-shape {
    stroke: var(--ctp-yellow) !important;
    stroke-width: 3px !important;
}

.search-dimmed {
    opacity: 0.08 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .layout {
        flex-direction: column-reverse;
    }

    .sidebar {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 1px solid var(--ctp-surface1);
    }

    header {
        flex-direction: column;
        gap: 8px;
        height: auto;
        padding: 12px 16px;
    }

    header h1 {
        font-size: 1.2rem;
    }

    #search-input {
        width: 100%;
    }

    .search-container {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .sidebar {
        max-height: 150px;
    }
}