@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ---------- RESET ---------- */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    text-decoration: none;
    list-style: none;
}

:root {
    --color_Blue: #3f93f1;
    --color_Dark1: #1e1e1e;
    --color_Dark2: #252527;
    --color_Light1: #dfdfdf;
    --color_Light2: #c4c4c4;
    --sidebar_width: 360px;
    --sidebar_width_closed: 60px;
}

body {
    font-family: 'Poppins', sans-serif;
}

/* ---------- SIDEBAR BASE ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--sidebar_width);
    background-color: var(--color_Dark1);
    transition: all .5s ease;
    z-index: 100;
    color: white;
}

.sidebar.close {
    width: var(--sidebar_width_closed);
}

/* ---------- LOGO & HEADER ---------- */
.logo-box {
    height: 60px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color_Light1);
    background-color: #5b6677;
    transition: all .5s ease;
    cursor: pointer;
}

.logo-box i {
    font-size: 30px;
    min-width: var(--sidebar_width_closed);
    text-align: center;
    line-height: 60px;
}

.logo-name {
    font-size: 20px;
    font-weight: 600;
    white-space: nowrap;
}

/* Topic header with arrows */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--color_Dark1);
    height: 60px;
}

.main-header span {
    font-size: 18px;
    color: #d1d173;
    font-weight: 600;
    text-align: center;
    flex: 1;
    line-height: 1.2;
    padding: 0 5px;
}

.topic-arrow {
    cursor: pointer;
    font-size: 36px;
    color: #ffffff;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 100%;
}

.topic-arrow:hover {
    color: var(--color_Blue);
    transform: scale(1.1);
}

.topic-arrow.hidden {
    visibility: hidden;
    pointer-events: none;
}

/* Hide header when sidebar is closed */
.sidebar.close .main-header {
    display: none;
}

/* ---------- SIDEBAR LIST ---------- */
.sidebar-list {
    height: calc(100% - 120px); /* 60px logo + 60px header */
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-list::-webkit-scrollbar {
    width: 5px;
}
.sidebar-list::-webkit-scrollbar-thumb {
    background: gray;
    border-radius: 10px;
}

/* ---------- SUBTOPIC GROUPS ---------- */
.subtopic-group {
    margin-bottom: 5px;
}

/* Title bar (click area for accordion) */
.title2 {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 0;
    cursor: pointer;
    background-color: transparent;
    color: var(--color_Light2);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.title2:hover {
    background-color: var(--color_Dark2);
}

/* Icons (link / glasses) share same space */
.title2 .icon-inactive,
.title2 .icon-active {
    min-width: var(--sidebar_width_closed);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Default: show link icon, hide glasses */
.title2 .icon-inactive {
    color: var(--color_Light1);
}
.title2 .icon-active {
    display: none;
}

/* Name text in the middle */
.title2 .name {
    flex: 1;
    text-align: left;
    font-size: 14px;
    color: var(--color_Light2);
    padding-right: 10px;
    line-height: 1.4;
}

/* Chevron on the right */
.title2 .bx-chevron-down {
    min-width: 40px;
    text-align: center;
    transition: transform 0.3s ease;
    color: var(--color_Light2);
}

/* ---------- ACCORDION (OPEN/CLOSE) ---------- */
.levels-list {
    display: none; /* hidden by default */
    background-color: var(--color_Dark2);
    padding: 10px 0;
}

.subtopic-group.open .levels-list {
    display: block;
}

.subtopic-group.open .title2 .bx-chevron-down {
    transform: rotate(180deg);
}

/* ---------- SELECTED STATE (math-selected topic) ---------- */
.subtopic-group.selected {
    border-left: 4px solid var(--color_Blue);
}

.subtopic-group.selected .title2 {
    background-color: #00008B;
    color: #ffffff;
}

.subtopic-group.selected .title2 .name {
    color: #ffffff;
}

/* Icon swap when selected */
.subtopic-group.selected .title2 .icon-inactive {
    display: none;
}
.subtopic-group.selected .title2 .icon-active {
    display: flex;
    color: #ffffff;
}

/* Keep hover from fighting the selected background */
.subtopic-group.selected .title2:hover {
    background-color: #00008B;
}

/* ---------- LEVEL BUTTONS ---------- */
.topics {
    display: flex;
    justify-content: center;
    margin: 5px 20px;
}

.topics input {
    display: none;
}

.topics label {
    width: 40%;
    padding: 8px 0;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background-color: var(--color_Dark1);
    color: var(--color_Light2);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.topics label:hover {
    border-color: var(--color_Blue);
    color: #fff;
}

.topics input:checked + label {
    background-color: #00008B; /* Dark Blue */
    color: #fff;
    border-color: var(--color_Blue);
    border-radius: 0 24px 0 24px;
}

/* ---------- SIDEBAR CLOSED STATES ---------- */
/* Hide text + levels when collapsed */
.sidebar.close .logo-name,
.sidebar.close .main-header,
.sidebar.close .title2 .name,
.sidebar.close .title2 .bx-chevron-down,
.sidebar.close .levels-list {
    display: none;
}

/* Icons remain visible in closed state */
.sidebar.close .title2 .icon-inactive,
.sidebar.close .title2 .icon-active {
    min-width: var(--sidebar_width_closed);
}
