/**
 * Skippie - The Rusty Paperclip Loading Companion
 * ================================================
 *
 * A half-corroded, vintage paperclip character that appears
 * during AI Discussion loading states. Features rust effects,
 * blinking eyes, and personality-driven animations.
 */

/* ============================================
   CONTAINER & POSITIONING
   ============================================ */

.skippie-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.skippie-container.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ============================================
   CHARACTER STYLING
   ============================================ */

.skippie-character {
    width: 80px;
    height: 120px;
    position: relative;
    cursor: pointer;
    filter: sepia(0.3) saturate(0.8);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.skippie-character:hover {
    transform: scale(1.05);
    filter: sepia(0.2) saturate(1);
}

.skippie-character svg {
    width: 100%;
    height: 100%;
}

/* Paperclip body - aged metal look */
.skippie-body {
    fill: none;
    stroke: #8B7355;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: url(#rustFilter);
}

/* Eyes container */
.skippie-eyes {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.skippie-eye {
    width: 12px;
    height: 12px;
    background: #2D1B0E;
    border-radius: 50%;
    position: relative;
    animation: blink 8s infinite;
}

.skippie-eye::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes blink {
    0%, 96%, 100% { transform: scaleY(1); }
    98% { transform: scaleY(0.1); }
}

@keyframes wobble {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

@keyframes fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(60px) rotate(180deg);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes panic {
    0%, 100% { transform: rotate(-5deg) scale(1); }
    25% { transform: rotate(5deg) scale(1.02); }
    50% { transform: rotate(-5deg) scale(1); }
    75% { transform: rotate(5deg) scale(0.98); }
}

@keyframes proud-glow {
    0%, 100% { filter: sepia(0.1) saturate(1.2) brightness(1); }
    50% { filter: sepia(0) saturate(1.5) brightness(1.1); }
}

/* ============================================
   MOOD STATES
   ============================================ */

/* Normal - gentle wobble */
.skippie-character.normal {
    animation: wobble 4s ease-in-out infinite;
}

/* Panicking - fast shake */
.skippie-character.panicking {
    animation: panic 0.5s ease-in-out infinite;
}

.skippie-character.panicking .skippie-eye {
    animation: blink 0.5s infinite;
}

/* Proud - glowing */
.skippie-character.proud {
    animation: proud-glow 2s ease-in-out infinite;
    filter: sepia(0) saturate(1.3);
}

.skippie-character.proud .skippie-eye::after {
    background: #FFD700;
    width: 5px;
    height: 5px;
}

/* ============================================
   SPEECH BUBBLE
   ============================================ */

.skippie-bubble {
    background: linear-gradient(135deg, #FFF8DC 0%, #F5DEB3 100%);
    border: 2px solid #8B7355;
    border-radius: 15px;
    padding: 12px 16px;
    max-width: 220px;
    font-family: 'Comic Sans MS', 'Segoe UI', sans-serif;
    font-size: 13px;
    color: #4A3728;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.2);
    position: relative;
    animation: bounce 3s ease-in-out infinite;
}

.skippie-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #F5DEB3;
}

.skippie-bubble::before {
    content: '';
    position: absolute;
    bottom: -13px;
    right: 18px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #8B7355;
}

.skippie-message {
    margin-bottom: 10px;
    line-height: 1.4;
}

/* ============================================
   BUTTONS
   ============================================ */

.skippie-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.skippie-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #8B7355;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.skippie-btn-oom {
    background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
    color: white;
}

.skippie-btn-oom:hover {
    background: linear-gradient(135deg, #4682B4 0%, #1E90FF 100%);
    transform: scale(1.05);
}

.skippie-btn-patience {
    background: linear-gradient(135deg, #98FB98 0%, #228B22 100%);
    color: white;
}

.skippie-btn-patience:hover {
    background: linear-gradient(135deg, #228B22 0%, #006400 100%);
    transform: scale(1.05);
}

/* ============================================
   RUST FLAKES (Particle Effects)
   ============================================ */

.skippie-flakes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.skippie-flake {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #8B4513;
    border-radius: 50%;
    opacity: 0.7;
    animation: fall 2s ease-in forwards;
}

.skippie-flake:nth-child(odd) {
    background: #A0522D;
    animation-duration: 2.5s;
}

.skippie-flake:nth-child(3n) {
    width: 4px;
    height: 4px;
    background: #CD853F;
    animation-duration: 1.8s;
}

/* ============================================
   OOM RESPONSE OVERLAY
   ============================================ */

.skippie-oom-response {
    background: linear-gradient(135deg, #F0E68C 0%, #DAA520 100%);
    border: 2px solid #B8860B;
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: #4A3728;
    max-width: 220px;
    max-height: 150px;
    overflow-y: auto;
    animation: bounce 0.5s ease;
}

.skippie-oom-response::before {
    content: '- Oom zegt:';
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: #8B4513;
}

/* ============================================
   DARK MODE
   ============================================ */

.dark .skippie-character,
[data-theme="dark"] .skippie-character {
    filter: sepia(0.2) saturate(0.9) brightness(0.85);
}

.dark .skippie-bubble,
[data-theme="dark"] .skippie-bubble {
    background: linear-gradient(135deg, #3A3A3A 0%, #2A2A2A 100%);
    border-color: #5A4A3A;
    color: #D4C4B4;
}

.dark .skippie-bubble::after,
[data-theme="dark"] .skippie-bubble::after {
    border-top-color: #2A2A2A;
}

.dark .skippie-bubble::before,
[data-theme="dark"] .skippie-bubble::before {
    border-top-color: #5A4A3A;
}

.dark .skippie-oom-response,
[data-theme="dark"] .skippie-oom-response {
    background: linear-gradient(135deg, #4A4A3A 0%, #3A3A2A 100%);
    border-color: #6A5A4A;
    color: #E4D4C4;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .skippie-container {
        bottom: 10px;
        right: 10px;
    }

    .skippie-character {
        width: 60px;
        height: 90px;
    }

    .skippie-bubble {
        max-width: 180px;
        font-size: 12px;
        padding: 10px 12px;
    }

    .skippie-btn {
        padding: 5px 10px;
        font-size: 10px;
    }
}

/* ============================================
   HIDE STATE
   ============================================ */

.skippie-container.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    pointer-events: none;
}
