/**
 * @package     mod_elemiah_sidebar
 * @subpackage  Modules
 *
 * @copyright   (C) 2026 Waheed ur Rehman. All rights reserved.
 * @license     GNU General Public License version 3 or later
 *
 * Premium Knowledge Base Sidebar
 * Design Language: Luxury, Mystic, Elegant
 * Color Palette: Plum, Gold, Turquoise
 */

/* ============================================================
   BASE CONTAINER
   ============================================================ */
.elemiah-sidebar {
    font-family: 'Georgia', 'Times New Roman', serif;
    padding: 20px 0;
    max-width: 100%;
}

/* ============================================================
   TREE CONTAINER
   ============================================================ */
.elemiah-sidebar-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================================
   SIDEBAR ITEM - CARD STYLE
   ============================================================ */
.sidebar-item {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #ebe5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}

.sidebar-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(123, 61, 103, 0.08);
    border-color: #e9d9b5;
}

/* ============================================================
   LEVEL INDENTATION
   ============================================================ */
.sidebar-item.level-0 {
    margin-bottom: 0;
}

.sidebar-item.level-1 {
    margin-left: 16px; background:#Fff;
    border-left: 2px solid #e9d9b5;
    border-radius: 0 12px 12px 0;
}

.sidebar-item.level-2 {
    margin-left: 0px; background:#fff;
    border-left: 2px solid #e9d9b5;
    border-radius: 12px;
}

.sidebar-item.level-3 {
    margin-left: 48px; background:#Fff;
    border-left: 2px solid #e9d9b5;
    border-radius: 0 12px 12px 0;
}

.sidebar-item.level-4 {
    margin-left: 64px;background:#Fff;
    border-left: 2px solid #e9d9b5;
    border-radius: 0 12px 12px 0;
}

.sidebar-item.level-5 {
    margin-left: 80px; background:#Fff;
    border-left: 2px solid #e9d9b5;
    border-radius: 0 12px 12px 0;
}

/* ============================================================
   CATEGORY HEADER
   ============================================================ */
.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    background: #ffffff;
    border-radius: 12px;
    transition: background 0.25s ease;
    position: relative;
    min-height: 48px;
}

.sidebar-item:not(.expanded) .category-header {
    border-radius: 12px;
}

.sidebar-item.expanded .category-header {
    border-radius: 12px 12px 0 0;
}

.category-header:hover {
    background: #faf6ef;
}

/* ============================================================
   TOGGLE BUTTON - Premium Circle
   ============================================================ */
.elemiah-sidebar .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: none;
    background: #7b3d67;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(123, 61, 103, 0.15);
}

.elemiah-sidebar .sidebar-toggle:hover {
    background: #5c2c4d;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(123, 61, 103, 0.25);
}

.elemiah-sidebar .sidebar-toggle:focus-visible {
    outline: 2px solid #c79b43;
    outline-offset: 2px;
}

.elemiah-sidebar .sidebar-toggle .toggle-icon {
    display: inline-block;
    color: #ffffff;
    font-size: 11px;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: rotate(0deg);
}

.elemiah-sidebar .sidebar-item.expanded .sidebar-toggle .toggle-icon {
    transform: rotate(180deg);
}

.elemiah-sidebar  .sidebar-item:not(.expanded) .sidebar-toggle .toggle-icon {
    transform: rotate(0deg);
}

/* ============================================================
   TOGGLE PLACEHOLDER
   ============================================================ */
.elemiah-sidebar .sidebar-toggle-placeholder {
    display: inline-block;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* ============================================================
   CATEGORY TITLE
   ============================================================ */
.category-title {
    flex: 1;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 16px;
    font-weight: 600;
    color: #5c2c4d;
    letter-spacing: 0.01em;
    line-height: 1.4;
    word-break: break-word;
    transition: color 0.25s ease;
}

.category-header:hover .category-title {
    color: #7b3d67;
}

/* ============================================================
   ARTICLE COUNT - Gold Pill
   ============================================================ */
.article-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 12px;
    font-weight: 600;
    color: #5c2c4d;
    background: #e9d9b5;
    padding: 2px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
    transition: all 0.25s ease;
}

.category-header:hover .article-count {
    background: #c79b43;
    color: #ffffff;
}

/* ============================================================
   CATEGORY CONTENT - Accordion Animation
   ============================================================ */
.category-content {
    padding: 0;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                padding 0.3s ease;
    padding: 0 16px; background:#fff;
}

.sidebar-item.expanded .category-content {
    max-height: 2000px;
    opacity: 1;
    transform: translateY(0);
    padding: 0 16px 12px 16px;
}

/* ============================================================
   ARTICLE LIST
   ============================================================ */
.article-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
}

/* ============================================================
   ARTICLE ITEM
   ============================================================ */
.article-item {
    padding: 0;
    margin: 0;
    position: relative;
    border-bottom: 1px solid rgba(235, 229, 219, 0.3);
}

.article-item:last-child {
    border-bottom: none;
}

/* ============================================================
   ARTICLE LINK - With Gold Bullet
   ============================================================ */
.article-link {
    display: flex !important;
  align-items: center;
  padding: 8px 12px 8px 32px !important;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 14px;
    color: #474747;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    line-height: 1.5;
}

.article-link::before {
    content: '›';
    position: absolute;
    left: 10px;
    color: #c79b43;
    font-size: 18px;
    font-weight: 300;
    transition: all 0.3s ease;
}

.article-link:hover {
    background: #faf6ef;
    color: #5c2c4d;
    transform: translateX(6px);
    text-decoration: none;
}

.article-link:hover::before {
    transform: translateX(3px);
    color: #7b3d67;
}

.article-link:focus-visible {
    outline: 2px solid #c79b43;
    outline-offset: 2px;
}

/* ============================================================
   CURRENT ARTICLE - Gold Border Highlight
   ============================================================ */
.article-item.current-article .article-link {
    background: #faf6ef;
    color: #5c2c4d;
    font-weight: 600;
    border-left: 4px solid #c79b43;
    padding-left: 36px !important;
    border-radius: 8px;
}

.article-item.current-article .article-link::before {
    color: #7b3d67;
    font-weight: 600;
}

.article-item.current-article .article-link:hover {
    background: #f5ede0;
    transform: translateX(4px);
}

/* ============================================================
   CURRENT CATEGORY - Premium Highlight
   ============================================================ */
.sidebar-item.current-category {
    border-color: #c79b43;
    box-shadow: 0 4px 20px rgba(199, 155, 67, 0.12);
}

.sidebar-item.current-category .category-header {
    background: #faf6ef;
    padding-left: 12px;
}

.sidebar-item.current-category .category-title {
    color: #c79b43;
}

.sidebar-item.current-category .sidebar-toggle {
    background: #c79b43;
    box-shadow: 0 2px 12px rgba(199, 155, 67, 0.25);
}

.sidebar-item.current-category .sidebar-toggle:hover {
    background: #7b3d67;
}

/* ============================================================
   SUB-CATEGORY LIST
   ============================================================ */
.sub-category-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sub-category-list .sidebar-item {
    background: #faf8f4;
    border-color: #ebe5db;
}

.sub-category-list .sidebar-item:hover {
    background: #ffffff;
    border-color: #e9d9b5;
}

.sub-category-list .sidebar-item .category-header {
    background: transparent;
    padding: 10px 14px;
}

.sub-category-list .sidebar-item .category-title {
    font-size: 15px;
}

.sub-category-list .sidebar-item .sidebar-toggle {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.sidebar-empty {
    padding: 40px 20px;
    text-align: center;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 15px;
    color: #7b3d67;
    background: #faf8f4;
    border-radius: 12px;
    border: 1px dashed #e9d9b5;
}

/* ============================================================
   ARTICLE NAVIGATION - Previous / Next
   ============================================================ */
.article-navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #e9d9b5;
}

.article-navigation .nav-prev,
.article-navigation .nav-next {
    flex: 1;
}

.article-navigation .nav-prev {
    text-align: left;
}

.article-navigation .nav-next {
    text-align: right;
}

.article-navigation a {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 14px;
    color: #5c2c4d;
    text-decoration: none;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #ebe5db;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    gap: 6px;
}

.article-navigation a:hover {
    background: #faf6ef;
    border-color: #c79b43;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 61, 103, 0.08);
    text-decoration: none;
    color: #7b3d67;
}

.article-navigation a:focus-visible {
    outline: 2px solid #c79b43;
    outline-offset: 2px;
}

/* ============================================================
   DARK MODE SUPPORT
   ============================================================ */
@media (prefers-color-scheme: dark) {
    .elemiah-sidebar {
        color: #e0d5c8;
    }

    .sidebar-item {
        background: #2a1f2a;
        border-color: #3d2a3d;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    .sidebar-item:hover {
        border-color: #7b3d67;
        box-shadow: 0 6px 24px rgba(123, 61, 103, 0.15);
    }

    .category-header {
        background: #2a1f2a;
    }

    .category-header:hover {
        background: #3d2a3d;
    }

    .category-title {
        color: #d4b8c8;
    }

    .category-header:hover .category-title {
        color: #e9d9b5;
    }

    .article-count {
        background: #3d2a3d;
        color: #e9d9b5;
    }

    .category-header:hover .article-count {
        background: #7b3d67;
        color: #ffffff;
    }

    .article-link {
        color: #c4b5a8;
    }

    .article-link::before {
        color: #c79b43;
    }

    .article-link:hover {
        background: #3d2a3d;
        color: #e9d9b5;
    }

    .article-item.current-article .article-link {
        background: #3d2a3d;
        color: #e9d9b5;
        border-left-color: #c79b43;
    }

    .article-item.current-article .article-link::before {
        color: #c79b43;
    }

    .sidebar-item.current-category {
        border-color: #c79b43;
        box-shadow: 0 4px 20px rgba(199, 155, 67, 0.08);
    }

    .sidebar-item.current-category .category-header {
        background: #3d2a3d;
        border-left-color: #c79b43;
    }

    .sidebar-item.current-category .category-title {
        color: #e9d9b5;
    }

    .sidebar-item.current-category .sidebar-toggle {
        background: #c79b43;
    }

    .sub-category-list .sidebar-item {
        background: #1f151f;
        border-color: #3d2a3d;
    }

    .sub-category-list .sidebar-item:hover {
        background: #2a1f2a;
        border-color: #7b3d67;
    }

    .sub-category-list .sidebar-item .category-header {
        background: transparent;
    }

    .sidebar-empty {
        background: #2a1f2a;
        color: #d4b8c8;
        border-color: #3d2a3d;
    }

    .article-navigation {
        border-top-color: #3d2a3d;
    }

    .article-navigation a {
        background: #2a1f2a;
        color: #d4b8c8;
        border-color: #3d2a3d;
    }

    .article-navigation a:hover {
        background: #3d2a3d;
        border-color: #c79b43;
        color: #e9d9b5;
    }

    .elemiah-sidebar .sidebar-toggle {
        background: #5c2c4d;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .elemiah-sidebar .sidebar-toggle:hover {
        background: #7b3d67;
    }
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

/* Tablets */
@media (max-width: 992px) {
    .elemiah-sidebar {
        padding: 16px 0;
    }

    .category-title {
        font-size: 15px;
    }

    .sidebar-item.level-1 {
        margin-left: 12px;
    }

    .sidebar-item.level-2 {
        margin-left: 24px;
    }

    .sidebar-item.level-3 {
        margin-left: 36px;
    }

    .sidebar-item.level-4 {
        margin-left: 48px;
    }

    .sidebar-item.level-5 {
        margin-left: 60px;
    }

    .article-link {
        font-size: 13px;
        padding: 7px 10px 7px 28px;
    }

    .article-link::before {
        font-size: 16px;
        left: 8px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .elemiah-sidebar {
        padding: 12px 0;
        font-size: 13px;
    }

    .category-header {
        padding: 10px 12px;
        gap: 8px;
        min-height: 42px;
    }

    .category-title {
        font-size: 14px;
    }

    .elemiah-sidebar .sidebar-toggle {
        width: 24px;
        height: 24px;
    }

    .elemiah-sidebar .sidebar-toggle .toggle-icon {
        font-size: 10px;
    }

    .elemiah-sidebar .sidebar-toggle-placeholder {
        width: 24px;
        height: 24px;
    }

    .sidebar-item.level-1 {
        margin-left: 8px;
    }

    .sidebar-item.level-2 {
        margin-left: 16px;
    }

    .sidebar-item.level-3 {
        margin-left: 24px;
    }

    .sidebar-item.level-4 {
        margin-left: 32px;
    }

    .sidebar-item.level-5 {
        margin-left: 40px;
    }

    .article-count {
        font-size: 11px;
        padding: 1px 10px;
    }

    .article-link {
        font-size: 12px;
        padding: 6px 8px 6px 24px;
    }

    .article-link::before {
        font-size: 14px;
        left: 6px;
    }

    .article-item.current-article .article-link {
        padding-left: 28px;
    }

    .category-content {
        padding: 0 12px;
    }

    .sidebar-item.expanded .category-content {
        padding: 0 12px 10px 12px;
    }

    .article-navigation {
        flex-direction: column;
        gap: 8px;
        margin-top: 16px;
        padding-top: 16px;
    }

    .article-navigation .nav-prev,
    .article-navigation .nav-next {
        text-align: center;
    }

    .article-navigation a {
        padding: 8px 14px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
    }

    .sidebar-empty {
        padding: 30px 16px;
        font-size: 14px;
    }

    .sidebar-item {
        border-radius: 10px;
    }

    .sidebar-item.level-1,
    .sidebar-item.level-2,
    .sidebar-item.level-3,
    .sidebar-item.level-4,
    .sidebar-item.level-5 {
        border-left-width: 1px;
        border-radius: 0 10px 10px 0;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .elemiah-sidebar {
        padding: 8px 0;
    }

    .category-header {
        padding: 8px 10px;
        gap: 6px;
        min-height: 38px;
    }

    .category-title {
        font-size: 13px;
    }

    .sidebar-item.level-1 {
        margin-left: 4px;
    }

    .sidebar-item.level-2 {
        margin-left: 8px;
    }

    .sidebar-item.level-3 {
        margin-left: 12px;
    }

    .sidebar-item.level-4 {
        margin-left: 16px;
    }

    .sidebar-item.level-5 {
        margin-left: 20px;
    }

    .elemiah-sidebar .sidebar-toggle {
        width: 20px;
        height: 20px;
    }

    .elemiah-sidebar .sidebar-toggle .toggle-icon {
        font-size: 9px;
    }

    .elemiah-sidebar .sidebar-toggle-placeholder {
        width: 20px;
        height: 20px;
    }

    .article-link {
        font-size: 11px;
        padding: 5px 6px 5px 20px;
    }

    .article-link::before {
        font-size: 12px;
        left: 4px;
    }

    .article-item.current-article .article-link {
        padding-left: 22px;
    }

    .article-count {
        font-size: 10px;
        padding: 1px 8px;
    }
}

/* ============================================================
   ACCESSIBILITY - Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .sidebar-item,
    .elemiah-sidebar .sidebar-toggle,
    .elemiah-sidebar .sidebar-toggle .toggle-icon,
    .category-content,
    .article-link,
    .article-navigation a {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }

    .category-content {
        max-height: none;
        opacity: 1;
        transform: none;
        padding: 0 16px;
    }

    .sidebar-item:not(.expanded) .category-content {
        max-height: 0;
        opacity: 0;
        padding: 0 16px;
    }

    .article-link:hover {
        transform: none !important;
    }
}

/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-content {
    animation: fadeIn 0.35s ease forwards;
}

.category-header{

padding:14px 18px;

border-radius:12px;

background:white;

margin-bottom:10px;

box-shadow:

0 6px 18px rgba(0,0,0,.05);

transition:.3s;

}

.category-header:hover{

transform:translateX(4px);

box-shadow:

0 12px 30px rgba(0,0,0,.10);

}
.current-category .category-header{

background:#fffaf2;

border-left:5px solid #d4af37;

}


