:root {
    /* Dark Mode (Black & Gold) */
    --bg-color: #050505;
    --bg-mesh: radial-gradient(at 40% 20%, hsla(45, 100%, 50%, 0.1) 0px, transparent 50%),
               radial-gradient(at 80% 0%, hsla(40, 100%, 60%, 0.05) 0px, transparent 50%),
               radial-gradient(at 0% 50%, hsla(35, 100%, 40%, 0.1) 0px, transparent 50%);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(212, 175, 55, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    --text-primary: #fdfbf7;
    --text-secondary: #c5bda8;
    --accent: #d4af37;
    --accent-hover: #e5c158;
    --danger: #ef4444;
}

body.light-mode {
    --bg-color: #fcfbf8;
    --bg-mesh: radial-gradient(at 40% 20%, hsla(45, 100%, 50%, 0.1) 0px, transparent 50%),
               radial-gradient(at 80% 0%, hsla(40, 100%, 60%, 0.05) 0px, transparent 50%),
               radial-gradient(at 0% 50%, hsla(35, 100%, 40%, 0.1) 0px, transparent 50%);
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(212, 175, 55, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    --text-primary: #1a1a1a;
    --text-secondary: #5c5646;
    --accent: #b8860b;
    --accent-hover: #d4af37;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow: hidden; /* Prevent scrolling on the body */
    line-height: 1.6;
}

.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: var(--bg-mesh);
    z-index: -1;
    pointer-events: none;
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

/* App Views */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.view.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
}

/* Home Screen */
#home-view {
    height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.home-card {
    max-width: 600px;
    width: 100%;
    padding: 3rem;
    text-align: center;
}

.home-icon {
    width: 64px;
    height: 64px;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.home-title {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.home-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.home-actions {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.drop-zone {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0,0,0,0.2);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(129, 140, 248, 0.1);
}

.drop-zone i {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.drop-zone span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Buttons */
button {
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: 8px;
}

.primary-btn {
    background-color: var(--accent);
    color: white;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 500;
}

.primary-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.primary-btn.sm {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

.secondary-btn {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 1rem 2rem;
}

.secondary-btn:hover {
    background-color: rgba(255,255,255,0.05);
}

.secondary-btn.sm {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

.icon-btn {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

/* Study Screen */
#study-view {
    height: 100vh;
    padding: 1rem;
    gap: 1rem;
}

.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    flex-shrink: 0;
}

.title-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 600;
    width: 50%;
    outline: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

.title-input:focus {
    border-bottom-color: var(--accent);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Board Toolbar */
.board-toolbar {
    display: flex;
    gap: 1rem;
    padding: 1rem 2rem;
    align-items: center;
    flex-shrink: 0;
}

.search-input {
    width: 300px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: var(--accent);
}

.toolbar-spacer {
    flex: 1;
}

/* The Board (Whiteboard/Web Layout) */
#board-container {
    flex: 1;
    overflow: auto;
    background: rgba(0,0,0,0.1);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    position: relative;
    cursor: grab;
    /* Custom scrollbar */
}

#board-container:active {
    cursor: grabbing;
}

#board-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
#board-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
}
#board-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

#board-scroll-area {
    position: relative;
    width: 5000px;
    height: 4000px;
    transform-origin: 0 0;
}

#lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#nodes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Draggable Nodes */
.node {
    position: absolute;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    width: 350px;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    z-index: 2;
    transition: box-shadow 0.2s, border-color 0.3s;
}

.node:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    z-index: 3;
}

.node-header {
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    cursor: grab;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--glass-border);
}

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

.node-header span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.node-header i {
    width: 18px;
    height: 18px;
}

.general-node {
    width: 450px;
    border-color: rgba(255, 255, 255, 0.2);
}

.main-node {
    border-color: rgba(212, 175, 55, 0.5);
}

.main-node .node-header i {
    color: var(--accent);
}

.linked-node {
    border-color: rgba(197, 189, 168, 0.4);
}

.linked-node .node-header i {
    color: var(--text-secondary);
}

.node-body {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.verse-text {
    font-size: 1.05rem;
    line-height: 1.6;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for verse text */
.verse-text::-webkit-scrollbar {
    width: 6px;
}
.verse-text::-webkit-scrollbar-track {
    background: transparent;
}
.verse-text::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.node-notes {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    outline: none;
    transition: border-color 0.3s;
}

.node-notes:focus {
    border-color: var(--accent);
}

.general-node .node-notes {
    min-height: 250px;
    margin: 1rem;
    font-size: 1.05rem;
}

.btn-remove {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.2rem;
    cursor: pointer;
    border-radius: 4px;
}

.btn-remove:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 12, 16, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 1rem;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    animation: spin 1s linear infinite;
    color: var(--accent);
    width: 40px;
    height: 40px;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    border-radius: 8px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}
