body {
    font-family: Arial, sans-serif;
    background-color: #f7f9fc;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

header {
    width: 100%;
    display: flex;
    background-color: #ff991c;
    margin-bottom: 6px;
    border-radius: 10px;
    min-height: 84px;
    flex: 0 0 auto;
}

.logo-container {
    display: flex;
    width: 100%;
    align-items: center;
    min-height: 84px;
}

.logo {
    border-right: 2px solid white;
    padding: 12px 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.title {
    margin-left: 1%;
    color: white;
    font-size: 21px;
    font-family: "Times New Roman", Times, serif;
    line-height: 1.2;
    padding: 10px 0;
}

.main-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.sub-header {
    width: 100%;
    padding-bottom: 6px;
    box-sizing: border-box;
    margin-bottom: 6px;
    flex: 0 0 auto;
}

.sub-header-inner {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.back-button-link {
    display: inline-block;
    background-color: #f0f0f0;
    color: #333;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.back-button-link:hover {
    background-color: #e0e0e0;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    background: #fff4e2;
    color: #7c4a07;
    border: 1px solid #f3d2a6;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
}

.container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    height: 100%;
    transition: all 0.3s ease-in-out;
}

.chat-box {
    background-color: #f5f5f5;
    width: 100%;
    padding: 14px;
    transition: width 0.3s ease-in-out;
    overflow-y: auto;
    height: 100%;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.toolbar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.course-switcher {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.course-menu-button {
    border: 1px solid #d6c3a3;
    background: #fffaf2;
    color: #5f4b32;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    max-width: 100%;
}

.course-menu-button:hover {
    background: #fff4e2;
}

.course-menu-caret {
    font-size: 11px;
    line-height: 1;
}

.course-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 5;
    min-width: min(420px, 72vw);
    max-width: 100%;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.course-menu-item {
    border: none;
    background: transparent;
    color: #374151;
    text-align: left;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    cursor: pointer;
}

.course-menu-item:hover {
    background: #f3f4f6;
}

.course-menu-item.active {
    background: #ff991c;
    color: #ffffff;
}

.reset-button {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.chat-box.pdf-open {
    width: 59%;
    align-items: flex-start;
}

.chat-container {
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 10px;
}

.message {
    padding: 4px 8px;
    border-radius: 15px;
    max-width: 48%;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.message-content-wrap {
    width: 100%;
}

.message-text {
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid #000;
    background-color: #ffffff;
    box-shadow: 5px 8px 20px rgba(0, 0, 0, 0.12);
    margin: 0;
    line-height: 1.5;
}

.typing-indicator {
    color: #6b7280;
    font-style: italic;
}

.avatar {
    width: 28px;
    height: 28px;
    margin-top: 6px;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-message .message-text {
    background-color: #fff7ec;
}

.input-container {
    width: min(900px, 100%);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.input-container input {
    flex: 1;
    padding: 13px 16px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    font-size: 16px;
    outline: none;
}

.send-button {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: #ff991c;
    color: white;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(255, 153, 28, 0.35);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.pdf-box {
    background-color: white;
    width: 0%;
    transition: width 0.3s ease-in-out;
    overflow: hidden;
    height: 100%;
    border-radius: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.expanded {
    width: 40% !important;
}

.hidden {
    display: none !important;
}

.close-pdf {
    position: absolute;
    top: 8px;
    right: 10px;
    background: red;
    color: white;
    border: none;
    font-size: 18px;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 5px;
    z-index: 1;
}

a {
    color: #0b5cab;
}

@media (max-width: 900px) {
    body {
        padding: 8px;
    }

    .logo {
        padding: 6px 8px;
    }

    .title {
        font-size: 16px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .course-switcher {
        width: 100%;
    }

    .course-menu {
        width: 100%;
        min-width: 0;
    }

    .container {
        height: 100%;
    }

    .chat-box,
    .chat-box.pdf-open {
        width: 100%;
    }

    .pdf-box {
        display: none;
    }

    .message {
        max-width: 90%;
    }
}
