﻿/* =========================================================
   2. CSS CHUNG LAYOUT
   ========================================================= */
body {
    background: var(--mau-nen, #f4f6f9) !important;
    color: #333;
    padding-top: 50px;
}

/* Header & Navbar */
.main-nav,
.navbar,
header,
.custom-navbar,
.header {
    background: var(--mau-menu) !important;
    border-bottom: none !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.logo-img {
    height: 45px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    transition: transform 0.3s;
}

.navbar-brand:hover .logo-img {
    transform: scale(1.05);
}

/* Menu Links Desktop */
.nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    margin: 0 5px;
    transition: all 0.3s;
}

    .nav-link:hover,
    .nav-link.active {
        color: #fff !important;
        font-weight: 700;
        text-shadow: 0 0 10px rgba(255,255,255,0.3);
    }

.navbar-toggler span {
    color: #fff !important;
}

/* Màu chủ đạo */
.text-primary,
a:hover,
.btn-link,
.contact-icon,
h1, h2, h3, h4, h5, h6 {
    color: var(--mau-chu-dao) !important;
}

a {
    color: var(--mau-chu-dao);
    text-decoration: none;
    transition: 0.2s;
}

    a:hover {
        color: var(--mau-menu-solid) !important;
    }

/* =========================================================
   3. BUTTONS
   ========================================================= */
.btn-primary,
.btn-login,
.btn-course,
.btn:not(.navbar-toggler),
.category,
button[type="submit"]:not(.search-btn) {
    background: var(--mau-menu) !important;
    border: none !important;
    color: #fff !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

    .btn-primary:hover,
    .btn-login:hover,
    .btn-course:hover,
    .btn:not(.navbar-toggler):hover,
    button[type="submit"]:not(.search-btn):hover {
        opacity: 1 !important;
        transform: translateY(-3px);
        color: #ffffff !important;
        text-shadow: 0 0 5px #ffffff, 0 0 10px #ffffff;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    }

/* Nút Đăng ký / Đăng nhập */
.btn-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 15px;
}

/* Responsive cho nút auth đã được cập nhật ở mục 8 */

.btn-signup {
    background-color: #fff !important;
    color: var(--mau-chu-dao) !important;
    border: 2px solid var(--mau-chu-dao) !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

    .btn-signup:hover {
        background: var(--mau-menu) !important;
        color: #fff !important;
        border-color: transparent !important;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }

.btn-signin {
    background: var(--mau-menu) !important;
    color: #fff !important;
    border: 2px solid transparent !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

    .btn-signin:hover {
        opacity: 0.95;
        transform: translateY(-2px);
        box-shadow: 0 0 15px rgba(255,255,255,0.5);
        color: #fff !important;
    }

/* =========================================================
   4. BOX THÔNG TIN
   ========================================================= */
.welcome-banner,
.info-box,
.card-primary {
    background: var(--mau-menu) !important;
    color: #fff !important;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

    .welcome-banner h1,
    .welcome-banner h2,
    .welcome-banner h3,
    .welcome-banner p {
        color: #fff !important;
    }

    .welcome-banner .btn {
        background: #fff !important;
        color: var(--mau-chu-dao) !important;
        border: none !important;
        font-weight: 700;
        transition: all 0.3s;
    }

        .welcome-banner .btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.2);
            color: var(--mau-chu-dao) !important;
        }

/* =========================================================
   5. SEARCH BOX - GIỐNG ẢNH MẪU
   ========================================================= */

/* Container chính */
.search-wrapper {
    max-width: 600px;
    margin: 20px auto;
    position: relative;
}

/* Container cho search có filter */
.search-wrapper-with-filter {
    max-width: 800px;
    margin: 20px auto;
    position: relative;
    padding: 0 15px;
}

/* Search group - Bo tròn hoàn toàn */
.search-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    padding: 4px 4px 4px 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s;
    gap: 10px;
}

/* Search group với filter dropdown */
.search-group-with-filter {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    padding: 4px 4px 4px 4px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s;
    gap: 10px;
    overflow: hidden;
}

    .search-group:hover,
    .search-group:focus-within,
    .search-group-with-filter:hover,
    .search-group-with-filter:focus-within {
        box-shadow: 0 4px 16px rgba(0,0,0,0.12);
        border-color: #c0c0c0;
    }

/* Input - Không border, trong suốt */
.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 0;
    font-size: 15px;
    background: transparent;
    color: #333;
}

    .search-input::placeholder {
        color: #999;
        font-size: 14px;
    }

/* Filter Select Dropdown */
.filter-select {
    border: none;
    border-right: 1px solid #e0e0e0;
    outline: none;
    padding: 12px 15px 12px 20px;
    font-size: 14px;
    background: #fff;
    color: #0891b2;
    font-weight: 500;
    cursor: pointer;
    min-width: 140px;
    flex-shrink: 0;
    border-radius: 0;
}

    .filter-select:hover {
        background: #f8f9fa;
    }

    .filter-select:focus {
        background: #f0f9ff;
    }

/* Search group với filter - input cần padding bên trái */
.search-group-with-filter .search-input {
    padding: 12px 10px;
}

/* Nút search - Tròn xanh bên phải */
.search-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #42a5f5 !important;
    border: none !important;
    color: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(66, 165, 245, 0.3) !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 45px !important;
    max-width: 45px !important;
    flex-shrink: 0;
}

    .search-btn:hover {
        background: #2196f3 !important;
        box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4) !important;
        transform: scale(1.05) !important;
        text-shadow: none !important;
    }

    .search-btn i {
        font-size: 18px;
        line-height: 1;
        margin: 0;
        padding: 0;
    }

/* Suggestions box */
.suggestions-box {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

/* Search result count */
.search-result-count {
    text-align: center;
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

    .search-result-count b {
        color: #0891b2;
        font-weight: 700;
    }

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
    text-decoration: none;
    color: #333;
}

    .suggestion-item:hover,
    .suggestion-item.active {
        background: #f5f5f5;
        color: #333;
    }

    .suggestion-item i {
        color: #999;
        font-size: 14px;
        width: 20px;
        text-align: center;
    }

    .suggestion-item .suggestion-text {
        flex: 1;
        color: #333;
        font-size: 14px;
    }

    .suggestion-item .highlight {
        font-weight: 700;
        color: #42a5f5;
    }

/* =========================================================
   6. FOOTER
   ========================================================= */
.footer,
.footer-section,
footer,
.site-footer {
    background: var(--mau-menu) !important;
    color: #fff !important;
    padding-top: 80px;
    margin-top: 60px;
}

    .footer p,
    .footer span,
    .footer a,
    .footer-title,
    .footer-section p,
    .footer-section span,
    .footer-section a,
    .footer-section h3,
    .footer-section h4,
    .footer-section h5 {
        color: rgba(255,255,255,0.9) !important;
    }

        .footer-title::after {
            background: #fff !important;
        }

        .footer a:hover,
        .footer-section a:hover {
            color: #ffffff !important;
            padding-left: 8px;
            text-shadow: 0 0 10px #ffffff, 0 0 20px #ffffff;
        }

.copyright-area,
.copyright,
.footer-bottom {
    background: rgba(0,0,0,0.2) !important;
    border-top: 1px solid rgba(255,255,255,0.1) !important;
    color: rgba(255,255,255,0.9) !important;
}

/* =========================================================
   7. NÚT MẠNG XÃ HỘI NỔI
   ========================================================= */
.social-fixed-box {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 18px;
    align-items: center;
}

.social-btn-float {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 8px 24px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 26px;
    border: none;
}

    .social-btn-float.zalo {
        background: linear-gradient(135deg, #0068ff, #0042a5);
    }

        .social-btn-float.zalo span {
            font-weight: 800;
            font-size: 16px;
        }

    .social-btn-float.facebook {
        background: linear-gradient(135deg, #1877f2, #0f56b3);
    }

    .social-btn-float:hover {
        transform: translateY(-8px) scale(1.1);
        box-shadow: 0 15px 35px rgba(0,0,0,0.2);
        filter: brightness(1.1);
    }

/* =========================================================
   8. RESPONSIVE MOBILE
   ========================================================= */
@media (max-width: 991px) {
    /* ===== OFFCANVAS MENU MOBILE ===== */
    .offcanvas,
    .offcanvas-start,
    .offcanvas-end {
        background: #fff !important;
        color: #333 !important;
    }

    .offcanvas-header {
        background: #fff !important;
        border-bottom: 1px solid #f0f0f0 !important;
        padding: 20px;
    }

    .offcanvas-title {
        color: var(--mau-chu-dao) !important;
        font-weight: 700;
        font-size: 18px;
    }

    .btn-close {
        color: #333 !important;
        opacity: 1 !important;
    }

    .offcanvas-body {
        padding: 20px;
        background: #fff !important;
    }

        /* ===== MENU LINKS TRONG OFFCANVAS ===== */
        .offcanvas .nav-link,
        .offcanvas-body .nav-link,
        .navbar-nav .nav-link {
            color: #333 !important;
            background: transparent !important;
            padding: 12px 15px !important;
            border-radius: 8px;
            margin: 5px 0;
            font-weight: 500;
            display: block !important;
            width: 100% !important;
        }

            .offcanvas .nav-link:hover,
            .offcanvas-body .nav-link:hover {
                color: var(--mau-chu-dao) !important;
                background-color: #f9fbfd !important;
                text-shadow: none !important;
            }

            .offcanvas .nav-link.active {
                color: #fff !important;
                background: var(--mau-menu) !important;
            }

    /* ===== NÚT ĐĂNG KÝ/ĐĂNG NHẬP TRONG MENU MOBILE (ĐÃ SỬA NHỎ LẠI) ===== */
    .btn-auth {
        padding: 6px 15px !important;
        font-size: 12px !important;
        width: 100% !important;
        margin-bottom: 5px;
        min-height: 32px;
    }

        .btn-auth i {
            font-size: 11px !important;
        }

    /* ===== NAVBAR TOGGLER ===== */
    .navbar-toggler {
        border-color: rgba(255,255,255,0.5) !important;
        padding: 8px 12px;
    }

    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
    }

    /* Logo mobile */
    .logo-img {
        height: 38px;
    }

    /* Ẩn menu desktop */
    .navbar-collapse:not(.offcanvas) {
        display: none !important;
    }
}

/* =========================================================
   9. GRID MOBILE 2 CỘT
   ========================================================= */
@media (max-width: 768px) {
    .course-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Welcome banner nhỏ hơn trên mobile */
    .welcome-banner {
        padding: 20px 15px !important;
        margin-bottom: 20px !important;
        border-radius: 12px !important;
    }

        .welcome-banner h1 {
            font-size: 18px !important;
            margin-bottom: 8px !important;
        }

        .welcome-banner p {
            font-size: 13px !important;
            margin-bottom: 0 !important;
        }

    .course-card {
        margin-bottom: 0;
        height: 100%;
    }

        .course-card img {
            height: 120px !important;
        }

        .course-card h3 {
            font-size: 13px !important;
            height: 36px;
        }

        .course-card .category {
            font-size: 10px !important;
            padding: 2px 6px !important;
        }

        .course-card .author {
            font-size: 11px !important;
        }

    .btn-course {
        font-size: 12px !important;
        padding: 5px 10px !important;
    }

    /* Nút social mobile */
    .social-fixed-box {
        bottom: 15px;
        right: 15px;
        gap: 12px;
    }

    .social-btn-float {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
}

/* =========================================================
   10. MOBILE NHỎ (ĐÃ SỬA SEARCH BOX NHỎ LẠI)
   ========================================================= */
@media (max-width: 576px) {
    /* Container search box */
    .search-wrapper,
    .search-wrapper-with-filter {
        padding: 0 10px !important;
        margin-top: 15px !important;
        margin-bottom: 15px !important;
        max-width: 100%;
        display: block !important;
        visibility: visible !important;
    }

    /* Group search chung */
    .search-group {
        padding: 2px 2px 2px 10px !important;
    }

    /* Container ô search + filter */
    .search-group-with-filter {
        padding: 3px 3px 3px 3px !important;
        gap: 0px !important;
        border-radius: 30px;
        flex-wrap: nowrap;
        align-items: center !important;
        overflow: visible !important;
    }

    /* Dropdown chọn loại */
    .filter-select {
        font-size: 11px !important;
        padding: 5px 5px 5px 10px !important;
        min-width: 85px !important;
        height: 34px;
        line-height: 24px;
    }

    /* Ô nhập liệu */
    .search-input {
        font-size: 12px !important;
        height: 34px;
    }

    .search-group-with-filter .search-input {
        font-size: 12px !important;
        padding: 5px 8px !important;
        height: 34px;
    }

    /* Nút kính lúp */
    .search-btn {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        margin: 0 2px !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
    }

        .search-btn i {
            font-size: 13px !important;
        }
}

/* =========================================================
   11. CÁC THÀNH PHẦN KHÁC
   ========================================================= */
.filter-btn.active {
    background: var(--mau-menu) !important;
    border-color: var(--mau-menu-solid) !important;
    color: #fff !important;
}

.dropdown-menu {
    border-radius: 12px;
    margin-top: 15px !important;
    border: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--mau-chu-dao);
}

.user-avatar-circle {
    width: 35px;
    height: 35px;
    background: #fff;
    color: var(--mau-chu-dao);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Course card */
.course-card .category {
    background: var(--mau-menu-solid) !important;
    color: #fff !important;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* ===== LAYOUT - HEADER ===== */
header#main-header,
header#main-header .nav-link,
header#main-header .navbar-brand,
header#main-header .navbar-modern .nav-link {
    color: var(--mau-chu-header) !important;
}

    header#main-header .btn-auth {
        color: var(--mau-chu-nut) !important;
    }

/* ===== LAYOUT - FOOTER CHỮ ===== */
.footer-section,
.footer-section p,
.footer-section span,
.footer-section a,
.footer-section h5,
.footer-section h6,
.footer-section li {
    color: var(--mau-chu-footer) !important;
}

/* ===== BODY NỀN ===== */
body {
    background: var(--mau-nen) !important;
}

/* Trang nội dung môn học và tài liệu: nền trắng */
.player-container,
.doc-page-wrapper {
    background: #ffffff !important;
    margin-bottom: 0 !important;
}

/* ===== HEADER ===== */
header#main-header {
    background: var(--mau-chu-dao) !important;
    border: none !important;
    box-shadow: none !important;
}

.navbar-modern {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-bottom: none !important;
}

body header#main-header .navbar-modern .nav-link {
    color: var(--mau-chu-header) !important;
    font-weight: 600;
    font-size: 14px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
    transition: opacity 0.3s ease;
}

    body header#main-header .navbar-modern .nav-link:hover,
    body header#main-header .navbar-modern .nav-link.active {
        opacity: 0.8;
    }

body header#main-header .navbar-modern .logo-img,
body header#main-header .navbar-brand img {
    max-height: 45px !important;
    width: auto !important;
    object-fit: contain !important;
    filter: none !important;
}

body header#main-header .btn-auth {
    background: var(--mau-nen-btn) !important;
    border: none !important;
    outline: none !important;
    color: var(--mau-chu-nut) !important;
    border-radius: 30px;
    padding: 6px 18px !important;
    font-size: 14px !important;
    font-weight: 600;
    white-space: nowrap !important;
    transition: all 0.3s ease;
}

    body header#main-header .btn-auth:hover {
        opacity: 0.9;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

/* ===== FOOTER ===== */
.footer-section, footer {
    background: var(--mau-footer) !important;
    border-top: none !important;
    padding-top: 20px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    position: relative;
    z-index: 1;
}

/* ===== MOBILE (max-width: 991px) ===== */
@media (max-width: 991px) {
    body header#main-header .navbar-modern {
        padding: 15px 0 !important;
        min-height: 70px !important;
    }

        body header#main-header .navbar-modern .logo-img,
        body header#main-header .navbar-brand img {
            max-height: 50px !important;
        }

    body header#main-header .navbar-brand {
        padding: 8px 0 !important;
    }

    #offcanvasNavbar {
        transition: transform 0.3s ease !important;
        width: 280px !important;
    }

    .offcanvas-body .btn-auth {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 12px 20px !important;
        margin-bottom: 10px;
        border-radius: 8px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        background: var(--mau-nen-btn) !important;
        color: var(--mau-chu-nut) !important;
        border: 3px solid rgba(255, 255, 255, 0.3) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
        transition: all 0.3s ease;
    }

        .offcanvas-body .btn-auth:hover {
            border-color: rgba(255, 255, 255, 0.5) !important;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.25) !important;
        }

    .offcanvas-body .d-flex.gap-2 {
        flex-direction: column !important;
        width: 100%;
        padding: 15px;
        gap: 0 !important;
    }

    body header#main-header .navbar-modern .offcanvas-body .nav-link {
        color: #333333 !important;
        font-size: 16px !important;
        padding: 12px 15px !important;
        border-bottom: 1px dashed #eaeaea;
    }

        body header#main-header .navbar-modern .offcanvas-body .nav-link:hover,
        body header#main-header .navbar-modern .offcanvas-body .nav-link:active {
            color: var(--mau-chu-dao) !important;
            background: rgba(0,0,0,0.02);
        }
}

/* ===== SMALL MOBILE (max-width: 576px) ===== */
@media (max-width: 576px) {
    .offcanvas-body .btn-auth {
        border-width: 3px !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2) !important;
    }

        .offcanvas-body .btn-auth:hover {
            border-width: 3px !important;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
        }
}
@media (max-width: 991px) {
    /* 1. Ép hiển thị lại nút Hamburger Menu trên mobile */
    .navbar-toggler {
        display: inline-block !important;
    }

    /* 2. Fix lỗi bị mất thanh tìm kiếm ở Trang chủ */
    .course-filter-wrap {
        flex-wrap: wrap !important; /* Cho phép rớt dòng thay vì bị ép tràn màn hình */
    }

    .home-search-box {
        width: 100% !important; /* Kéo dài thanh tìm kiếm full màn hình mobile */
        margin-top: 15px !important;
    }
}
