/* ==========================================================================
   MƯỚP BÔNG PET STORE
   GIAO DIỆN LUXURY VÀ KHUNG CHAT AI
   ========================================================================== */

:root {
    --hong-chu-dao: #f472b6;
    --hong-nhat-nen: #fffafb;
    --hong-man-nhan: #9f1239;
    --hong-phan-the: #fce7f3;
    --hong-sang-hover: #fff1f2;

    --mau-muc: #2f2028;
    --mau-vang: #c7a56a;

    --bong-luxury:
        0 24px 60px rgba(159, 18, 57, 0.12);
}

/* ==========================================================================
   GIAO DIỆN CHUNG
   ========================================================================== */

body {
    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #fffafb 45%,
            #ffffff 100%
        );

    color: var(--mau-muc);
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.main-header {
    position: relative;
    z-index: 100;

    background: rgba(255, 255, 255, 0.94) !important;

    border-bottom:
        1px solid rgba(159, 18, 57, 0.1);

    box-shadow:
        0 8px 30px rgba(82, 26, 49, 0.06);
}

.main-header .container {
    min-height: 68px;
}

.main-header .nav-link-header,
.main-header #languageDropdown {
    color: var(--hong-man-nhan) !important;
}

.main-header .nav-link-header:hover {
    color: var(--hong-chu-dao) !important;
}

/* Ô tìm kiếm */

.main-header .search-box input {
    background: #fff7fa;

    border:
        1px solid #f9d8e8;
}

.main-header .search-box input:focus {
    border-color: var(--hong-chu-dao);

    box-shadow:
        0 0 0 3px rgba(244, 114, 182, 0.15);
}

.main-header .search-box .btn {
    background:
        var(--hong-man-nhan) !important;

    color: #ffffff !important;

    border-color:
        var(--hong-man-nhan);
}

/* Nút tài khoản */

.user-dropdown-btn {
    background:
        var(--hong-phan-the) !important;

    color:
        var(--hong-man-nhan) !important;

    border-color:
        #f7c9df !important;
}

.user-dropdown-btn:hover,
.user-dropdown-btn:focus {
    background:
        var(--hong-sang-hover) !important;

    color:
        var(--hong-man-nhan) !important;

    border-color:
        var(--hong-chu-dao) !important;
}

/* ==========================================================================
   MENU CHÍNH
   ========================================================================== */

.menu-bar {
    position: sticky;
    top: 0;
    z-index: 99;

    background:
        rgba(255, 255, 255, 0.9) !important;

    border-bottom:
        1px solid rgba(244, 114, 182, 0.15);

    box-shadow:
        0 8px 25px rgba(75, 31, 48, 0.04);

    backdrop-filter:
        blur(18px);

    -webkit-backdrop-filter:
        blur(18px);
}

.menu-link {
    letter-spacing: 0.02em;
}

.menu-link:hover {
    color:
        var(--hong-man-nhan) !important;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

footer {
    background:
        linear-gradient(
            145deg,
            #ffffff,
            #fff5f8
        ) !important;

    border-top:
        1px solid #f6dce7;
}

/* ==========================================================================
   NÚT CHAT AI NỔI
   ========================================================================== */

.nut-chat-ai {
    position: fixed;
    right: 26px;
    bottom: 24px;
    z-index: 1200;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 0;

    background: transparent;
    border: none;

    filter:
        drop-shadow(
            0 12px 18px rgba(159, 18, 57, 0.22)
        );

    transition:
        transform 0.25s ease,
        filter 0.25s ease;
}

.nut-chat-ai:hover {
    transform:
        translateY(-5px);

    filter:
        drop-shadow(
            0 16px 22px rgba(159, 18, 57, 0.3)
        );
}

.nut-chat-ai:focus-visible {
    outline:
        3px solid rgba(244, 114, 182, 0.45);

    outline-offset: 5px;

    border-radius: 22px;
}

/* Avatar của nút chat */

.avatar-chat {
    position: relative;

    display: grid;
    place-items: center;

    width: 66px;
    height: 66px;

    color: #ffffff;
    font-size: 25px;

    background:
        linear-gradient(
            145deg,
            #f9a8d4,
            #be185d
        );

    border:
        5px solid #ffffff;

    border-radius: 50%;

    box-shadow:
        0 0 0 2px var(--hong-chu-dao);
}

.avatar-chat .fa-paw {
    position: absolute;
    right: 5px;
    bottom: 7px;

    font-size: 13px;
}

/* Chữ Chat ngay */

.nhan-chat {
    margin-top: -5px;

    padding:
        4px 13px;

    color: #ffffff;

    font-size: 12px;
    font-weight: 800;

    background:
        var(--hong-man-nhan);

    border:
        3px solid #ffffff;

    border-radius: 999px;
}

/* Hiệu ứng nhịp nhẹ */

@keyframes nhip-chat-ai {
    0%,
    100% {
        box-shadow:
            0 0 0 2px var(--hong-chu-dao),
            0 0 0 0 rgba(244, 114, 182, 0.3);
    }

    50% {
        box-shadow:
            0 0 0 2px var(--hong-chu-dao),
            0 0 0 12px rgba(244, 114, 182, 0);
    }
}

.nut-chat-ai .avatar-chat {
    animation:
        nhip-chat-ai 2.4s infinite;
}

/* ==========================================================================
   KHUNG CHAT AI
   ========================================================================== */

.khung-chat-ai {
    position: fixed;
    right: 26px;
    bottom: 24px;
    z-index: 1250;

    display: flex;
    flex-direction: column;

    width:
        min(390px, calc(100vw - 24px));

    height:
        min(590px, calc(100vh - 40px));

    overflow: hidden;

    visibility: hidden;
    opacity: 0;

    background: #ffffff;

    border:
        1px solid #f4d4e2;

    border-radius: 26px;

    box-shadow:
        0 28px 80px rgba(75, 20, 43, 0.26);

    transform:
        translateY(20px) scale(0.96);

    transform-origin:
        bottom right;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
}

/* Khi JavaScript thêm class mo */

.khung-chat-ai.mo {
    visibility: visible;
    opacity: 1;

    transform:
        translateY(0) scale(1);
}

/* ==========================================================================
   PHẦN ĐẦU KHUNG CHAT
   ========================================================================== */

.dau-chat-ai {
    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 80px;

    padding:
        17px 18px;

    color: #ffffff;

    background:
        linear-gradient(
            120deg,
            var(--hong-man-nhan),
            #db2777
        );
}

/* Avatar nhỏ */

.avatar-chat-nho {
    width: 45px;
    height: 45px;

    flex-shrink: 0;

    font-size: 18px;

    border-width: 2px;

    box-shadow: none;

    animation: none !important;
}

/* Tên trợ lý và trạng thái */

.dau-chat-ai > div {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.dau-chat-ai strong {
    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 18px;
    font-weight: 600;
}

.dau-chat-ai small {
    font-size: 12px;

    opacity: 0.88;
}

.dau-chat-ai small span {
    display: inline-block;

    width: 7px;
    height: 7px;

    margin-right: 3px;

    background: #86efac;

    border-radius: 50%;
}

/* Nút đóng */

.dau-chat-ai > button {
    display: grid;
    place-items: center;

    width: 34px;
    height: 34px;

    flex-shrink: 0;

    color: #ffffff;

    background:
        rgba(255, 255, 255, 0.12);

    border:
        1px solid rgba(255, 255, 255, 0.5);

    border-radius: 50%;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.dau-chat-ai > button:hover {
    background:
        rgba(255, 255, 255, 0.25);

    transform:
        rotate(5deg);
}

/* ==========================================================================
   KHU VỰC NỘI DUNG CHAT
   ========================================================================== */

.noi-dung-chat-ai {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;

    overflow-y: auto;

    padding: 20px;

    background:
        linear-gradient(
            180deg,
            #ffffff,
            #fff7fa
        );

    scroll-behavior: smooth;
}

/* Thanh cuộn */

.noi-dung-chat-ai::-webkit-scrollbar {
    width: 6px;
}

.noi-dung-chat-ai::-webkit-scrollbar-track {
    background: transparent;
}

.noi-dung-chat-ai::-webkit-scrollbar-thumb {
    background: #efbfd4;

    border-radius: 999px;
}

/* ==========================================================================
   TIN NHẮN
   ========================================================================== */

.tin-nhan {
    max-width: 84%;

    padding:
        12px 14px;

    font-size: 14px;
    line-height: 1.55;

    border-radius: 17px;

    white-space: pre-wrap;
    overflow-wrap: break-word;

    animation:
        hien-tin-nhan 0.25s ease;
}

@keyframes hien-tin-nhan {
    from {
        opacity: 0;

        transform:
            translateY(7px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}

/* Tin nhắn của AI */

.tin-nhan-ai {
    align-self: flex-start;

    color: var(--mau-muc);

    background: #ffffff;

    border:
        1px solid #f3d8e4;

    border-bottom-left-radius: 5px;

    box-shadow:
        0 6px 18px rgba(159, 18, 57, 0.05);
}

/* Tin nhắn khách gửi */

.tin-nhan-khach {
    align-self: flex-end;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--hong-man-nhan),
            #db2777
        );

    border-bottom-right-radius: 5px;

    box-shadow:
        0 8px 20px rgba(159, 18, 57, 0.16);
}

/* Tin AI đang suy nghĩ */

.tin-nhan-dang-go {
    opacity: 0.65;

    animation:
        dang-suy-nghi 1.2s infinite;
}

@keyframes dang-suy-nghi {
    0%,
    100% {
        opacity: 0.45;
    }

    50% {
        opacity: 0.9;
    }
}

/* ==========================================================================
   CÁC NÚT CÂU HỎI GỢI Ý
   ========================================================================== */

.goi-y-chat {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;

    margin-top: 3px;
}

.goi-y-chat button {
    padding:
        7px 10px;

    color:
        var(--hong-man-nhan);

    font-size: 12px;
    font-weight: 600;

    background: #ffffff;

    border:
        1px solid #f3bfd7;

    border-radius: 999px;

    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.goi-y-chat button:hover {
    color: #ffffff;

    background:
        var(--hong-man-nhan);

    border-color:
        var(--hong-man-nhan);

    transform:
        translateY(-2px);
}

/* ==========================================================================
   Ô NHẬP TIN NHẮN
   ========================================================================== */

.nhap-chat-ai {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 13px;

    background: #ffffff;

    border-top:
        1px solid #f5dbe6;
}

.nhap-chat-ai input {
    flex: 1;

    min-width: 0;

    padding:
        11px 15px;

    color:
        var(--mau-muc);

    background: #fff8fb;

    border:
        1px solid #efd4df;

    border-radius: 999px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.nhap-chat-ai input::placeholder {
    color: #a88995;
}

.nhap-chat-ai input:focus {
    border-color:
        var(--hong-chu-dao);

    box-shadow:
        0 0 0 3px rgba(244, 114, 182, 0.15);
}

/* Nút gửi */

.nhap-chat-ai button {
    display: grid;
    place-items: center;

    width: 43px;
    height: 43px;

    flex-shrink: 0;

    color: #ffffff;

    background:
        var(--hong-man-nhan);

    border: none;

    border-radius: 50%;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.nhap-chat-ai button:hover {
    background: #be185d;

    transform:
        translateY(-2px);
}

.nhap-chat-ai button:disabled {
    cursor: not-allowed;

    opacity: 0.55;

    transform: none;
}

/* ==========================================================================
   RESPONSIVE HEADER
   ========================================================================== */

@media (max-width: 900px) {
    .main-header .container {
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-box {
        order: 3;

        min-width: 100%;

        margin:
            0 !important;
    }

    .main-header .d-flex.align-items-center {
        flex-wrap: wrap;

        margin-left: auto;
    }

    .menu-bar nav {
        display: flex;

        overflow-x: auto;

        padding:
            4px 0;
    }

    .menu-link {
        white-space: nowrap;
    }
}

/* ==========================================================================
   RESPONSIVE KHUNG CHAT
   ========================================================================== */

@media (max-width: 520px) {
    .nut-chat-ai {
        right: 14px;
        bottom: 14px;
    }

    .avatar-chat {
        width: 58px;
        height: 58px;

        font-size: 22px;
    }

    .nhan-chat {
        font-size: 11px;
    }

    .khung-chat-ai {
        right: 12px;
        bottom: 12px;

        width:
            calc(100vw - 24px);

        height:
            calc(100vh - 24px);

        border-radius: 20px;
    }

    .dau-chat-ai {
        padding:
            14px 15px;
    }

    .noi-dung-chat-ai {
        padding: 15px;
    }

    .tin-nhan {
        max-width: 90%;
    }
}

/* Người dùng bật chế độ giảm chuyển động */

@media (prefers-reduced-motion: reduce) {
    .nut-chat-ai .avatar-chat,
    .tin-nhan,
    .tin-nhan-dang-go {
        animation: none;
    }

    .nut-chat-ai,
    .khung-chat-ai,
    .goi-y-chat button,
    .nhap-chat-ai button {
        transition: none;
    }
}