﻿:root {
    --rosso: #e32400;
    --rosso-dark: #a81b00;
    --rosso-glow: rgba(227,36,0,0.3);
    --nero: #080808;
    --nero-2: #101010;
    --nero-3: #181818;
    --nero-4: #222;
    --grigio: #3a3a3a;
    --grigio-light: #777;
    --bianco: #f4ede4;
    --oro: #c5a15a;
}

/* =========================================
   1. GIAO DIỆN NỀN & TRANG XÁC THỰC (AUTH)
========================================= */

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: Arial, sans-serif;
    overflow: hidden;
    background: black;
}

.bg-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: -1;
}

.auth-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    width: 380px;
    padding: 34px 28px;
    border-radius: 20px;
    background: rgba(20,20,20,.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 0 60px rgba(255,0,0,.5);
    text-align: center;
    animation: float 6s ease-in-out infinite;
}

    .auth-box h2 {
        color: #ff2b2b;
        margin: 10px 0 10px;
        letter-spacing: 3px;
    }

.auth-content form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Đã giới hạn form input chỉ nằm trong auth-box */
.auth-box input {
    width: 100%;
    height: 46px;
    padding: 0 48px 0 14px;
    border-radius: 12px;
    border: none;
    outline: none;
    font-size: 15px;
    background: rgba(255,255,255,.08);
    color: white;
    box-sizing: border-box;
}

    .auth-box input::placeholder {
        color: #bbb;
    }

/* Đã giới hạn form button chỉ nằm trong auth-box để không phá form chat */
.auth-box button {
    width: 100%;
    padding: 13px;
    background: linear-gradient(90deg,#ff3b3b,#b40000);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(255,0,0,.6);
    margin-top: 8px;
}

    .auth-box button:hover {
        opacity: .9;
        box-shadow: 0 0 28px rgba(255,0,0,.9);
    }

/* ===== PASSWORD ===== */
.password-group {
    width: 100%;
}

.password-box {
    position: relative;
    width: 100%;
}

/* ICON MẮT — FIX LỆCH */
.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    cursor: pointer;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .25s;
}

    .toggle-password svg {
        width: 20px;
        height: 20px;
        stroke: #9a9a9a;
    }

    .toggle-password:hover {
        opacity: 1;
    }

        .toggle-password:hover svg {
            stroke: #ff2b2b;
        }

/* ===== FORGOT PASSWORD ===== */
.forgot-row {
    width: 100%;
    text-align: right;
    margin-top: 6px;
}

.forgot-password-inline {
    font-size: 13px;
    color: #ff4d4d;
    text-decoration: none;
    transition: .25s;
}

    .forgot-password-inline:hover {
        color: white;
    }

/* SWITCH LOGIN REGISTER */
.auth-switch {
    display: block;
    margin-top: 14px;
    color: #ff6b6b;
    text-decoration: none;
}

    .auth-switch:hover {
        color: white;
    }

.auth-footer {
    margin-top: 18px;
    text-align: center;
}

.forgot-password-global {
    font-size: 13px;
    color: #9aa4ff;
    text-decoration: none;
}

    .forgot-password-global:hover {
        color: white;
    }

/* ===== ANIMATION ===== */
@keyframes float {
    0%,100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.animate-in {
    animation: fadeSlideIn .9s ease forwards;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== CONTACT SUPPORT ===== */
.contact-support.horizontal {
    position: fixed;
    bottom: 25px; /* cách đáy */
    left: 50%; /* đưa ra giữa */
    transform: translateX(-50%); /* căn giữa thật */
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 22px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    font-size: 14px;
    z-index: 9999;
    white-space: nowrap;
}

.support-title {
    color: #ff2d2d;
    font-weight: 600;
}

.support-item b {
    color: #fff;
}

.support-link {
    color: #ff2d2d;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
}

    .support-link:hover {
        color: white;
    }


/* =========================================
   2. GIAO DIỆN CHATBOT BUBBLE WIDGET
========================================= */

/* Bubble button */
.chat-bubble-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 60px;
    height: 60px;
    background: var(--rosso);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(227,36,0,0.45);
    transition: transform 0.3s, box-shadow 0.3s;
    padding: 0; /* Ghi đè padding nếu có */
}

    .chat-bubble-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 8px 36px rgba(227,36,0,0.6);
    }

    .chat-bubble-btn.open {
        transform: scale(1);
    }

.bubble-icon {
    transition: all 0.3s;
}

.bubble-icon-close {
    display: none;
}

.chat-bubble-btn.open .bubble-icon-open {
    display: none;
}

.chat-bubble-btn.open .bubble-icon-close {
    display: block;
}

/* Ping ring */
.chat-bubble-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(227,36,0,0.4);
    animation: ping-ring 2.5s ease-out infinite;
}

@keyframes ping-ring {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Notification dot */
.chat-notif {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    border: 2px solid var(--rosso);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: var(--rosso);
    font-family: 'Space Mono', monospace;
}

/* Chat window */
.chatbox {
    position: fixed;
    bottom: 108px;
    right: 32px;
    width: 360px;
    height: 520px;
    background: var(--nero-2);
    border: 1px solid #242424;
    border-top: 3px solid var(--rosso);
    display: flex;
    flex-direction: column;
    z-index: 800;
    box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(227,36,0,0.1);
    transform-origin: bottom right;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.28s cubic-bezier(0.34,1.56,0.64,1);
    text-align: left; /* Đặt lại text-align để chống kế thừa từ body/auth-box */
}

    .chatbox.open {
        transform: scale(1) translateY(0);
        opacity: 1;
        pointer-events: all;
    }

/* Chat header */
.cb-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
}

.cb-avatar {
    width: 38px;
    height: 38px;
    background: var(--rosso);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.cb-info {
    flex: 1;
}

.cb-name {
    font-family: 'Bebas Neue', cursive;
    font-size: 17px;
    letter-spacing: 2px;
    color: var(--bianco);
    line-height: 1;
    margin: 0; /* Reset margin nếu có */
}

.cb-status {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 2px;
    color: #4CAF50;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

    .cb-status::before {
        content: '';
        width: 6px;
        height: 6px;
        background: #4CAF50;
        border-radius: 50%;
        box-shadow: 0 0 5px #4CAF50;
        animation: blink-dot 2s ease infinite;
    }

@keyframes blink-dot {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.cb-powered {
    font-family: 'Space Mono', monospace;
    font-size: 8px;
    color: var(--grigio-light);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gemini-badge {
    background: linear-gradient(135deg, #4285f4, #34a853, #fbbc04, #ea4335);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Chat messages */
.cb-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0d0d0d;
    scroll-behavior: smooth;
}

    .cb-body::-webkit-scrollbar {
        width: 3px;
    }

    .cb-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .cb-body::-webkit-scrollbar-thumb {
        background: var(--rosso-dark);
        border-radius: 2px;
    }

.cb-msg-row {
    display: flex;
    gap: 8px;
    animation: msg-pop 0.25s ease;
}

@keyframes msg-pop {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cb-msg-row.user {
    flex-direction: row-reverse;
}

.cb-msg-av {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-top: 2px;
}

    .cb-msg-av.ai {
        background: var(--rosso);
        clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
        border-radius: 0;
    }

    .cb-msg-av.user {
        background: var(--nero-4);
        border: 1px solid var(--grigio);
    }

.cb-bubble {
    max-width: 80%;
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.6;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
}

    .cb-bubble.ai {
        background: var(--nero-3);
        border: 1px solid #222;
        color: var(--bianco);
        border-radius: 2px 10px 10px 10px;
    }

    .cb-bubble.user {
        background: var(--rosso);
        color: white;
        border-radius: 10px 2px 10px 10px;
        font-family: 'Cormorant Garamond', serif;
    }

/* Quick chips */
.quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.quick-chip {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: var(--grigio-light);
    padding: 5px 10px;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    border-radius: 4px; /* Fix nếu bị ảnh hưởng global */
}

    .quick-chip:hover {
        border-color: var(--rosso);
        color: var(--rosso);
        background: rgba(227,36,0,0.05);
    }

/* Typing */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 14px;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--rosso);
    border-radius: 50%;
    animation: bounce-dot 1.1s ease infinite;
}

    .dot:nth-child(2) {
        animation-delay: 0.18s;
    }

    .dot:nth-child(3) {
        animation-delay: 0.36s;
    }

@keyframes bounce-dot {
    0%, 60%, 100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-7px);
    }
}

/* Chat footer */
.cb-footer {
    padding: 12px;
    border-top: 1px solid #1e1e1e;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

#cb-input {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid var(--grigio);
    color: var(--bianco);
    padding: 10px 14px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 40px;
    max-height: 90px;
    transition: border-color 0.2s;
    border-radius: 0;
}

    #cb-input:focus {
        border-color: var(--rosso);
    }

    #cb-input::placeholder {
        color: var(--grigio);
        font-style: italic;
    }

#cb-send {
    background: var(--rosso);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 16px;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
    border-radius: 0; /* Khắc phục xung đột auth-box */
    padding: 0;
}

    #cb-send:hover {
        background: var(--rosso-dark);
        transform: translateY(-1px);
    }

    #cb-send:disabled {
        background: var(--grigio);
        cursor: not-allowed;
        transform: none;
    }

.cb-note {
    padding: 6px 12px;
    font-family: 'Space Mono', monospace;
    font-size: 8px;
    letter-spacing: 1px;
    color: var(--grigio);
    text-align: center;
    border-top: 1px solid #141414;
    flex-shrink: 0;
}
