@media (max-width: 700px) {
    /* Chat history chỉ trượt vào - ra */
    .chat-history-list {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100%;
        background-color: #f6f6f6;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
        z-index: 10001;
        transition: left 0.3s ease-in-out;
        padding: 10px;
    }

    .chat-history-list.show {
        left: 0;
    }

    /* Ẩn thanh cuộn ngang khi lịch sử được mở */
    body.history-open {
        overflow-x: hidden;
    }
}

.active-chat {
    background-color: #e6f7ff !important;
    border-left: 4px solid #1890ff;
    font-weight: bold;
}

.disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* Khung hỏi AI */
.ai-chat-container {
    position: fixed;
    bottom: 20px;
    right: 100px;
    width: 600px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 9998;
    overflow: hidden;
    display: none;
    flex-direction: row;
    font-family: sans-serif;
}

.ai-sidebar {
    width: 30%;
    background-color: #f6f6f6;
    border-right: 1px solid #ddd;
    padding: 10px;
    flex-shrink: 0;
    min-width: 200px;

    display: flex;
    flex-direction: column;
    height: 100vh;
    /* Chiếm toàn chiều cao màn hình */
    box-sizing: border-box;
}

.chat-history-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

@media (max-width: 700px) {
    .chat-history-header {
        margin: auto;
    }

    .ai-sidebar {
        height: 160px !important;
    }

    #toggleHistoryBtn {
        display: block !important;
    }
}

.new-chat-btn {
    padding: 6px 10px;
    font-size: 13px;
    border: none;
    background-color: #4f46e5;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.new-chat-btn:hover {
    background-color: #3730a3;
}

#toggleHistoryBtn {
    padding: 6px 10px;
    font-size: 13px;
    border: none;
    background-color: #4f46e5;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: none;
}

.chat-history-title {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 16px;
}

.chat-history {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.chat-history-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    background-color: #ffffff;
    text-align: left;
    margin-top: 5px;
}

.chat-history-list li:hover {
    background-color: #f9f9f9;
}

.delete-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
}

.delete-btn:hover {
    color: red;
}

.chat-history li {
    padding: 8px 6px;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #fff;
    cursor: pointer;
    border: 1px solid #ddd;
    font-size: 14px;
}

.chat-history li:hover {
    background-color: #e6f0ff;
}

.ai-chat-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.welcome-message {
    color: #555;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

.chat-messages {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
    font-size: 14px;
    text-align: left;
}

.chat-messages div {
    margin-top: 5px;
}

.ai-answer-message p {
    padding: 2px 4px;
}

.ai-answer-message hr {
    margin-top: 4px;
    margin-bottom: 4px;
}

.ai-loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
    background-color: #fff;
}

#chatInput {
    flex: 1;
    resize: none;
    /* Không cho phép kéo */
    overflow-y: auto;
    /* Ẩn thanh cuộn */
    padding: 10px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    min-height: 40px;
    max-height: 200px;
    line-height: 1.5;
    transition: all 0.2s ease;
}

#sendBtn {
    padding: 10px 16px;
    background-color: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

#sendBtn:hover {
    background-color: #4338ca;
}

/* Responsive */
@media (max-width: 700px) {
    .ai-chat-container {
        width: 95%;
        height: 85vh;
        right: 10px;
        bottom: 90px;
        flex-direction: column;
    }

    .ai-chat-content {
        height:10px;
    }

    .ai-sidebar {
        width: 100%;
        height: 120px;
        border-right: none;
        border-bottom: 1px solid #ddd;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
    }

    .chat-history {
        display: flex;
        flex-direction: row;
        gap: 6px;
    }

    .chat-history li {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .ai-chat-content {
        flex-grow: 1;
    }
}

@media (max-width: 700px) {
    .ai-chat-container input,
    .ai-chat-container textarea,
    .ai-chat-container button {
        font-size: 16px !important;
    }
}

/* iframe hiển thị khi bấm vào từ điển */
.dictionary-frame {
    position: fixed;
    bottom: 20px;
    right: 100px;
    width: 320px;
    height: 480px;
    border: 1px solid #ccc;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 9998;
    background-color: white;
}

.dictionary-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.close-ai-chat-btn {
    position: absolute; /* Định vị tuyệt đối so với .chat-history-header */
    top: 15px;
    right: 10px;
    font-size: 24px; /* Tăng kích thước cho dễ nhìn */
    color: #aaa; /* Màu xám nhạt */
    border: none;
    background: none;
    cursor: pointer;
    outline: none;
    padding: 0;
    line-height: 1;
    z-index: 1; /* Đảm bảo hiển thị trên các phần tử khác */
}

.close-ai-chat-btn svg {
    width: 20px; /* Điều chỉnh chiều rộng */
    height: 20px; /* Điều chỉnh chiều cao */
    vertical-align: middle; /* Căn giữa theo chiều dọc với văn bản (nếu có) */
}

/* Container sidebar */
.floating-sidebar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 9999;
    transition: all 0.3s ease-in-out;
    max-height: 80vh;
    min-width: 80px;
}

/* Toggle button */
.sidebar-toggle-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: #e0e0e0;
    color: #333;
    transform: scale(1.05);
}

.toggle-icon {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toggle-icon-pin {
    display: block;
}

.toggle-icon-unpin {
    display: none;
}

/* Sidebar content wrapper */
.sidebar-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    transition: opacity 0.3s ease, max-height 0.3s ease;
    overflow: hidden;
}

/* Collapsed state */
.floating-sidebar.collapsed {
    padding: 8px;
    min-width: 52px;
}

.floating-sidebar.collapsed .sidebar-content {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
}

.floating-sidebar.collapsed .sidebar-toggle-btn {
    margin-bottom: 0;
}

.floating-sidebar.collapsed .toggle-icon-pin {
    display: none;
}

.floating-sidebar.collapsed .toggle-icon-unpin {
    display: block;
}

.floating-sidebar:not(.collapsed) .toggle-icon-pin {
    display: block;
}

.floating-sidebar:not(.collapsed) .toggle-icon-unpin {
    display: none;
}

/* Sidebar slider container */
.sidebar-slider {
    flex: 1;
    width: 100%;
    overflow: hidden;
}

.sidebar-slider .slick-list {
    overflow: visible;
    padding: 0 !important;
    margin: 0 !important;
}

.sidebar-slider .slick-track {
    display: flex;
    flex-direction: column;
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar-slider .slick-slide {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
}

.sidebar-slider .slick-slide > div {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

/* Navigation buttons */
.sidebar-nav-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: #666;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-shrink: 0;
}

.sidebar-nav-btn:hover {
    color: #333;
}

.sidebar-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sidebar-nav-prev {
    margin-bottom: 4px;
}

.sidebar-nav-next {
    margin-top: 4px;
}

/* Mỗi icon */
.sidebar-icon {
    margin: 8px 0;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.sidebar-icon img {
    width: 32px;
    height: 32px;
    margin: auto;
}

.sidebar-icon:hover {
    transform: scale(1.1);
}

/* Icon văn bản */
.sidebar-label {
    font-size: 14px;
    color: #333;
    margin-top: 4px;
    font-weight: 500;
    white-space: nowrap; /* Ngăn văn bản xuống dòng */
}

/* Đường kẻ ngang */
.divider {
    width: 60%;
    height: 1px;
    background: #ddd;
    margin: 6px 0;
}

/* Responsive cho mobile */
@media (max-width: 600px) {
    .dictionary-frame {
        right: 10px;
        bottom: 80px;
        width: 90%;
        height: 70vh;
    }

    .floating-sidebar {
        bottom: 0 !important; /* Cố định ở dưới cùng */
        left: 0; /* Kéo sát về bên trái */
        right: auto; /* Loại bỏ thuộc tính right */
        width: 100%; /* Chiếm toàn bộ chiều ngang */
        background: white;
        border-radius: 0; /* Loại bỏ bo tròn */
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1); /* Tạo bóng ở phía trên */
        padding: 6px 2px; /* Giảm padding tối thiểu */
        flex-direction: row; /* Hiển thị các icon theo hàng ngang */
        justify-content: center; /* Căn giữa các icon */
        align-items: center; /* Căn giữa các icon theo chiều dọc */
        max-height: none;
        min-width: auto;
    }

    /* Ẩn nút toggle trên mobile */
    .floating-sidebar .sidebar-toggle-btn {
        display: none !important;
    }

    .floating-sidebar.collapsed {
        min-width: auto;
        width: auto;
        padding: 8px;
        right: 10px;
        left: auto;
        bottom: 10px;
        border-radius: 12px;
        flex-direction: column;
    }

    .floating-sidebar .sidebar-toggle-btn {
        margin-bottom: 0;
        margin-right: 0;
    }

    .floating-sidebar:not(.collapsed) .sidebar-content {
        flex-direction: row;
        align-items: center;
        width: 100%;
    }

    /* Ẩn nút prev/next trên mobile vì có thể swipe */
    .floating-sidebar .sidebar-nav-btn {
        display: none !important;
    }

    .sidebar-slider {
        flex-direction: row;
        width: 100%;
        flex: 1;
        order: 0; /* Đặt slider ở giữa */
        display: flex;
        align-items: center;
    }

    .sidebar-slider .slick-track {
        flex-direction: row !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .sidebar-slider .slick-list {
        width: 100%;
        overflow: hidden;
        display: flex !important;
        align-items: center !important;
    }

    .sidebar-slider .slick-slide {
        margin: 0 !important;
        padding: 0 1px !important;
        display: flex !important;
        flex-direction: column;
        align-items: center !important;
        justify-content: center !important;
        width: calc(25% - 2px) !important;
        min-width: 0;
        height: auto !important;
    }

    .sidebar-slider .slick-slide > div {
        width: 100%;
        display: flex !important;
        flex-direction: column;
        align-items: center !important;
        justify-content: center !important;
    }

    .sidebar-slider .slick-slide .sidebar-slide {
        display: flex !important;
        flex-direction: column;
        align-items: center !important;
        justify-content: center !important;
        width: 100%;
    }

    .sidebar-icon {
        margin: 0 !important; /* Loại bỏ margin dọc */
        padding: 2px 4px !important; /* Giảm padding tối thiểu */
        min-width: 0;
        flex: 0 0 auto;
    }

    .sidebar-icon img {
        width: 24px; /* Giảm kích thước icon */
        height: 24px;
        margin-bottom: 1px; /* Giảm margin dưới ảnh */
        display: block;
    }

    .sidebar-label {
        font-size: 10px; /* Giảm kích thước chữ */
        margin-top: 1px; /* Giảm margin trên chữ */
        line-height: 1.1;
    }

    .sidebar-slide {
        margin: 0 !important;
        padding: 0 !important;
        width: auto !important;
        flex: 0 0 auto;
    }

    .divider {
        display: none; /* Ẩn đường kẻ ngang */
    }
}

.fc-daygrid-day {
    /* height: 100px; */
    /* width: 100px; */
    /* Tăng chiều cao của ô ngày */
}

.fc-v-event {
    background: unset !important;
    border: unset !important;
}

.fc-daygrid-event {
    font-size: 12px;
    /* Điều chỉnh kích thước chữ của sự kiện */
}

#calendar {
    max-width: 100%;
}

#checkin-calendar {
    width: 100%;
    /* Đảm bảo chiều rộng container chiếm 100% */
    height: 400px;
    /* Đặt chiều cao ban đầu */
    max-height: 80vh;
    /* Đảm bảo chiều cao của calendar không vượt quá 80% chiều cao của màn hình */
    max-width: 600px;
    /* Giới hạn chiều rộng tối đa của lịch */
    margin: 0 auto;
    /* Căn giữa lịch nếu cần */
}

#checkin-calendar {
    width: 100%;
    max-width: 500px;
    height: 400px;
}

@media (max-width: 768px) {
    .calendar-container {
        right: -65px;
    }

    #checkin-calendar {
        height: 300px;
        max-width: 350px;
    }

    #notification-container {
        right: -168px;
    }
}

/* .fc-scroller .fc-col-header {
    width: 498px !important;
} */

.fc-view-harness-active {
    height: 400px !important;
}

#home-promo .slick-slide {
    display: flex;
    justify-content: center;
    align-items: center;
}

#home-promo .slick-dots li button:before {
    font-size: 12px;
    /* Tùy chỉnh kích thước dot */
    color: #333;
    /* Màu dot */
}

/* Đảm bảo ảnh trong slider luôn hiển thị phù hợp */
#home-promo img {
    width: 100%;
    /* Hình ảnh tự động co giãn theo chiều ngang */
    height: auto;
    /* Đảm bảo tỷ lệ hình ảnh */
    max-width: 100%;
    /* Không vượt quá khung chứa */
}

/* Tinh chỉnh Slick cho mobile */
@media (max-width: 768px) {
    .slick-slide {
        padding: 0 10px;
        /* Tạo khoảng cách giữa các slide */
    }

    .slick-dots {
        bottom: 10px;
        /* Tùy chỉnh khoảng cách nút điều hướng */
    }

    .slick-dots li button:before {
        font-size: 10px;
        /* Nhỏ hơn cho phù hợp mobile */
        color: #999;
    }

    #home-promo {
        max-width: 20rem !important;
    }
}
