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

:root {
    /* Light mode colors */
    --bg-color: #f8f9fa;
    --text-color: #333;
    --header-color: #2c3e50;
    --subtext-color: #7f8c8d;
    --container-bg: white;
    --button-bg: #ecf0f1;
    --button-active-bg: #3498db;
    --button-active-text: white;
    --border-color: #ecf0f1;
    --hover-bg: #f5f7fa;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --modal-shadow: rgba(0, 0, 0, 0.2);
    --link-color: #3498db;
    --tag-bg: #e0f7fa;
    --tag-color: #0097a7;
    --node-color: #3498db;
    --node-stroke: #fff;
    --link-stroke: #bdc3c7;
    --overlay-bg: rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark mode colors */
        --bg-color: #121212;
        --text-color: #e0e0e0;
        --header-color: #e0e0e0;
        --subtext-color: #aaaaaa;
        --container-bg: #1e1e1e;
        --button-bg: #333333;
        --button-active-bg: #0d6efd;
        --button-active-text: white;
        --border-color: #444444;
        --hover-bg: #2a2a2a;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --modal-shadow: rgba(0, 0, 0, 0.4);
        --link-color: #63b3ed;
        --tag-bg: #2c5282;
        --tag-color: #bee3f8;
        --node-color: #63b3ed;
        --node-stroke: #2d3748;
        --link-stroke: #4a5568;
        --overlay-bg: rgba(0, 0, 0, 0.7);
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--header-color);
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: var(--subtext-color);
}

.view-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.view-controls button {
    background-color: var(--button-bg);
    border: none;
    padding: 0.75rem 1.5rem;
    margin: 0 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.view-controls button.active {
    background-color: var(--button-active-bg);
    color: var(--button-active-text);
}

#graph-container {
    height: 70vh;
    border-radius: 8px;
    background-color: var(--container-bg);
    box-shadow: 0 4px 6px var(--shadow-color);
    overflow: hidden;
}

#list-container {
    background-color: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--shadow-color);
    padding: 1.5rem;
}

.note-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.note-item:hover {
    background-color: var(--hover-bg);
}

.note-item h3 {
    color: var(--header-color);
    margin-bottom: 0.5rem;
}

.note-item .note-date {
    font-size: 0.85rem;
    color: var(--subtext-color);
}

.note-item .note-tags {
    display: flex;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.tag {
    background-color: var(--tag-bg);
    color: var(--tag-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

#note-detail {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    background-color: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 10px 25px var(--modal-shadow);
    padding: 2rem;
    overflow-y: auto;
    z-index: 1000;
}

#note-detail.hidden {
    display: none;
}

.active-view {
    display: block;
}

.hidden-view {
    display: none;
}

#close-detail {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--subtext-color);
}

#note-title {
    font-size: 1.8rem;
    color: var(--header-color);
    margin-bottom: 1rem;
}

.note-metadata {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

#note-date {
    font-size: 0.9rem;
    color: var(--subtext-color);
    margin-bottom: 0.5rem;
}

#note-tags {
    display: flex;
    flex-wrap: wrap;
}

#note-content {
    line-height: 1.8;
    color: var(--text-color);
}

#note-content a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--link-color);
}

/* Graph styling */
.node {
    cursor: pointer;
}

.node circle {
    fill: var(--node-color);
    stroke: var(--node-stroke);
    stroke-width: 2px;
}

.node text {
    font-size: 12px;
    fill: var(--header-color);
}

.link {
    fill: none;
    stroke: var(--link-stroke);
    stroke-width: 1.5px;
}

/* Overlay for note detail */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    z-index: 999;
}

.overlay.hidden {
    display: none;
}