:root {
    --bg-color: #0f172a;
    --sidebar-bg: rgba(30, 41, 59, 0.7);
    --card-bg: rgba(51, 65, 85, 0.5);
    --primary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.15), transparent 25%);
}
.app-container {
    display: flex;
    height: 100%;
}
/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
}
.logo {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}
.nav-links {
    list-style: none;
    flex: 1;
}
.nav-links li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}
.nav-links li:hover,
.nav-links li.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}
.nav-links li.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.2) 0%, transparent 100%);
    border-left: 3px solid var(--primary-color);
}
/* Sidebar Footer (Timer & Sound) */
.sidebar-footer {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 16px;
}
.timer-widget {
    text-align: center;
    margin-bottom: 1rem;
}
.time-display {
    font-size: 2rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}
.timer-controls button {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    margin: 0 0.5rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.timer-controls button:hover {
    opacity: 1;
    text-shadow: 0 0 8px currentColor;
}
/* Content Area */
.content-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    padding: 2rem;
}
.view {
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2rem;
}
.view.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
    position: relative;
}
.view.hidden {
    display: none;
    /* Fallback */
}
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}
/* Mindmap Container */
.mindmap-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    border: var(--glass-border);
    position: relative;
    overflow: hidden;
    cursor: grab;
}
.mindmap-container:active {
    cursor: grabbing;
}
.mindmap-node {
    position: absolute;
    background: rgba(30, 41, 59, 0.95);
    border: 2px solid var(--primary-color);
    padding: 1rem;
    border-radius: 12px;
    min-width: 150px;
    max-width: 300px;
    color: var(--text-main);
    cursor: grab;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    user-select: none;
    z-index: 10;
    transition: box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}
.mindmap-node img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 0.5rem;
}
.mindmap-node:active {
    cursor: grabbing;
    transform: scale(1.02);
}
.mindmap-node.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.5);
}
.mindmap-svg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}
.connection-line {
    stroke: rgba(148, 163, 184, 0.4);
    stroke-width: 2px;
    fill: none;
}
/* Flashcards Grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}
.module-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    border: var(--glass-border);
    cursor: pointer;
    transition: transform 0.2s;
}
.module-card:hover {
    transform: translateY(-5px);
    background: rgba(51, 65, 85, 0.7);
}
/* Flashcards Study Mode */
.flashcard-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.flashcard {
    width: 600px;
    height: 400px;
    perspective: 1000px;
    cursor: pointer;
    margin-bottom: 2rem;
}
.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    border-radius: 16px;
}
.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}
.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 16px;
    padding: 2rem;
    background: var(--card-bg);
    /* Use semi-transparent dark bg */
    border: var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: auto;
}
.flashcard-back {
    transform: rotateY(180deg);
    background: rgba(15, 23, 42, 0.95);
    /* Slightly darker/solid for back */
}
/* Drawing Canvas in Editor */
canvas.drawing-canvas {
    border: 1px solid var(--text-muted);
    background: white;
    /* Needs white bg for drawing visibility usually, or adapting colors */
    border-radius: 8px;
    cursor: crosshair;
}
/* Context Menu */
.context-menu {
    position: absolute;
    background: var(--sidebar-bg);
    border: var(--glass-border);
    border-radius: 8px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    z-index: 100;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.context-menu button {
    background: none;
    border: none;
    color: var(--text-main);
    padding: 0.5rem 1rem;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.context-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
}
/* Universal Modal */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-container.hidden {
    display: none;
}
.modal-content {
    background: #1e293b;
    padding: 2rem;
    border-radius: 16px;
    border: var(--glass-border);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    /* Scroll if too tall */
    overflow-y: auto;
    color: var(--text-main);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
}
.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}
.form-group input,
.form-group textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
}
.form-group textarea {
    min-height: 100px;
    resize: vertical;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
}