/* ===== RESPONSIVE CHO MOBILE ===== */
@media screen and (max-width: 767px) {

    body {
        height: 100vh;
        /* Giữ chiều cao full viewport */
        overflow-y: auto;
        /* Cho phép body scroll */

    }

    /* Header layout cho mobile */
    .header {
        padding: 2px 8px;
        flex-wrap: wrap;
        gap: 2px;
    }

    /* Dòng đầu: Back button + Title + Info button */
    .btn-back,
    .btn-info {
        padding: 5px 5px;
        font-size: 13px;
        border-radius: 20px;
    }

    .book-title {
        font-size: 1.2rem;
        margin: 0 10px;
    }

    /* Search container chiếm toàn bộ chiều rộng dòng thứ 2 */
    .search-container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        /* Thuộc tính order: 3; được sử dụng để định vị phần tử .search-container tại vị trí thứ ba (hoặc vị trí tương đối lớn) trong chuỗi các Flex Item, không phụ thuộc vào vị trí của nó trong mã nguồn HTML. */
        order: 3;
        flex-basis: 100%;
    }

    .search-input-wrapper {
        width: 100%;
    }

    .search-input {
        font-size: 14px;
        padding: 10px;
        border-radius: 20px;
        width: 100%;
    }

    /* Không mở rộng input khi focus trên mobile */
    .search-input:focus {
        width: 100%;
    }

    /* Icon và button trong search input */
    .search-icon,
    .clear-search-btn {
        font-size: 14px;
    }

    .clear-search-btn {
        width: 26px;
        height: 26px;
    }

    /* Dropdown kết quả - tối ưu cho mobile */
    .search-results {
        max-height: 60vh;
        border-radius: 8px;
        margin-top: 8px;
    }

    .search-results-header {
        padding: 10px 12px;
        font-size: 12px;
        position: sticky;
        top: 0;
        z-index: 1;
        background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    }

    .search-results-list {
        max-height: calc(60vh - 50px);
    }

    /* Items trong dropdown */
    .search-result-item {
        padding: 12px;
        gap: 6px;
    }

    .search-result-item:hover {
        border-left: 3px solid #03ee6d;
    }

    .search-result-page {
        font-size: 11px;
    }

    .search-result-content {
        font-size: 13px;
        line-height: 1.5;
        overflow: hidden;
    }

    /* Highlight */
    .search-highlight {
        padding: 1px 3px;
        font-size: 13px;
    }

    .no-results {
        padding: 20px 15px;
        font-size: 13px;
    }

    /* Scrollbar cho mobile */
    .search-results-list::-webkit-scrollbar {
        width: 4px;
    }

    .search-results-list::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .search-results-list::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }


    /* start footer */

    .footer {
        padding: 8px 10px !important;
        /* height: 50px !important; */
        gap: 4px !important;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start !important;
        /* Căn trái để dễ scroll */
        -webkit-overflow-scrolling: touch;
        /* Đảm bảo footer luôn hiển thị */
        display: flex !important;
        position: sticky;
        /* ✅ Thay thế position: fixed */

        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        flex-wrap: nowrap;
        /* <-- Cần thiết để buttons không xuống dòng */
    }

    /* Ẩn scrollbar nhưng vẫn cho phép scroll */
    .footer::-webkit-scrollbar {
        height: 0;
        width: 0;
    }

    /* Các button trong footer */
    .footer button {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        flex-shrink: 0;
        /* Không cho button bị thu nhỏ */
        min-width: 32px;
        /* Đảm bảo kích thước tối thiểu */
    }

    .footer button i {
        font-size: 14px !important;
    }

    /* end footer */


    /* ===== START TRANG BÌA ===== */
    .cover-content {
        padding: 20px;
    }

    .cover-title {
        font-size: 2rem;
        letter-spacing: 4px;
        gap: 8px;
    }

    .cover-subtitle {
        font-size: 1.5rem;
        letter-spacing: 3px;
        gap: 8px;
    }

    .cover-decoration i {
        font-size: 3rem;
    }


    /* ===== END TRANG BÌA ===== */

    /* START SOUND CONTROL PANEL */
    .sound-control-panel {
        right: 10px;
        bottom: 70px;
        min-width: 260px;
    }

    .sound-control-header h3 {
        font-size: 14px;
    }

    .sound-label {
        font-size: 13px;
    }

    /* ENDF SOUND CONTROL PANEL */

    /* START USER INFO */

    .user-info {
        padding: 2px 4px;
    }

    .user-info span {
        display: none;
    }

    /* END USER INFO */

    /* START ALBUM ẢNH */
    .album-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .album-header h2 {
        font-size: 18px;
    }

    .album-body {
        padding: 20px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    /* END ALBUM ẢNH */

    /* START QUIZ */
    .quiz-container {
        width: 95%;
        max-height: 90vh;
    }

    .quiz-header h2 {
        font-size: 18px;
    }

    .quiz-question-title {
        font-size: 16px;
    }

    .quiz-answer-text {
        font-size: 14px;
    }

    .quiz-actions {
        flex-direction: column;
    }

    .btn-quiz-submit {
        margin-left: 0;
    }

    /* END QUIZ */

}