/* AI Chat Widget CSS */
#ai-chat-widget {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

#ai-chat-trigger {
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
}

#ai-chat-trigger:hover {
    transform: none;
}

/* Sci-Fi Energy Orb Trigger */
.ai-orb-container {
    position: relative;
    width: 65px;
    height: 65px;
}

/* Outer glow pulse */
.ai-orb-glow {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 123, 255, 0.3) 0%, transparent 70%);
    animation: orbPulse 2.5s ease-in-out infinite;
    z-index: 0;
}

/* Main orb body */
.ai-orb {
    position: relative;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%,
            #4facfe 0%,
            #1a73e8 30%,
            #0d47a1 60%,
            #0a2463 100%);
    box-shadow:
        0 0 15px rgba(0, 123, 255, 0.5),
        0 0 30px rgba(0, 123, 255, 0.3),
        inset 0 -3px 8px rgba(0, 0, 0, 0.3),
        inset 0 3px 8px rgba(255, 255, 255, 0.15);
    z-index: 2;
    overflow: hidden;
    animation: orbBreathe 3s ease-in-out infinite;
}

/* Glass highlight on orb */
.ai-orb::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 12px;
    width: 20px;
    height: 12px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    filter: blur(2px);
}

/* Eyes container */
.ai-eyes {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

/* Individual eye */
.ai-eye {
    width: 10px;
    height: 12px;
    background: radial-gradient(circle, #fff 30%, #80d8ff 60%, #00b0ff 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow:
        0 0 6px rgba(128, 216, 255, 0.9),
        0 0 12px rgba(0, 176, 255, 0.5);
    animation: eyeGlow 2s ease-in-out infinite, eyeBlink 4s ease-in-out infinite;
    position: relative;
}

/* Eye pupil */
.ai-eye::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 5px;
    background: #0d47a1;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

/* Rotating orbital ring */
.ai-orb-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    border-top-color: rgba(79, 172, 254, 0.6);
    border-right-color: rgba(79, 172, 254, 0.2);
    animation: ringRotate 3s linear infinite;
    z-index: 4;
}

/* Floating particles */
.ai-particles {
    position: absolute;
    inset: -15px;
    z-index: 1;
}

.ai-particles span {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #80d8ff;
    border-radius: 50%;
    box-shadow: 0 0 4px #80d8ff;
    animation: particleFloat 3s ease-in-out infinite;
}

.ai-particles span:nth-child(1) {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.ai-particles span:nth-child(2) {
    top: 0%;
    left: 60%;
    animation-delay: 0.5s;
}

.ai-particles span:nth-child(3) {
    top: 80%;
    left: 10%;
    animation-delay: 1s;
}

.ai-particles span:nth-child(4) {
    top: 85%;
    left: 75%;
    animation-delay: 1.5s;
}

.ai-particles span:nth-child(5) {
    top: 40%;
    left: 0%;
    animation-delay: 2s;
}

.ai-particles span:nth-child(6) {
    top: 30%;
    left: 90%;
    animation-delay: 2.5s;
}

/* Animations */
@keyframes orbPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.25);
        opacity: 1;
    }
}

@keyframes orbBreathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.04);
    }
}

@keyframes eyeGlow {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(128, 216, 255, 0.9), 0 0 12px rgba(0, 176, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 10px rgba(128, 216, 255, 1), 0 0 20px rgba(0, 176, 255, 0.8);
    }
}

@keyframes eyeBlink {

    0%,
    42%,
    48%,
    100% {
        transform: scaleY(1);
    }

    45% {
        transform: scaleY(0.1);
    }
}

@keyframes ringRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes particleFloat {

    0%,
    100% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translateY(-5px) scale(1);
    }

    80% {
        opacity: 0.6;
        transform: translateY(-15px) scale(0.8);
    }

    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.3);
    }
}

/* Mini orb for chat header */
.ai-orb-mini {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.ai-orb-mini .ai-orb {
    width: 40px;
    height: 40px;
    box-shadow:
        0 0 10px rgba(0, 123, 255, 0.4),
        0 0 20px rgba(0, 123, 255, 0.2),
        inset 0 -2px 5px rgba(0, 0, 0, 0.3),
        inset 0 2px 5px rgba(255, 255, 255, 0.15);
}

.ai-orb-mini .ai-orb::before {
    top: 4px;
    left: 8px;
    width: 14px;
    height: 8px;
}

.ai-orb-mini .ai-eyes {
    gap: 7px;
}

.ai-orb-mini .ai-eye {
    width: 7px;
    height: 8px;
}

.ai-orb-mini .ai-eye::after {
    width: 3px;
    height: 3px;
}

.ai-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#ai-chat-trigger:hover .ai-tooltip {
    opacity: 1;
}

/* Chat Window */
#ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    border: 1px solid #e0e0e0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
}

.ai-profile h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.ai-profile>div:last-child {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.0;
    padding-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0px;
}

#ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Messages Area */
#ai-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    position: relative;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.ai-message {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    align-self: flex-start;
}

.user-message {
    background: #007bff;
    color: #fff;
    border-bottom-right-radius: 2px;
    align-self: flex-end;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.2);
}

.typing-indicator {
    padding: 10px;
    background: #fff;
    border-radius: 12px;
    width: fit-content;
    display: flex;
    gap: 5px;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5);
        background: #007bff;
    }
}

/* Suggestions */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.ai-suggestions button {
    background: #e9ecef;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    color: #495057;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-suggestions button:hover {
    background: #dee2e6;
    color: #212529;
}

/* Input Area */
.ai-chat-input {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

#ai-user-input {
    flex: 1;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s;
    font-size: 16px;
    /* Prevents iOS auto-zoom on focus */
}

#ai-user-input:focus {
    border-color: #007bff;
    outline: none !important;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

#ai-send-btn {
    background: #007bff;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#ai-send-btn:hover {
    background: #0069d9;
}

.ai-privacy-note {
    text-align: center;
    font-size: 0.75rem;
    color: #adb5bd;
    padding: 0px 15px 5px 15px;
    background: #fff;
    line-height: 1.2;
}

.ai-privacy-note i {
    color: #007bff;
    margin-right: 4px;
    font-size: 0.85rem;
    vertical-align: middle;
}

.ai-powered-by {
    text-align: center;
    font-size: 0.7rem;
    color: #adb5bd;
    padding-bottom: 5px;
    background: #fff;
}

/* Dark Mode Support (Optional, if site has it) */
body.dark-mode #ai-chat-window {
    background: #2d2d2d;
    border-color: #444;
}

body.dark-mode .ai-message {
    background: #3d3d3d;
    color: #e0e0e0;
}

body.dark-mode #ai-chat-messages {
    background: #1a1a1a;
}

body.dark-mode .ai-chat-input {
    background: #2d2d2d;
    border-color: #444;
}

body.dark-mode #ai-user-input {
    background: #3d3d3d;
    border-color: #555;
    color: #fff;
}

body.dark-mode .ai-powered-by {
    background: #2d2d2d;
}

body.dark-mode .ai-privacy-note {
    background: #2d2d2d;
    color: #888;
}

@media (max-width: 480px) {

    #ai-chat-widget {
        bottom: 20px;
        right: 20px;
    }

    #ai-chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    #ai-chat-trigger {
        bottom: 20px;
        right: 20px;
    }

    .ai-chat-input {
        padding: 10px;
    }

    /* Remove any yellow/light focus ring on all inputs */
    input,
    textarea,
    button {
        -webkit-tap-highlight-color: transparent;
        outline: none !important;
    }
}