/* ============================================
   LUCKY AI CHATBOT STYLES
   ============================================ */

.floating-controls {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    z-index: 260;
    font-family: 'Roboto Flex', sans-serif;
}

.floating-controls .theme-toggle,
.floating-controls .music-toggle {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    padding: 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.08));
    background: var(--bg-primary, #ffffff);
    color: var(--text-primary, #111827);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(6px);
}

.floating-controls .music-toggle {
    margin-bottom: -0.25rem;
    z-index: 2;
}

.floating-controls .theme-toggle {
    z-index: 1;
    margin-top: 0.2rem;
}

.floating-controls .lucky-chatbot {
    position: relative;
    right: auto;
    bottom: auto;
}

body:not(.home-page) .theme-toggle:not(.floating-controls .theme-toggle) {
    display: none !important;
}

body:not(.home-page) .music-toggle:not(.floating-controls .music-toggle) {
    display: none !important;
}

body:not(.home-page) .music-toggle {
    position: absolute;
    right: 4.2rem;
    top: 1.1rem;
    transform: none;
}

.page-theme-toggle {
    display: none !important;
}

.lucky-chatbot {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 260;
    font-family: 'Roboto Flex', sans-serif;
}

.lucky-chatbot .theme-toggle {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.7rem);
    z-index: 6;
    padding: 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.08));
    background: var(--bg-primary, #ffffff);
    color: var(--text-primary, #111827);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(6px);
}

.lucky-chatbot .theme-toggle:hover {
    transform: translateY(-1px);
}

.lucky-chatbot .theme-toggle .theme-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.lucky-chatbot__toggle {
    width: 3.8rem;
    height: 3.8rem;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color, #111827);
    color: var(--bg-primary, #ffffff);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.lucky-chatbot__toggle:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.28);
}

.lucky-chatbot__toggle svg {
    width: 1.5rem;
    height: 1.5rem;
}

.lucky-chatbot__window {
    position: absolute;
    right: 0;
    bottom: calc(100% + 1rem);
    width: min(92vw, 380px);
    max-height: min(78vh, 640px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, rgba(0,0,0,0.08));
    border-radius: 1.35rem;
    overflow: hidden;
    background: var(--bg-secondary, rgba(255,255,255,0.95));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.12);
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: transform 260ms ease, opacity 260ms ease;
}

.lucky-chatbot.is-open .lucky-chatbot__window {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.lucky-chatbot__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 1rem 1rem 0.8rem;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.08));
    background: var(--bg-primary, #f8fafc);
}

.lucky-chatbot__identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.lucky-chatbot__avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--bg-primary, #ffffff);
    background: var(--accent-color, #4d6cff);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.06);
}

.lucky-chatbot__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.lucky-chatbot__title-block {
    min-width: 0;
}

.lucky-chatbot__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
}

.lucky-chatbot__subtitle {
    font-size: 0.74rem;
    color: #5c697b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lucky-chatbot__clear {
    border: 0;
    background: transparent;
    color: #4b5563;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 999px;
    transition: background-color 180ms ease, color 180ms ease;
}

.lucky-chatbot__clear:hover {
    background: rgba(75, 85, 99, 0.11);
    color: #111827;
}

.lucky-chatbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}

.lucky-chatbot__messages::-webkit-scrollbar {
    width: 7px;
}

.lucky-chatbot__messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
}

.lucky-chatbot__bubble {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 86%;
    padding: 0.7rem 0.8rem;
    border-radius: 1rem;
    line-height: 1.5;
    font-size: 0.92rem;
    opacity: 0;
    transform: translateY(8px);
    animation: chatbotBubbleIn 260ms ease forwards;
}

.lucky-chatbot__bubble--bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.95);
    color: #111827;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.lucky-chatbot__bubble--user {
    align-self: flex-end;
    background: var(--accent-color, #4d6cff);
    color: var(--bg-primary, #ffffff);
}

.lucky-chatbot__bubble-time {
    display: none;
}

.lucky-chatbot__composer {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem 0.95rem;
    border-top: 1px solid var(--border-color, rgba(0,0,0,0.08));
    background: var(--bg-secondary, rgba(255,255,255,0.95));
}

.lucky-chatbot__input {
    flex: 1;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary, #111827);
    padding: 0.72rem 0.8rem;
    border-radius: 999px;
    outline: none;
    font: inherit;
}

.lucky-chatbot__input:focus {
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.lucky-chatbot__send {
    border: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color, #4d6cff);
    color: var(--bg-primary, #ffffff);
    cursor: pointer;
    transition: transform 180ms ease;
}

.lucky-chatbot__send:hover {
    transform: scale(1.04);
}

.lucky-chatbot__send svg {
    width: 14px;
    height: 14px;
}

.lucky-chatbot__typing {
    display: inline-flex;
    gap: 0.28rem;
    align-items: center;
    padding-top: 0.2rem;
}

.lucky-chatbot__typing span {
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 50%;
    background: #64748b;
    animation: chatbotBounce 1.1s ease-in-out infinite;
}

.lucky-chatbot__typing span:nth-child(2) {
    animation-delay: 0.16s;
}

.lucky-chatbot__typing span:nth-child(3) {
    animation-delay: 0.32s;
}

body.dark-mode .lucky-chatbot__window {
    background: var(--bg-secondary, rgba(0,0,0,0.95));
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 58px rgba(0, 0, 0, 0.46);
}

body.dark-mode .lucky-chatbot__header {
    background: var(--bg-primary, rgba(10,10,10,0.98));
}

body.dark-mode .lucky-chatbot .theme-toggle {
    background: var(--bg-primary, rgba(10,10,10,0.98));
    color: var(--text-primary, #f8fafc);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .lucky-chatbot__title {
    color: #f9fafb;
}

body.dark-mode .lucky-chatbot__subtitle {
    color: #cbd5e1;
}

body.dark-mode .lucky-chatbot__bubble--bot {
    background: rgba(31, 41, 55, 0.86);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .lucky-chatbot__composer {
    background: rgba(17, 24, 39, 0.84);
}

body.dark-mode .lucky-chatbot__input {
    background: rgba(15, 23, 42, 0.68);
    color: #f9fafb;
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes chatbotBubbleIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes chatbotBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .lucky-chatbot {
        right: 0.75rem;
        bottom: 0.8rem;
    }

    .lucky-chatbot__window {
        width: min(94vw, 360px);
        bottom: calc(100% + 0.75rem);
    }

    .lucky-chatbot__toggle {
        width: 3.5rem;
        height: 3.5rem;
    }
}
