/*
        Copyright (C) 2026 - Kiwi Docs by Veer Bajaj <https://github.com/kiwidocs>

        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/
* {
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    margin: 0;
    background: var(--bg-dark);
    background-image: var(--gradient-bg-1), var(--gradient-bg-2);
    color: var(--text-main);
    height: 100vh;
    display: block;
    overflow-y: auto;
}

/* Sidebar Styling */
nav {
    display: none !important;
}

.nav-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.logo-circle {
    width: 32px;
    height: 32px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    box-shadow: var(--glow);
    /* Image set via JS or inline style if needed, but defaults can be in CSS if static */
    background-color: transparent;
}

.nav-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    margin: 0;
    background: linear-gradient(to right, #fff, #8b949e);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-group-title {
    padding: 24px 24px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-link {
    padding: 10px 24px;
    margin: 2px 12px;
    border-radius: 10px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateX(4px);
}

.folder-chevron {
    font-size: 0.7rem;
    color: var(--text-dim);
    transition: transform 0.2s ease;
    margin-left: auto;
}

.folder-chevron.open {
    transform: rotate(180deg);
}

.nav-link img {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-link:hover img {
    transform: scale(1.2);
    opacity: 1 !important;
}

.nav-link.active {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
    font-weight: 500;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 3px;
    background: var(--accent-primary);
    border-radius: 0 4px 4px 0;
    box-shadow: var(--glow);
}

/* Main Content area */
main {
    padding: 40px;
    min-height: 100vh;
}

#content {
    width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.02);
    padding: 48px;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    line-height: 1.8;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#content h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 2rem;
    color: white;
}

#content h2 {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    color: #fff;
}

#content blockquote {
    border-left: 4px solid var(--accent-primary);
    padding: 1rem 2rem;
    margin: 2rem 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0 12px 12px 0;
}

#content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

/* Right Sidebar activity/toc */
aside {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-left: 1px solid var(--glass-border);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.aside-section h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-link {
    display: block;
    padding: 6px 0;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
}

.toc-link:hover {
    color: var(--accent-primary);
}

.toc-h2 {
    padding-left: 12px;
}

.toc-h3 {
    padding-left: 24px;
    font-size: 0.8rem;
}

.activity-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border);
}

.activity-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent-secondary);
}

.activity-msg {
    font-size: 0.85rem;
    color: var(--text-main);
    margin: 4px 0;
}

.activity-date {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Responsive */
@media (max-width: 1200px) {
    body {
        grid-template-columns: 240px 1fr;
    }

    aside {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        grid-template-columns: 1fr;
    }

    nav {
        position: fixed;
        transform: translateX(-100%);
        width: 280px;
        height: 100vh;
    }

    nav.open {
        transform: translateX(0);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

select.config-select {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    font-size: 0.7rem;
    padding: 4px 6px;
    outline: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

select.config-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--text-main);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: rgba(13, 17, 23, 0.9);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 32px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.modal h3 {
    margin-top: 0;
    font-family: 'Outfit', sans-serif;
    color: white;
}

.modal input,
.modal textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    padding: 12px;
    margin-bottom: 16px;
    font-family: 'Inter', sans-serif;
}

.modal textarea {
    height: 200px;
    resize: vertical;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--accent-primary);
    color: #0d1117;
}

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

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Toast */
#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--accent-primary);
    color: #0d1117;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    display: none;
    z-index: 1001;
    box-shadow: 0 8px 24px rgba(88, 166, 255, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.nav-footer {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--glass-border);
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
}

.nav-footer strong {
    color: var(--accent-primary);
    font-weight: 600;
}

#settings-trigger {
    position: fixed;
    top: 24px;
    right: 32px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#settings-trigger:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(88, 166, 255, 0.2);
}

#settings-trigger img {
    opacity: 0.7;
    transition: transform 0.3s ease;
}

#settings-trigger:hover img {
    opacity: 1;
    transform: rotate(45deg);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.btn-text {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.btn-text:hover {
    opacity: 0.8;
}