/**
 * ============================================================================
 * sgiT Education - Foxy Widget Styles v1.4
 * ============================================================================
 * 
 * SIMPLER FOXY-KOPF mit konfigurierbaren Animationen
 * 
 * @author sgiT Solution Engineering & IT Services
 * @version 1.4
 * @date 04.12.2025
 * ============================================================================
 */

/* ============================================================================
   CSS VARIABLEN - Konfigurierbar via JavaScript
   ============================================================================ */
:root {
    /* sgiT Branding */
    --clippy-primary: #1A3503;
    --clippy-secondary: #43D240;
    --clippy-white: #FFFFFF;
    
    /* Foxy Farben */
    --fox-orange: #E86F2C;
    --fox-dark-blue: #1E3A5F;
    --fox-cream: #FFF5EB;
    --fox-beige: #F5E6D3;
    
    /* Animation Speeds - werden von JS gesetzt */
    --foxy-ear-speed: 4s;
    --foxy-eye-speed: 4s;
    --foxy-nose-speed: 3s;
    --foxy-idle-speed: 3s;
    
    /* Animation Play State - running oder paused */
    --foxy-ear-animation: running;
    --foxy-eye-animation: running;
    --foxy-nose-animation: running;
    --foxy-idle-animation: running;
    
    /* UI */
    --clippy-shadow: rgba(0, 0, 0, 0.15);
    --clippy-radius: 16px;
    --clippy-transition: all 0.3s ease;
}

/* ============================================================================
   CLIPPY BUTTON
   ============================================================================ */
.clippy-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--fox-beige) 0%, #e8d9c8 100%);
    border: 3px solid var(--clippy-secondary);
    cursor: pointer;
    box-shadow: 0 4px 20px var(--clippy-shadow);
    transition: var(--clippy-transition);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    padding: 8px;
}

.clippy-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(232, 111, 44, 0.4);
}

.clippy-button:hover .foxy-svg {
    animation: fox-excited 0.4s ease-in-out infinite;
}

.clippy-button:active {
    transform: scale(0.95);
}

/* ============================================================================
   FOXY SVG ANIMATIONEN
   ============================================================================ */
.foxy-svg {
    width: 100%;
    height: 100%;
    animation: fox-idle var(--foxy-idle-speed) ease-in-out infinite;
    animation-play-state: var(--foxy-idle-animation);
}

.foxy-svg-small {
    width: 40px;
    height: 40px;
    animation: fox-idle var(--foxy-idle-speed) ease-in-out infinite;
    animation-play-state: var(--foxy-idle-animation);
}

.foxy-svg-mini {
    animation: thinking-wiggle 0.8s ease-in-out infinite;
}

/* Idle - sanftes Atmen/Schweben */
@keyframes fox-idle {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.02); }
}

/* Excited - bei Hover */
@keyframes fox-excited {
    0%, 100% { transform: rotate(-3deg) scale(1.05); }
    50% { transform: rotate(3deg) scale(1.08); }
}

/* ============================================================================
   OHREN ANIMATION
   ============================================================================ */
.fox-ear {
    transform-origin: center bottom;
    animation: ear-twitch var(--foxy-ear-speed) ease-in-out infinite;
    animation-play-state: var(--foxy-ear-animation);
}

.fox-ear-right {
    animation-delay: 0.3s;
}

@keyframes ear-twitch {
    0%, 85%, 100% { transform: rotate(0deg); }
    88% { transform: rotate(-12deg); }
    91% { transform: rotate(8deg); }
    94% { transform: rotate(-5deg); }
    97% { transform: rotate(3deg); }
}

/* ============================================================================
   AUGEN ANIMATION - Blinzeln
   ============================================================================ */
.fox-eye {
    transform-origin: center;
    animation: eye-blink var(--foxy-eye-speed) ease-in-out infinite;
    animation-play-state: var(--foxy-eye-animation);
}

.fox-eye-right {
    animation-delay: 0.1s;
}

@keyframes eye-blink {
    0%, 42%, 58%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.1); }
}

/* ============================================================================
   NASE ANIMATION - Wackeln
   ============================================================================ */
.fox-nose {
    transform-origin: center;
    animation: nose-wiggle var(--foxy-nose-speed) ease-in-out infinite;
    animation-play-state: var(--foxy-nose-animation);
}

@keyframes nose-wiggle {
    0%, 80%, 100% { transform: scale(1) translateY(0); }
    85% { transform: scale(1.15) translateY(-1px); }
    90% { transform: scale(0.95) translateY(1px); }
    95% { transform: scale(1.05); }
}

/* Typing Wiggle */
@keyframes thinking-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

/* ============================================================================
   NOTIFICATION BADGE
   ============================================================================ */
.clippy-button .clippy-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: var(--clippy-secondary);
    border: 2px solid white;
    border-radius: 50%;
    font-size: 11px;
    color: var(--clippy-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: badge-pulse 1.5s ease-in-out infinite;
    z-index: 10;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============================================================================
   CHAT WINDOW
   ============================================================================ */
.clippy-window {
    position: fixed;
    bottom: 120px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 48px);
    height: 480px;
    max-height: calc(100vh - 160px);
    background: var(--clippy-white);
    border-radius: var(--clippy-radius);
    box-shadow: 0 8px 40px var(--clippy-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: var(--clippy-transition);
    border: 2px solid var(--fox-dark-blue);
}

.clippy-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ============================================================================
   CHAT HEADER
   ============================================================================ */
.clippy-header {
    background: linear-gradient(135deg, var(--fox-dark-blue) 0%, #2d5470 100%);
    color: var(--clippy-white);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.clippy-avatar {
    width: 48px;
    height: 48px;
    background: var(--fox-beige);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--clippy-secondary);
    padding: 4px;
}

.clippy-info {
    flex: 1;
}

.clippy-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.clippy-status {
    font-size: 12px;
    opacity: 0.9;
    margin: 2px 0 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clippy-status-dot {
    width: 8px;
    height: 8px;
    background: var(--clippy-secondary);
    border-radius: 50%;
    animation: status-glow 2s ease-in-out infinite;
}

@keyframes status-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(67, 210, 64, 0.6); }
    50% { box-shadow: 0 0 0 4px rgba(67, 210, 64, 0); }
}

.clippy-status-dot.offline {
    background: #FF6B6B;
    animation: none;
}

.clippy-close {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--clippy-transition);
}

.clippy-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* ============================================================================
   CHAT MESSAGES
   ============================================================================ */
.clippy-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, var(--fox-cream) 0%, #fff 100%);
}

.clippy-messages::-webkit-scrollbar {
    width: 5px;
}

.clippy-messages::-webkit-scrollbar-thumb {
    background: var(--clippy-secondary);
    border-radius: 3px;
}

.clippy-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    animation: message-pop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes message-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.clippy-message.bot {
    background: var(--clippy-white);
    color: var(--fox-dark-blue);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 3px solid var(--fox-orange);
}

.clippy-message.user {
    background: linear-gradient(135deg, var(--clippy-secondary) 0%, var(--clippy-primary) 100%);
    color: var(--clippy-white);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ============================================================================
   TYPING INDICATOR
   ============================================================================ */
.clippy-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--clippy-white);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 3px solid var(--fox-orange);
}

.clippy-typing-avatar {
    width: 28px;
    height: 28px;
}

.clippy-typing-dots {
    display: flex;
    gap: 4px;
}

.clippy-typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--fox-orange);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.clippy-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.clippy-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* ============================================================================
   QUICK ACTIONS
   ============================================================================ */
.clippy-quick-actions {
    padding: 10px 14px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: var(--fox-beige);
    border-top: 1px solid #e8ddd0;
}

.clippy-quick-btn {
    padding: 6px 12px;
    background: var(--clippy-white);
    border: 1px solid #d4c4b0;
    border-radius: 16px;
    font-size: 12px;
    color: var(--fox-dark-blue);
    cursor: pointer;
    transition: var(--clippy-transition);
}

.clippy-quick-btn:hover {
    background: var(--fox-orange);
    color: white;
    border-color: var(--fox-orange);
}

.clippy-quick-btn::before { font-size: 12px; margin-right: 4px; }
.clippy-quick-btn.joke::before { content: "😄"; }
.clippy-quick-btn.cheer::before { content: "💪"; }
.clippy-quick-btn.tip::before { content: "💡"; }
.clippy-quick-btn.hi::before { content: "👋"; }

/* ============================================================================
   INPUT AREA
   ============================================================================ */
.clippy-input-area {
    padding: 12px 14px;
    background: var(--clippy-white);
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: center;
}

.clippy-input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: var(--clippy-transition);
}

.clippy-input:focus {
    border-color: var(--clippy-secondary);
    box-shadow: 0 0 0 3px rgba(67, 210, 64, 0.15);
}

.clippy-send {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--clippy-secondary) 0%, var(--clippy-primary) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--clippy-transition);
}

.clippy-send:hover {
    transform: scale(1.08);
}

.clippy-send svg {
    width: 18px;
    height: 18px;
}

/* ============================================================================
   MOBILE
   ============================================================================ */
@media (max-width: 480px) {
    .clippy-button {
        width: 70px;
        height: 70px;
        bottom: 16px;
        right: 16px;
    }
    
    .clippy-window {
        bottom: 100px;
        right: 12px;
        left: 12px;
        width: auto;
    }
}


/* ============================================================================
   NEU v2.0: GEMMA AI FEATURES
   ============================================================================ */

/* AI Mode Badge im Header */
.clippy-ai-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 8px;
}

.clippy-ai-badge.ai-active {
    background: linear-gradient(135deg, #43D240, #2ea82e);
    color: white;
    box-shadow: 0 2px 8px rgba(67, 210, 64, 0.4);
}

.clippy-ai-badge.ai-inactive {
    background: #f0f0f0;
    color: #666;
}

.clippy-ai-badge:hover {
    transform: scale(1.05);
}

.ai-badge-icon {
    font-size: 1rem;
}

/* Gemma Quick-Action Buttons */
.clippy-quick-btn.gemma-btn {
    background: linear-gradient(135deg, #43D240, #2ea82e);
    color: white;
    border: none;
    animation: pulse-glow 2s ease-in-out infinite;
}

.clippy-quick-btn.gemma-btn:hover {
    background: linear-gradient(135deg, #2ea82e, #1e8e1e);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 210, 64, 0.4);
}

.clippy-quick-btn.hint {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
}

.clippy-quick-btn.hint:hover {
    background: linear-gradient(135deg, #FFA500, #FF8C00);
}

.clippy-quick-btn.explain {
    background: linear-gradient(135deg, #9370DB, #8A2BE2);
    color: white;
}

.clippy-quick-btn.explain:hover {
    background: linear-gradient(135deg, #8A2BE2, #7B68EE);
}

/* Typing Indicator mit Custom Text */
.clippy-typing-text {
    margin-left: 8px;
    font-size: 0.75rem;
    color: var(--clippy-primary);
    font-style: italic;
}

/* System Messages */
.clippy-message.system {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
    font-size: 0.8rem;
    text-align: center;
    border-radius: 8px;
    padding: 6px 12px;
    margin: 4px auto;
    max-width: 80%;
}

/* Pulse Animation für Gemma-Buttons */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(67, 210, 64, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(67, 210, 64, 0);
    }
}

/* AI Loading Animation */
.clippy-ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
    border-radius: 12px;
    margin: 8px 0;
}

.clippy-ai-loading .brain-icon {
    animation: brain-pulse 1s ease-in-out infinite;
}

@keyframes brain-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Responsive für neue Features */
@media (max-width: 480px) {
    .clippy-ai-badge {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
    
    .clippy-quick-btn.gemma-btn {
        font-size: 0.7rem;
        padding: 5px 8px;
    }
}
