/**
 * AnkiGraph - Knowledge Graph Styles
 * Extracted from matheus.html
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: #1a1a1a;
    color: #dcddde;
    overflow: hidden;
    user-select: none;
}

#graph {
    width: 100vw;
    height: 100vh;
    background: #1a1a1a;
}

.node {
    cursor: grab;
    transition: opacity 0.3s ease;
}

.node:active {
    cursor: grabbing;
}

.node circle {
    stroke-width: 2px;
    transition: all 0.2s ease;
}

.node.highlighted circle {
    filter: drop-shadow(0 0 8px currentColor);
}

.node.dimmed {
    opacity: 0.15;
}

.node text {
    font-size: 11px;
    fill: #dcddde;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.node:hover text,
.node.highlighted text {
    opacity: 1;
}

.link {
    stroke: #4a4a4a;
    stroke-opacity: 0.6;
    transition: all 0.3s ease;
}

.link.highlighted {
    stroke: #a855f7;
    stroke-opacity: 1;
    stroke-width: 2px;
}

.link.dimmed {
    stroke-opacity: 0.08;
}

#tooltip {
    position: absolute;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    transition: opacity 0.15s ease;
}

#tooltip.visible {
    opacity: 1;
}

#tooltip h3 {
    margin-bottom: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

#tooltip .meta {
    color: #888;
    font-size: 11px;
    display: flex;
    gap: 12px;
}

/* Burger menu button */
#menuToggle {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    cursor: pointer;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    transition: all 0.2s;
}

#menuToggle:hover {
    background: rgba(50, 50, 50, 0.9);
}

#menuToggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    position: relative;
    transition: all 0.3s;
}

#menuToggle span::before,
#menuToggle span::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #fff;
    transition: all 0.3s;
}

#menuToggle span::before { top: -6px; }
#menuToggle span::after { top: 6px; }

#menuToggle.active span { background: transparent; }
#menuToggle.active span::before { transform: rotate(45deg); top: 0; }
#menuToggle.active span::after { transform: rotate(-45deg); top: 0; }

/* Settings gear button */
#settingsToggle {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    cursor: pointer;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    transition: all 0.2s;
    font-size: 20px;
}

#settingsToggle:hover {
    background: rgba(50, 50, 50, 0.9);
}

#settingsToggle.active {
    background: #a855f7;
}

/* Settings dropdown */
#settingsDropdown {
    position: fixed;
    top: 64px;
    right: 16px;
    width: 260px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    z-index: 100;
    backdrop-filter: blur(12px);
    display: none;
    overflow: hidden;
}

#settingsDropdown.visible { display: block; }

.settings-section {
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
}

.settings-section:last-child { border-bottom: none; }

.settings-section h3 {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: #ccc;
}

#controls {
    position: fixed;
    top: 16px;
    left: 64px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    z-index: 100;
    backdrop-filter: blur(12px);
    width: 280px;
    max-height: calc(100vh - 32px);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#controls.visible { display: flex; }

#controls .panel-header {
    padding: 16px;
    border-bottom: 1px solid #3a3a3a;
}

#controls h1 {
    font-size: 18px;
    margin: 0;
    color: #fff;
    font-weight: 600;
}

#controls .stats {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid #3a3a3a;
}

.tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover { color: #ccc; }

.tab.active {
    color: #a855f7;
    border-bottom-color: #a855f7;
}

.tab-content {
    display: none;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.tab-content.active { display: block; }

#search {
    width: 100%;
    padding: 8px 12px;
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #dcddde;
    font-size: 13px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

#search:focus {
    outline: none;
    border-color: #a855f7;
}

#search::placeholder {
    color: #666;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}

.control-group label span {
    color: #666;
    font-size: 11px;
}

.control-group input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: #3a3a3a;
    border-radius: 2px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #a855f7;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid #2a2a2a;
}

.toggle-group label {
    font-size: 12px;
    color: #999;
}

.toggle {
    position: relative;
    width: 36px;
    height: 20px;
    background: #3a3a3a;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle.active {
    background: #a855f7;
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle.active::after {
    transform: translateX(16px);
}

/* Light mode for new elements */
body.light-mode #menuToggle,
body.light-mode #settingsToggle {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ddd;
}

body.light-mode #menuToggle span,
body.light-mode #menuToggle span::before,
body.light-mode #menuToggle span::after {
    background: #333;
}

body.light-mode #menuToggle.active span {
    background: transparent;
}

body.light-mode #settingsToggle {
    color: #333;
}

body.light-mode #settingsDropdown {
    background: rgba(255, 255, 255, 0.98);
    border-color: #ddd;
}

body.light-mode .settings-section {
    border-bottom-color: #eee;
}

body.light-mode .settings-item {
    color: #333;
}

body.light-mode .tab {
    color: #666;
}

body.light-mode .tab:hover {
    color: #333;
}

#minimap {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 150px;
    height: 100px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    overflow: hidden;
    z-index: 100;
}

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

#minimap .viewport {
    fill: rgba(168, 85, 247, 0.1);
    stroke: #a855f7;
    stroke-width: 1;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Light mode styles */
body.light-mode {
    background: #f5f5f5;
    color: #1a1a1a;
}

body.light-mode #graph {
    background: #f5f5f5;
}

body.light-mode #controls,
body.light-mode #legend,
body.light-mode #minimap {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ddd;
}

body.light-mode #controls h1 {
    color: #1a1a1a;
}

body.light-mode #controls .stats {
    color: #666;
}

body.light-mode #search {
    background: #fff;
    border-color: #ccc;
    color: #1a1a1a;
}

body.light-mode .control-group label {
    color: #555;
}

body.light-mode .control-group label span {
    color: #888;
}

body.light-mode .control-group input[type="range"] {
    background: #ddd;
}

body.light-mode .toggle-group {
    border-top-color: #e5e5e5;
}

body.light-mode .toggle-group label {
    color: #555;
}

body.light-mode .toggle {
    background: #ccc;
}

body.light-mode #legend .item {
    color: #333;
}

body.light-mode .node text {
    fill: #1a1a1a;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

body.light-mode .link {
    stroke: #bbb;
}

body.light-mode #tooltip {
    background: rgba(255, 255, 255, 0.98);
    border-color: #ddd;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

body.light-mode #tooltip h3 {
    color: #1a1a1a;
}

body.light-mode #tooltip .meta {
    color: #666;
}
