/* Frontend Styles for AI Smart Web Translator */

/* 1. Floating Language Selector Layout */
.ai-lang-selector-floating {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    user-select: none;
}

.ai-lang-selector-floating.ai-pos-top-right {
    top: 20px;
    right: 20px;
}
.ai-lang-selector-floating.ai-pos-bottom-right {
    bottom: 20px;
    right: 20px;
}
.ai-lang-selector-floating.ai-pos-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Selector triggers */
.ai-floating-trigger {
    background-color: #0c2340;
    color: #ffffff;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(12, 35, 64, 0.25);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.ai-floating-trigger:hover {
    background-color: #f97316;
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(249, 115, 22, 0.3);
}

/* Floating Menu */
.ai-floating-menu {
    position: absolute;
    bottom: 100%;
    margin-bottom: 10px;
    right: 0;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    list-style: none;
    display: none;
    min-width: 120px;
    border: 1px solid #e2e8f0;
}
.ai-lang-selector-floating.open .ai-floating-menu {
    display: block;
    animation: aiFadeSlideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.ai-floating-menu li {
    padding: 10px 18px;
    font-size: 0.88rem;
    color: #334155;
    cursor: pointer;
    transition: background 0.2s ease;
    font-weight: 500;
}
.ai-floating-menu li:hover {
    background-color: #f8fafc;
    color: #f97316;
}
.ai-floating-menu li.active {
    color: #0c2340;
    background-color: #f1f5f9;
    font-weight: bold;
}

/* Specific Dropdown Style */
.ai-floating-dropdown {
    background-color: #0c2340;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(12, 35, 64, 0.25);
    outline: none;
}

/* Category Filter pills in shortcode */
.ai-lang-selector-shortcode select {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 0.9rem;
    color: #334155;
    outline: none;
}

/* Animations */
@keyframes aiFadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2. Loading State Overlays (Evita parpadeos agresivos) */
body.ai-translator-loading {
    cursor: wait;
}
body.ai-translator-loading::after {
    content: "";
    position: fixed;
    top: 24px;
    right: 24px;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(12, 35, 64, 0.2);
    border-top-color: #f97316;
    border-radius: 50%;
    animation: aiSpinner 0.8s linear infinite;
    z-index: 9999999;
}

@keyframes aiSpinner {
    to { transform: rotate(360deg); }
}

/* Visual Length Protection classes (Fallback fallback) */
.ai-translated-text {
    word-break: normal;
    overflow-wrap: break-word;
}

/* 3. Robot/AI Assistant Floating Selector Styles */
.ai-style-robot {
    perspective: 1000px;
}

.ai-robot-trigger {
    width: 56px;
    height: 56px;
    border-radius: 50% !important;
    background: #0f172a !important;
    border: 2px solid #38bdf8 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.25) !important;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    cursor: pointer;
}

.ai-robot-trigger:hover {
    transform: scale(1.1) translateY(-3px) rotate(3deg) !important;
    box-shadow: 0 14px 30px rgba(56, 189, 248, 0.4) !important;
    border-color: #f97316 !important;
}

.ai-robot-avatar {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    transition: color 0.3s ease;
}

.ai-robot-trigger:hover .ai-robot-svg {
    color: #38bdf8;
}

.ai-robot-svg {
    width: 100%;
    height: 100%;
}

/* Antena blinking glow */
@keyframes antennaPulse {
    0%, 100% { opacity: 0.4; filter: drop-shadow(0 0 1px #38bdf8); }
    50% { opacity: 1; filter: drop-shadow(0 0 6px #38bdf8); }
}
.ai-antenna-glow {
    animation: antennaPulse 1.8s infinite ease-in-out;
}

/* Language Badge */
.ai-robot-trigger .ai-trigger-text {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f97316;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    border-radius: 20px;
    padding: 2px 6px;
    border: 1.5px solid #0f172a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

/* Robot Dropdown Chat Bubble Menu */
.ai-style-robot .ai-floating-menu {
    bottom: 115%;
    right: 0;
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.4);
    padding: 8px;
    min-width: 140px;
    overflow: hidden;
}

/* Chat bubble arrow */
.ai-style-robot .ai-floating-menu::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 22px;
    border-width: 8px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
}
.ai-style-robot .ai-floating-menu::before {
    content: "";
    position: absolute;
    top: 100%;
    right: 21px;
    border-width: 9px;
    border-style: solid;
    border-color: rgba(56, 189, 248, 0.2) transparent transparent transparent;
    z-index: -1;
}

.ai-style-robot .ai-floating-menu li {
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.ai-style-robot .ai-floating-menu li:hover {
    background: #1e293b;
    color: #38bdf8;
}

.ai-style-robot .ai-floating-menu li.active {
    background: #38bdf8;
    color: #0f172a;
    font-weight: 800;
}

/* Position overrides for bottom-left (to keep menu on screen and align arrow) */
.ai-lang-selector-floating.ai-pos-bottom-left .ai-floating-menu {
    right: auto !important;
    left: 0 !important;
}

.ai-style-robot.ai-pos-bottom-left .ai-floating-menu::after {
    right: auto !important;
    left: 22px !important;
}

.ai-style-robot.ai-pos-bottom-left .ai-floating-menu::before {
    right: auto !important;
    left: 21px !important;
}
