/* --- AI FEATURES & DYNAMIC UI --- */

/* 1. Breaking News Ticker (Marquee) */
.fh-ai-ticker-wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(90deg, #0f172a 0%, #312e81 50%, #0f172a 100%);
    color: #fff;
    font-size: 0.9rem;
    padding: 10px 0;
    z-index: 9999;
    overflow: hidden;
    border-top: 1px solid var(--primary);
    box-shadow: 0 -5px 20px rgba(6, 182, 212, 0.3);
    display: none;
    /* JS will enable it if promos exist */
}

.fh-ai-ticker-content {
    display: inline-block;
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
    padding-left: 100%;
}

.fh-ai-ticker-item {
    display: inline-flex;
    align-items: center;
    margin-right: 50px;
    font-weight: 600;
}

.fh-ai-ticker-badge {
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 10px;
    text-transform: uppercase;
    font-weight: 800;
    animation: pulse-red 2s infinite;
}

@keyframes ticker-scroll {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* 2. AI Generated Popups (Simulated) */
.fh-ai-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.fh-ai-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.fh-ai-popup-card {
    width: 90%;
    max-width: 450px;
    background: #020617;
    border: 1px solid var(--secondary);
    border-radius: 15px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.fh-ai-popup-overlay.active .fh-ai-popup-card {
    transform: scale(1);
}

/* Glitch Effect Header for AI Feel */
.fh-ai-popup-header {
    background: linear-gradient(45deg, var(--secondary), var(--primary));
    padding: 15px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.fh-ai-popup-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.fh-ai-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.7);
    animation: scan-vertical 2s linear infinite;
    box-shadow: 0 0 10px white;
}

@keyframes scan-vertical {
    0% {
        top: 0%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

.fh-ai-popup-body {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-main);
}

.fh-ai-promo-code {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    border: 2px dashed var(--primary);
    padding: 10px 20px;
    margin: 20px 0;
    display: inline-block;
    position: relative;
    background: rgba(6, 182, 212, 0.1);
    letter-spacing: 3px;
}

.fh-ai-generated-tag {
    font-size: 0.7rem;
    color: var(--success);
    margin-top: 5px;
    display: block;
    font-family: monospace;
}

.fh-btn-close-ai {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
}

.fh-btn-close-ai:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 3. Floating Assistant Button (Redesigned) */
.fh-ai-assistant-btn {
    position: fixed;
    bottom: 90px;
    right: 25px;
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-deep), var(--secondary));
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
    z-index: 9990;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    animation: fh-float 4s ease-in-out infinite;
}

.fh-ai-assistant-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2), transparent);
}

.fh-ai-assistant-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.8);
}

.fh-ai-btn-text {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    line-height: 1.1;
    max-width: 60px;
    z-index: 1;
}

.fh-ai-btn-sub {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 2px;
    z-index: 1;
}

@keyframes fh-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Typing Dots Animation */
.fh-ai-typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    margin-right: 3px;
    animation: typing 1.4s infinite ease-in-out both;
}

.fh-ai-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.fh-ai-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 4. Chat Window Interface */
.fh-ai-chat-window {
    position: fixed;
    bottom: 110px;
    /* Above the button */
    right: 30px;
    width: 340px;
    height: 480px;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--primary);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    z-index: 9991;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fh-ai-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.fh-ai-chat-header {
    background: linear-gradient(90deg, var(--bg-deep) 0%, rgba(139, 92, 246, 0.2) 100%);
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fh-ai-chat-title {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fh-ai-chat-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.fh-ai-chat-close:hover {
    color: #fff;
}

.fh-ai-chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Scrollbar styles for chat */
.fh-ai-chat-body::-webkit-scrollbar {
    width: 6px;
}

.fh-ai-chat-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.fh-ai-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.fh-ai-message-bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-top-left-radius: 2px;
}

.fh-ai-message-user {
    align-self: flex-end;
    background: var(--primary);
    color: #000;
    border-top-right-radius: 2px;
    font-weight: 600;
}

.fh-ai-chat-input-area {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 8px;
}

.fh-ai-chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 15px;
    color: #fff;
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.fh-ai-chat-input-area input:focus {
    border-color: var(--primary);
}

.fh-ai-chat-input-area button {
    background: var(--primary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #000;
    transition: transform 0.2s;
}

.fh-ai-chat-input-area button:hover {
    transform: scale(1.1);
}