/* ─── Study Module Switcher (top-right pill) ─────────────────────────── */
#studyModuleSwitcher {
    position: fixed;
    top: 14px;
    right: 20px;
    z-index: 900;
}

#studyModuleSwitcherBtn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 14px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

#studyModuleSwitcherBtn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
}

#studyModuleSwitcherDropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 6px;
    min-width: 140px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.sms-option {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, color 0.12s;
}

.sms-option:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text-primary);
}

.sms-option.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

/* ─── Study Submenu ───────────────────────────────────────────────────── */
.study-submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 4px 7px 6px 7px;
    overflow: hidden;
}

.study-submenu.open {
    display: flex;
}

.study-sub-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px 7px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.study-sub-btn::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: rgba(255,255,255,0.12);
    border-radius: 2px;
}

.study-sub-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.study-sub-btn.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.study-sub-btn.active::before {
    background: rgba(255,255,255,0.5);
}

/* Tool Icon Styles */
.tool-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.tools-section {
    padding: 8px 0 10px;
    border-bottom: none;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tool-btn {
    width: calc(100% - 14px);
    margin: 0 7px;
    padding: 9px 10px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: background-color 0.2s, transform 0.2s;
}

.tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.tool-btn.active {
    background-color: rgba(255, 255, 255, 0.1);
    position: relative;
}

.tool-btn.active::after {
    content: '›';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: rgba(255, 255, 255, 0.85);
}

.tool-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tool-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.05;
}

.tool-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.1;
    opacity: 0.95;
}

.chat-history-section {
    flex: 1;
    overflow-y: auto;
}

/* Footer with Upload, Profile and Settings */
.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.upload-btn {
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: background-color 0.2s;
}

.upload-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.upload-btn .icon {
    width: 20px;
    height: 20px;
}

.footer-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sidebar-footer .profile-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.sidebar-footer .profile-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-footer .profile-btn .profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-hover), var(--border-color));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-footer .profile-btn .profile-avatar svg {
    width: 18px;
    height: 18px;
    color: white;
}

.sidebar-footer .profile-btn .profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-footer .icon-btn {
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.sidebar-footer .icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-footer .icon-btn svg {
    width: 20px;
    height: 20px;
}
