/* Unified color palette for a minimal and cohesive design */
:root {
    /* Light theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #2d3436;
    --text-secondary: #4a4a4a;
    --text-muted: #6c757d;
    --accent: #0066cc;
    --accent-hover: #004d99;
    --card-bg: #ffffff;
    --card-border: #e0e0e0;
    --button-bg: var(--accent);
    --button-text: #ffffff;
    --button-hover: var(--accent-hover);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --link-color: var(--accent);
    --link-hover: var(--accent-hover);
    --border-color: #e0e0e0;
    --header-bg: linear-gradient(135deg, #007acc 0%, #005f99 100%);
    --header-text: #ffffff;
}

body.dark {
    /* Dark theme */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --accent: #66b3ff;
    --accent-hover: #99ccff;
    --card-bg: #2d2d2d;
    --card-border: #404040;
    --button-bg: #004499;
    --button-text: #ffffff;
    --button-hover: #003377;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --link-color: #66b3ff;
    --link-hover: #99ccff;
    --border-color: #404040;
    --header-bg: linear-gradient(135deg, #004466 0%, #002233 100%);
    --header-text: #e0e0e0;
}

/* Base styles */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    overflow-x: hidden;
}

main {
    flex: 1;
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 20px 0 0 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
    border-right: 1px solid var(--border-color);
}

.sidebar h2 {
    text-align: center;
    font-size: 1.3em;
    margin-bottom: 1em;
    font-weight: 400;
}

.folder-tree {
    list-style: none;
    padding-left: 20px;
}

.folder {
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
    display: block;
    position: relative;
    padding-left: 18px;
    color: var(--text-primary);
}

.folder::before {
    content: '\25B6'; /* right-pointing triangle */
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 0.9em;
    transition: transform 0.2s;
}

.folder.collapsed::before {
    transform: rotate(0deg);
}

.folder.expanded::before {
    transform: rotate(90deg);
}

.folder + ul {
    display: block;
    margin-bottom: 0.5em;
}

.folder.collapsed + ul {
    display: none;
}

.file {
    margin-left: 20px;
    cursor: pointer;
    display: block;
    padding: 3px 0;
    color: var(--link-color);
    transition: color 0.2s;
}

.file:hover {
    color: var(--link-hover);
    background: var(--bg-secondary);
    text-decoration: underline;
}

.content {
    flex: 1;
    padding: 40px;
    background: var(--bg-primary);
    overflow-y: auto;
}

#note-content pre {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 6px;
    font-size: 1em;
    white-space: pre-wrap;
}

/* Dark mode toggle */
.dark-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1em;
}

.dark-toggle label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.dark-toggle input[type="checkbox"] {
    display: none;
}

.dark-toggle .icon {
    font-size: 1.2rem;
    margin-right: 0.5em;
    transition: transform 0.3s ease;
}

.dark-toggle input[type="checkbox"]:checked + label .icon {
    transform: rotate(180deg);
}

/* Ensure dark mode styles are applied correctly */
body.dark {
    background: var(--bg-primary);
    color: var(--text-primary);
}

body.dark .sidebar {
    background: var(--bg-primary);
    color: var(--text-primary);
}

body.dark .content {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

body.dark .file {
    color: var(--link-color);
}

body.dark .file:hover {
    color: var(--link-hover);
}

body.dark #note-content pre {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

body.dark .footer {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.iframe-note-container {
    width: 100%;
    height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.iframe-note-container iframe {
    flex: 1 1 auto;
    width: 100%;
    min-height: 60vh;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    box-shadow: var(--shadow);
}

.external-note-btn {
    margin: 12px auto 0 auto;
    display: inline-block;
    padding: 0.5em 1.2em;
    background: var(--button-bg);
    color: var(--button-text);
    border-radius: 5px;
    text-decoration: none;
    font-size: 1em;
    font-weight: bold;
    transition: background 0.2s;
}

.external-note-btn:hover {
    background: var(--button-hover);
    color: var(--button-text);
}

@media (max-width: 700px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        box-shadow: none;
    }

    .content {
        padding: 20px;
    }
}

.hero {
    text-align: center;
    margin: 40px auto;
    padding: 20px;
    animation: fadeIn 1.5s ease;
    background: var(--header-bg);
    color: var(--header-text);
    border-radius: 8px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: bold;
    color: var(--header-text);
    margin-bottom: 0.5em;
}

.hero p {
    font-size: 1.2rem;
    color: var(--header-text);
    opacity: 0.9;
}

.hero-intro {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 1em;
}

.hero-buttons button {
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 6px;
    margin: 0 0.5em;
    padding: 0.7em 1.5em;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.3s ease;
    box-shadow: var(--shadow);
}

.hero-buttons button:hover {
    background: var(--button-hover);
    transform: scale(1.05);
}

.search-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0 1.5rem 0;
}

.search-bar {
    width: 350px;
    max-width: 90vw;
    padding: 0.8em 1em;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: var(--font);
    outline: none;
    margin-bottom: 0.5em;
}

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

search-hint {
    color: var(--text-muted);
    font-size: 0.95em;
}

.notes-preview {
    margin: 2rem 0;
}

.notes-cards {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.note-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.2em 1.5em;
    min-width: 220px;
    max-width: 270px;
    margin-bottom: 1em;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.note-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.note-title {
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 0.3em;
}

.note-tags {
    font-size: 0.95em;
    color: var(--accent);
    margin-bottom: 0.5em;
}

.note-preview {
    color: var(--text-secondary);
    font-size: 0.98em;
    margin-bottom: 1em;
}

.note-actions button {
    background: none;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 5px;
    margin-right: 0.5em;
    padding: 0.3em 0.8em;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.note-actions button:hover {
    background: var(--accent);
    color: #fff;
}

/* Enhance button styles */
button {
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 6px;
    padding: 0.7em 1.5em;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: var(--shadow);
}

button:hover {
    background: var(--button-hover);
    transform: scale(1.05);
}

button:active {
    transform: scale(0.95);
}

.features-section {
    margin: 2.5rem 0 1.5rem 0;
    text-align: center;
}

.features-list {
    display: inline-block;
    text-align: left;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.features-list li {
    margin: 0.5em 0;
    font-size: 1.08em;
    color: var(--text-secondary);
}

.about-section {
    margin: 2.5rem 0 1.5rem 0;
    text-align: center;
    margin-bottom: 100px; /* Add spacing to prevent overlap */
}

.about-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5em;
    margin-top: 1em;
}

.photo-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.about-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
}

.uni-logo {
    position: absolute;
    width: 60px;
    height: 60px;
    object-fit: contain;
    bottom: -10px;
    left: -10px;
    z-index: 1;
}

.about-socials a {
    color: var(--accent);
    text-decoration: none;
    margin: 0 0.3em;
    font-size: 1.1em;
}

.about-socials a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .about-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .photo-container {
        width: 120px;
        height: 120px;
    }

    .uni-logo {
        width: 50px;
        height: 50px;
        bottom: -5px;
        left: -5px;
    }
}

@media (max-width: 480px) {
    .photo-container {
        width: 100px;
        height: 100px;
    }

    .uni-logo {
        width: 40px;
        height: 40px;
    }
}

.tech-stack-section {
    margin: 2.5rem 0 1.5rem 0;
    text-align: center;
}

.tech-stack-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2em;
    justify-content: center;
    margin-top: 1em;
}

.tech-stack-grid span {
    background: var(--card-bg);
    color: var(--accent);
    border-radius: 6px;
    padding: 0.5em 1.2em;
    font-size: 1.05em;
    border: 1px solid var(--card-border);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}

.footer {
    text-align: center;
    font-size: 0.9em;
    padding: 20px 0;
    width: 100%;
    position: relative;
    bottom: 0;
    left: 0;
    background-color: var(--bg-primary);
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

.footer-links {
    margin-top: 0.5em;
}

.footer-links a {
    color: var(--link-color);
    text-decoration: none;
    margin: 0 0.5em;
    font-size: 0.9em;
}

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

/* Subtle animated background: floating code snippets */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        120deg,
        transparent 0 40px,
        #007acc11 40px 80px,
        transparent 80px 120px
    );
    opacity: 0.12;
    animation: float-bg 18s linear infinite;
}

@keyframes float-bg {
    0% { background-position: 0 0; }
    100% { background-position: 200px 400px; }
}

/* Responsive tweaks */
@media (max-width: 900px) {
    .notes-cards { flex-direction: column; align-items: center; }
    .about-content { flex-direction: column; }
    .tech-stack-grid { flex-direction: column; }
}

/* Add fade-in animation for hero section */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-buttons button {
        padding: 0.5em 1em;
        font-size: 0.9rem;
    }

    .about-content {
        flex-direction: column;
        gap: 1em;
    }

    .about-photo {
        width: 60px;
        height: 60px;
    }

    .tech-stack-grid {
        flex-direction: column;
        gap: 0.8em;
    }

    .notes-cards {
        flex-direction: column;
        align-items: center;
    }

    .note-card {
        width: 90%;
        max-width: none;
    }

    .footer {
        font-size: 0.9em;
        padding: 0.8em 0;
    }
}

/* Typography enhancements */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
}

p {
    font-size: 1rem;
    color: var(--text-secondary);
}

a {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
}
