/* ===== Knowledge Wiki Styles ===== */

.knowledge-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 0;
    padding-bottom: 0;
    padding-inline: 0;
    margin: 0;
}

/* ===== Layout: Sidebar + Main Content ===== */
.knowledge-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    flex: 1;
    min-height: calc(100vh - 70px);
    width: 100%;
    margin: 0;
    padding: 0;
    margin-top: 70px;
}

/* ===== Sidebar ===== */
.knowledge-sidebar {
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: hidden;
    overflow-x: hidden;
    padding: 1.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 102, 0, 0.3);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 102, 0, 0.5);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Sidebar Suche ===== */
.sidebar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.sidebar-search:focus-within {
    border-color: rgba(255, 102, 0, 0.4);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 8px rgba(255, 102, 0, 0.1);
}

.sidebar-search .search-icon {
    font-size: 1rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sidebar-search .search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    padding: 0;
}

.sidebar-search .search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Sidebar Hauptsuche ===== */
.sidebar-main-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.sidebar-main-search:focus-within {
    border-color: rgba(255, 102, 0, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 12px rgba(255, 102, 0, 0.15);
}

.sidebar-main-search .search-icon {
    font-size: 1.1rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sidebar-main-search .search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    width: 100%;
    padding: 0;
}

.sidebar-main-search .search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Sidebar Manage Button ===== */
.sidebar-manage-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 102, 0, 0.3);
    background: rgba(255, 102, 0, 0.1);
    color: var(--primary-orange-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sidebar-manage-btn:hover {
    background: rgba(255, 102, 0, 0.2);
    border-color: rgba(255, 102, 0, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.2);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-category-item {
    display: flex;
    flex-direction: column;
}

.sidebar-category-level-0 .sidebar-category-button {
    padding-left: 0.75rem;
}

.sidebar-category-level-1 .sidebar-category-button {
    padding-left: 2rem;
}

.sidebar-category-level-2 .sidebar-category-button {
    padding-left: 3.25rem;
}

.sidebar-category-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    width: 100%;
    position: relative;
}

.sidebar-category-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: translateX(2px);
}

.sidebar-category-button.active {
    background: rgba(255, 102, 0, 0.2);
    color: var(--primary-orange-light, #ff8833);
    border-left: 3px solid var(--primary-orange);
    box-shadow: 0 2px 8px rgba(255, 102, 0, 0.15);
}

.sidebar-category-button-all {
    font-weight: 600;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-category-button-all:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 102, 0, 0.3);
}

.sidebar-category-button-all.active {
    background: rgba(255, 102, 0, 0.25);
    border-color: var(--primary-orange);
}

.sidebar-category-button-nested {
    font-size: 0.9rem;
    font-weight: 400;
}

.sidebar-category-level-1 .sidebar-category-button-nested {
    font-size: 0.85rem;
}

.sidebar-category-level-2 .sidebar-category-button-nested {
    font-size: 0.8rem;
}

.category-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    min-width: 24px;
    flex-shrink: 0;
}

.category-button-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.category-button-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-button-count {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sidebar-category-button.active .category-button-count {
    background: rgba(255, 102, 0, 0.25);
    color: var(--primary-orange-light);
}

.category-button-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-button-arrow:hover {
    color: var(--primary-orange-light);
    background: rgba(255, 102, 0, 0.1);
    border-radius: 0.25rem;
}

.sidebar-category-item.expanded .category-button-arrow {
    transform: rotate(180deg);
}

.sidebar-category-children {
    display: none;
    flex-direction: column;
    gap: 0.15rem;
    margin-left: 0.5rem;
    padding-left: 0.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0.25rem;
}

.sidebar-category-item.expanded > .sidebar-category-children {
    display: flex;
}

.sidebar-empty {
    padding: 2rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Sidebar Footer ===== */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.sidebar-footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s ease;
}

.sidebar-footer-link:hover {
    color: var(--primary-orange-light);
}

.sidebar-footer-separator {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.sidebar-footer-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.4;
}

.sidebar-footer-info p {
    margin: 0.25rem 0;
}

/* ===== Main Content ===== */
.knowledge-main-content {
    padding: 2rem;
    padding-left: 2.5rem;
    padding-top: 2rem;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg-primary);
    min-height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.knowledge-main-content > * {
    width: 100%;
    max-width: 1200px;
}

/* ===== Willkommensseite ===== */
.knowledge-welcome {
    display: block;
    padding: 3rem 0;
    padding-top: calc(3rem + 20px);
    scroll-margin-top: 90px;
}

.welcome-content {
    max-width: 1200px;
    margin: 0 auto;
}

.welcome-title {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    line-height: 1.1;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-weight: 700;
}

.welcome-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin: 0 0 3rem 0;
}

.top-articles-section {
    margin-top: 3rem;
}

.top-articles-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

.top-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.top-article-card {
    min-height: auto;
}

/* Legacy hero styles - für Kompatibilität beibehalten */
.knowledge-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
    padding: 3rem;
    border-radius: 1.75rem;
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.25), rgba(0, 191, 255, 0.15));
    border: 1px solid rgba(255, 102, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.knowledge-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.3), transparent 55%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero-kicker {
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--primary-orange-light, #ff8833);
}

.hero-title {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    line-height: 1.05;
    margin: 0;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary, #cfcfcf);
    max-width: 520px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.knowledge-search {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 10, 0.55);
    backdrop-filter: blur(10px);
    flex: 1 1 320px;
}

.knowledge-search .search-icon {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.knowledge-search .search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
}

.knowledge-search .search-input::placeholder {
    color: var(--text-muted);
}

.hero-visual {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-grid {
    width: min(100%, 360px);
    aspect-ratio: 1;
    border-radius: 1.5rem;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 60%),
                linear-gradient(135deg, rgba(255, 102, 0, 0.35), rgba(0, 191, 255, 0.2));
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.35);
    mask-image: radial-gradient(circle, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
}

.knowledge-category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.category-nav-button {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 15, 15, 0.65);
    cursor: pointer;
    color: var(--text-primary);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.category-nav-button:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 102, 0, 0.5);
}

.category-nav-button .nav-icon {
    font-size: 1.2rem;
}

.category-nav-button .nav-count {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.knowledge-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Legacy - wird durch knowledge-main-content ersetzt */

.knowledge-category-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-margin-top: 90px;
    padding-top: 1rem;
}

.knowledge-category-section.is-hidden {
    display: none !important;
}

.knowledge-articles-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    width: 100%;
}

.knowledge-card {
    display: flex;
    flex-direction: column;
    background: rgba(18, 18, 18, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease;
    min-height: 220px;
}

.knowledge-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 102, 0, 0.45);
}

.knowledge-card .card-body {
    padding: 1.4rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.knowledge-card .card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.knowledge-card .card-title {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pill {
    padding: 0.15rem 0.55rem;
}

.badge-info {
    background: rgba(0, 191, 255, 0.18);
    color: #7ddcff;
}

.badge-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.badge-warning {
    background: rgba(255, 204, 0, 0.18);
    color: #ffd76b;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    list-style: none;
    margin: 0;
    padding: 0;
    color: var(--text-muted);
}

.card-meta li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.card-tags li {
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.knowledge-card .card-footer {
    margin-top: auto;
    padding: 0 1.5rem 1.1rem;
}

.card-link {
    color: var(--primary-orange-light, #ff8833);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.card-link:hover {
    color: #ffb877;
}

.knowledge-empty {
    text-align: center;
    padding: 3rem;
    border-radius: 1.5rem;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(12, 12, 12, 0.6);
    color: var(--text-secondary);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.knowledge-empty .empty-icon {
    font-size: 2.75rem;
    margin-bottom: 1rem;
}

.is-hidden {
    display: none !important;
}

/* ===== Admin Styles ===== */

.knowledge-admin {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-top: 6rem;
    padding-inline: clamp(1.5rem, 5vw, 4rem);
}

.knowledge-admin-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
}

.knowledge-admin-header .header-kicker {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--primary-orange-light);
    font-size: 0.8rem;
}

.knowledge-admin-header .header-title {
    margin: 0.25rem 0;
    font-size: clamp(2rem, 3vw, 2.75rem);
}

.knowledge-admin-header .header-subtitle {
    margin: 0;
    color: var(--text-secondary);
    max-width: 640px;
}

.knowledge-admin .header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.knowledge-tabs {
    display: inline-flex;
    gap: 0.75rem;
    padding: 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.knowledge-tab {
    border: none;
    background: transparent;
    padding: 0.65rem 1.35rem;
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
}

.knowledge-tab.active {
    background: rgba(255, 102, 0, 0.15);
    color: #ffd5b3;
}

.knowledge-tab-panel {
    display: none;
}

.knowledge-tab-panel.active {
    display: block;
}

.admin-table-container {
    background: rgba(14, 14, 14, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    padding: 1.5rem;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-table thead th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.action-buttons {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 102, 0, 0.3);
    transform: translateY(-1px);
}

.btn-icon-danger {
    background: rgba(255, 66, 66, 0.15);
}

.knowledge-category-card {
    background: rgba(16, 16, 16, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.knowledge-category-card .category-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.knowledge-category-card .category-avatar {
    width: 52px;
    height: 52px;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.08);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
}

.knowledge-category-card .category-meta {
    flex: 1;
}

.knowledge-category-card .category-meta p {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
}

.markdown-info {
    background: rgba(18, 18, 18, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1.25rem;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--text-secondary);
}

.markdown-info h3 {
    margin: 0;
    color: var(--text-primary);
}

.markdown-info .markdown-example {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.9rem;
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
}

.markdown-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

[data-knowledge-upload-zone] {
    margin-top: 1.5rem;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

[data-knowledge-upload-zone]:hover,
[data-knowledge-upload-zone].dragover {
    border-color: rgba(255, 102, 0, 0.5);
    background: rgba(255, 102, 0, 0.08);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.knowledge-upload-result {
    margin-top: 1rem;
    border-radius: 0.9rem;
    padding: 0.9rem 1.1rem;
    font-size: 0.9rem;
}

.knowledge-upload-success {
    background: rgba(51, 186, 121, 0.12);
    color: #7debb3;
}

.knowledge-upload-error {
    background: rgba(255, 77, 77, 0.12);
    color: #ff9b9b;
}

/* ===== Modals & Toasts ===== */

.knowledge-modal-overlay {
    z-index: 1200;
}

.knowledge-modal {
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.5rem;
    padding: 0;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.knowledge-modal .modal-body {
    padding: 1.75rem;
    overflow-y: auto;
}

.knowledge-modal .modal-footer,
.knowledge-modal .modal-header {
    padding: 1.4rem 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.knowledge-modal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: none;
}

.knowledge-modal-body .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.editor-shell {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    overflow: hidden;
    background: rgba(18, 18, 18, 0.75);
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-toolbar button {
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    padding: 0.35rem 0.6rem;
    border-radius: 0.55rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.editor-toolbar button:hover {
    background: rgba(255, 102, 0, 0.3);
}

.toolbar-color {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.05);
}

.toolbar-color span {
    font-size: 0.9rem;
}

.toolbar-color input[type="color"] {
    appearance: none;
    border: none;
    width: 26px;
    height: 26px;
    padding: 0;
    background: none;
    border-radius: 50%;
    cursor: pointer;
}

.editor-content {
    min-height: 260px;
    padding: 1rem 1.2rem;
    line-height: 1.6;
    overflow-y: auto;
}

.knowledge-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1300;
}

.knowledge-toast {
    padding: 0.75rem 1.1rem;
    border-radius: 0.75rem;
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    min-width: 220px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.knowledge-toast-success {
    border-color: rgba(51, 186, 121, 0.4);
}

.knowledge-toast-error {
    border-color: rgba(255, 77, 77, 0.4);
}

.knowledge-toast.hide {
    opacity: 0;
    transform: translateY(15px);
}

/* ===== Utility ===== */

.form-grid {
    display: grid;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group-inline {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
}

.form-help {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.4rem;
}

.status-dot.success {
    background: #4ade80;
}

.status-dot.warning {
    background: #fbbf24;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

.editor-wrapper {
    display: grid;
    gap: 1.5rem;
}

.markdown-wrapper {
    display: grid;
    gap: 1rem;
}

.markdown-wrapper textarea {
    min-height: 280px;
}

.markdown-preview {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    background: rgba(18, 18, 18, 0.7);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.markdown-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-secondary);
}

.markdown-preview-content {
    max-height: 320px;
    overflow-y: auto;
    line-height: 1.6;
}

.markdown-preview-content pre {
    background: rgba(10, 10, 10, 0.85);
    padding: 0.85rem;
    border-radius: 0.75rem;
    overflow-x: auto;
}

.markdown-preview-content code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1rem 0.4rem;
    border-radius: 0.4rem;
}

.markdown-preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.markdown-preview-content table th,
.markdown-preview-content table td {
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.5rem 0.75rem;
}

.markdown-preview-status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.knowledge-editor-image {
    max-width: 100%;
    border-radius: 0.75rem;
    margin: 0.75rem 0;
}

.image-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-modal-tabs {
    display: inline-flex;
    gap: 0.5rem;
    padding: 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.image-tab {
    border: none;
    background: transparent;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
}

.image-tab.active {
    background: rgba(255, 102, 0, 0.25);
    color: #ffd5b3;
}

.image-tab-panel {
    display: block;
}

.image-tab-panel.hidden {
    display: none;
}

.image-preview {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    padding: 0.75rem;
    display: grid;
    place-items: center;
}

.image-preview img {
    max-width: 100%;
    border-radius: 0.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.text-error {
    color: #ff9b9b;
}

@media (min-width: 992px) {
    .markdown-wrapper {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: stretch;
    }
    .markdown-wrapper textarea {
        min-height: 320px;
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .knowledge-layout {
        grid-template-columns: 240px 1fr;
    }
    
    .knowledge-sidebar {
        padding: 1rem;
    }
    
    .knowledge-main-content {
        padding: 1.5rem;
        padding-left: 1.75rem;
    }
}

/* ===== Mobile Sidebar Toggle Button ===== */
.sidebar-toggle-btn {
    display: none;
    position: fixed;
    top: 75px;
    left: 1rem;
    z-index: 1001;
    padding: 0.65rem 0.9rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 102, 0, 0.2);
    border-color: rgba(255, 102, 0, 0.4);
    transform: translateY(-1px);
}

.sidebar-toggle-btn .toggle-icon {
    font-size: 1.25rem;
}

.sidebar-toggle-btn .toggle-text {
    font-size: 0.9rem;
}

/* ===== Sidebar Overlay für Mobile ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: flex;
    }
    
    .knowledge-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .knowledge-sidebar {
        position: fixed;
        top: 70px;
        left: 0;
        width: 280px;
        height: calc(100vh - 70px);
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .knowledge-layout {
        margin-top: 70px;
    }
    
    .knowledge-sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    .knowledge-main-content {
        padding: 1.5rem;
        padding-top: 4.5rem;
    }
    
    .knowledge-welcome {
        padding: 2rem 0;
    }
    
    .welcome-title {
        font-size: 2rem;
    }
    
    .top-articles-grid {
        grid-template-columns: 1fr;
    }
}

