/* ===== DOCS PAGE STYLES ===== */

html, body { height: 100%; overflow: hidden; }

/* Background overlay override */
.page-bg-overlay { background: rgba(5, 0, 10, 0.85); }

/* ===== LAYOUT ===== */
.app-container {
    position: relative; z-index: 1;
    display: flex; height: calc(100vh - var(--nav-h));
    margin-top: var(--nav-h);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w); min-width: var(--sidebar-w);
    height: 100%; display: flex; flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 300ms var(--ease-out-expo);
}

.sidebar-header {
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-title {
    font-family: var(--font-display); font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted);
}

.sidebar-search {
    margin-top: 10px; width: 100%; padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px; outline: none; color: var(--white);
    font-family: var(--font-body); font-size: 0.82rem;
    transition: border-color 200ms ease, background 200ms ease;
}
.sidebar-search::placeholder { color: rgba(154,143,181,0.4); }
.sidebar-search:focus { border-color: rgba(166,110,247,0.3); background: rgba(255,255,255,0.08); }

.cat-list { flex: 1; overflow-y: auto; padding: 0.6rem; display: flex; flex-direction: column; gap: 2px; }
.cat-group { margin-bottom: 4px; }

.cat-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 10px; cursor: pointer;
    border: 1px solid transparent; font-family: var(--font-body);
    transition: background 200ms ease, border-color 200ms ease; user-select: none;
}
.cat-item:hover { background: rgba(255, 255, 255, 0.04); }
.cat-item.active {
    background: linear-gradient(135deg, rgba(166,110,247,0.18), rgba(92,200,223,0.1));
    border-color: rgba(255, 255, 255, 0.1);
}

.cat-icon {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}

.cat-name { font-size: 0.82rem; font-weight: 600; color: var(--white); flex: 1; }

.cat-count {
    font-size: 0.68rem; color: var(--muted); font-weight: 500;
    padding: 1px 8px; border-radius: 8px; background: rgba(255,255,255,0.04);
}

.cat-arrow { color: var(--muted); font-size: 0.7rem; transition: transform 250ms ease; }
.cat-item.expanded .cat-arrow { transform: rotate(90deg); }

.sub-list {
    max-height: 0; overflow: hidden;
    transition: max-height 300ms var(--ease-out-expo); padding-left: 20px;
}
.sub-list.show { max-height: 400px; }

.sub-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 8px; cursor: pointer;
    transition: background 200ms ease, color 200ms ease;
    color: var(--muted); font-size: 0.78rem; font-weight: 500;
}
.sub-item:hover { background: rgba(255,255,255,0.04); color: var(--white); }
.sub-item.active { color: var(--neon-cyan); background: rgba(92,200,223,0.08); }
.sub-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--muted); flex-shrink: 0; transition: background 200ms ease;
}
.sub-item.active .sub-dot { background: var(--neon-cyan); }

.icon-0 { background: linear-gradient(135deg, rgba(166,110,247,0.35), rgba(92,200,223,0.2)); }
.icon-1 { background: linear-gradient(135deg, rgba(224,96,154,0.35), rgba(166,110,247,0.2)); }
.icon-2 { background: linear-gradient(135deg, rgba(74,222,128,0.35), rgba(92,200,223,0.2)); }
.icon-3 { background: linear-gradient(135deg, rgba(240,208,96,0.35), rgba(224,96,154,0.2)); }
.icon-4 { background: linear-gradient(135deg, rgba(92,200,223,0.35), rgba(166,110,247,0.2)); }
.icon-5 { background: linear-gradient(135deg, rgba(224,150,80,0.35), rgba(240,208,96,0.2)); }

/* ===== CONTENT AREA ===== */
.content-area {
    flex: 1; display: flex; flex-direction: column; height: 100%; min-width: 0;
    overflow-y: auto;
}

.content-header { padding: 1.5rem 2rem 0; flex-shrink: 0; }

.content-breadcrumb {
    font-size: 0.72rem; color: var(--muted); margin-bottom: 0.5rem;
    display: flex; align-items: center; gap: 6px;
}
.content-breadcrumb span { color: var(--neon-purple); }

.content-title-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.3rem;
}

.content-title {
    font-family: var(--font-display); font-size: 1.2rem; font-weight: 800;
    letter-spacing: 0.04em;
}

.docs-count {
    font-size: 0.78rem; color: var(--muted); font-weight: 500;
    padding: 4px 14px; border-radius: 10px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
}

.content-desc {
    font-size: 0.88rem; color: var(--muted); line-height: 1.6;
    max-width: 600px; margin-bottom: 1.2rem;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none; background: none; border: none; cursor: pointer;
    color: var(--muted); padding: 4px; transition: color 200ms ease;
}
.sidebar-toggle:hover { color: var(--white); }
.sidebar-toggle svg { width: 20px; height: 20px; }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 49;
    background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none;
    transition: opacity 300ms ease;
}

/* ===== DOCUMENT CARDS GRID ===== */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem; padding: 0 2rem 2rem;
}

.doc-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px; padding: 1.4rem;
    display: flex; flex-direction: column; gap: 10px; cursor: pointer;
    transition: border-color 300ms ease, transform 300ms var(--ease-spring), background 300ms ease;
}
.doc-card:hover {
    border-color: rgba(255, 255, 255, 0.15); transform: translateY(-4px);
    background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
}

.doc-card-top { display: flex; align-items: flex-start; gap: 14px; }

.doc-card-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}

.doc-card-head { flex: 1; min-width: 0; }

.doc-card-title {
    font-family: var(--font-display); font-size: 0.76rem; font-weight: 700;
    letter-spacing: 0.04em; margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.doc-card-tags { display: flex; gap: 5px; flex-wrap: wrap; }

.doc-tag {
    font-size: 0.58rem; font-weight: 600; padding: 2px 8px;
    border-radius: 6px; letter-spacing: 0.04em;
}
.tag-official { background: rgba(166,110,247,0.15); color: var(--neon-purple); }
.tag-important { background: rgba(224,96,154,0.15); color: var(--neon-pink); }
.tag-new { background: rgba(92,200,223,0.15); color: var(--neon-cyan); }
.tag-guide { background: rgba(74,222,128,0.15); color: var(--neon-green); }
.tag-advanced { background: rgba(240,208,96,0.15); color: var(--neon-yellow); }

.doc-card-preview {
    font-size: 0.82rem; color: var(--muted); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-card-meta {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.68rem; color: rgba(154,143,181,0.6);
    padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.04);
}

.doc-card-author { display: flex; align-items: center; gap: 6px; }
.doc-card-author-dot {
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.5rem;
}

.doc-card-date { color: rgba(154,143,181,0.4); }

/* ===== EDITOR VIEW ===== */
.editor-view { display: none; flex-direction: column; height: 100%; }
.editor-view.active { display: flex; }
.list-view.hidden { display: none; }

.editor-toolbar {
    display: flex; align-items: center; gap: 12px;
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0; flex-wrap: wrap;
}

.editor-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
    background: rgba(255,255,255,0.04); color: var(--muted); cursor: pointer;
    font-family: var(--font-body); font-size: 0.78rem; font-weight: 600;
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}
.editor-back:hover { background: rgba(255,255,255,0.08); color: var(--white); border-color: rgba(255,255,255,0.15); }
.editor-back svg { width: 14px; height: 14px; }

.editor-save {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 22px; border: none; border-radius: 12px; cursor: pointer;
    background: linear-gradient(135deg, rgba(166,110,247,0.4), rgba(92,200,223,0.3));
    color: var(--white); font-family: var(--font-display);
    font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em;
    transition: background 250ms ease, transform 200ms var(--ease-spring), box-shadow 250ms ease;
}
.editor-save:hover {
    background: linear-gradient(135deg, rgba(166,110,247,0.55), rgba(92,200,223,0.45));
    transform: translateY(-1px); box-shadow: 0 4px 16px rgba(166,110,247,0.2);
}
.editor-save:active { transform: scale(0.95); }
.editor-save svg { width: 14px; height: 14px; }

.editor-save.saved {
    background: linear-gradient(135deg, rgba(74,222,128,0.4), rgba(92,200,223,0.3));
}

.editor-status {
    font-size: 0.7rem; color: var(--muted); margin-left: auto;
    display: flex; align-items: center; gap: 6px;
}
.editor-status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--muted); transition: background 200ms ease;
}
.editor-status-dot.modified { background: var(--neon-orange); }
.editor-status-dot.saved { background: var(--neon-green); }

.editor-shortcut {
    font-size: 0.62rem; color: rgba(154,143,181,0.35);
    padding: 2px 8px; border-radius: 4px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.04);
}

.editor-body {
    flex: 1; overflow-y: auto; padding: 1.5rem 2rem 2rem;
    display: flex; flex-direction: column; gap: 1rem;
}

.editor-title-input {
    font-family: var(--font-display); font-size: 1.4rem; font-weight: 800;
    letter-spacing: 0.03em; color: var(--white);
    background: transparent; border: none; outline: none;
    border-bottom: 2px solid rgba(255,255,255,0.06);
    padding-bottom: 10px; width: 100%;
    transition: border-color 200ms ease;
}
.editor-title-input:focus { border-color: rgba(166,110,247,0.4); }
.editor-title-input::placeholder { color: rgba(154,143,181,0.3); }

.editor-meta-row {
    display: flex; align-items: center; gap: 1.5rem;
    font-size: 0.74rem; color: var(--muted);
}
.editor-meta-item { display: flex; align-items: center; gap: 5px; }
.editor-meta-item svg { width: 13px; height: 13px; opacity: 0.5; }

.editor-content {
    flex: 1; min-height: 300px; width: 100%;
    padding: 1.2rem 1.4rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px; outline: none;
    color: var(--white); font-family: var(--font-body);
    font-size: 0.92rem; line-height: 1.8; resize: none;
    transition: border-color 200ms ease, background 200ms ease;
}
.editor-content:focus {
    border-color: rgba(166,110,247,0.3);
    background: rgba(255,255,255,0.05);
}
.editor-content::placeholder { color: rgba(154,143,181,0.3); }

/* ===== TOAST ===== */
.toast {
    position: fixed; bottom: 2rem; right: 2rem; z-index: 200;
    padding: 12px 24px; border-radius: 12px;
    background: linear-gradient(135deg, rgba(74,222,128,0.25), rgba(92,200,223,0.15));
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border: 1px solid rgba(74,222,128,0.2);
    color: var(--neon-green); font-family: var(--font-body);
    font-size: 0.82rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    transform: translateY(20px); opacity: 0;
    transition: transform 350ms var(--ease-spring), opacity 300ms ease;
    pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast svg { width: 16px; height: 16px; }

/* ===== SCROLLBAR ===== */
.content-area::-webkit-scrollbar, .cat-list::-webkit-scrollbar, .editor-body::-webkit-scrollbar { width: 3px; }
.content-area::-webkit-scrollbar-track, .cat-list::-webkit-scrollbar-track, .editor-body::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb, .cat-list::-webkit-scrollbar-thumb, .editor-body::-webkit-scrollbar-thumb { background: rgba(166,110,247,0.3); border-radius: 4px; }

.editor-content::-webkit-scrollbar { width: 3px; }
.editor-content::-webkit-scrollbar-track { background: transparent; }
.editor-content::-webkit-scrollbar-thumb { background: rgba(166,110,247,0.2); border-radius: 4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; left: 0; top: var(--nav-h); bottom: 0;
        z-index: 50; transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { display: block; }
    .sidebar-backdrop.show { opacity: 1; pointer-events: all; }
    .sidebar-toggle { display: flex; }
    .content-header { padding: 1.2rem 1.2rem 0; }
    .docs-grid { grid-template-columns: 1fr; padding: 0 1.2rem 1.5rem; }
    .editor-toolbar { padding: 0.8rem 1.2rem; }
    .editor-body { padding: 1rem 1.2rem 1.5rem; }
    .editor-title-input { font-size: 1.1rem; }
    .toast { bottom: 1rem; right: 1rem; left: 1rem; justify-content: center; }
}

@media (max-width: 480px) {
    .doc-card { padding: 1.1rem; }
    .content-title { font-size: 1rem; }
    .editor-shortcut { display: none; }
}
