:root {
    --primary: #4cc9f0;
    --secondary: #4895ef;
    --accent: #f72585;
    --bg-light: #f8f9fa;
    --text: #2b2d42;
    --bot-bg: #e9ecef;
    --user-bg: #4cc9f0;
    --glass: rgba(255, 255, 255, 0.8);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Fredoka', sans-serif;
}


/* Chatbot Container */
#chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: 'Fredoka', sans-serif;
    font-size: 16px;
    /* Bootstrap'in 10px etkisini kırmak için base font */
}

#chatbot-button {
    cursor: pointer;
    position: relative;
    touch-action: manipulation;
}

.character-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4cc9f0, #4895ef);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(76, 201, 240, 0.4);
    border: 4px solid white;
    transition: transform 0.3s;
}

#chatbot-button:hover .character-circle {
    transform: scale(1.1);
}

/* --- OWL CHARACTER DESIGN --- */
.character-face {
    position: relative;
    width: 60px;
    height: 60px;
    background: #795548;
    /* Owl Brown */
    border-radius: 50% 50% 45% 45%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
    box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.1);
}

/* Owl Ears/Tufts */
.character-face::before,
.character-face::after {
    content: '';
    position: absolute;
    top: -5px;
    width: 20px;
    height: 25px;
    background: #5d4037;
    border-radius: 50% 50% 0 0;
}

.character-face::before {
    left: 5px;
    transform: rotate(-30deg);
}

.character-face::after {
    right: 5px;
    transform: rotate(30deg);
}

/* Owl Eyes Container */
.eyes {
    display: flex;
    gap: 8px;
    z-index: 2;
}

.eye {
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    animation: blink 4s infinite;
}

.eye::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
    top: 5px;
    left: 5px;
}

/* Owl Glasses */
.glasses {
    position: absolute;
    width: 52px;
    height: 22px;
    top: 18px;
    display: flex;
    justify-content: space-between;
    z-index: 3;
    pointer-events: none;
}

.glass-frame {
    width: 24px;
    height: 24px;
    border: 2px solid #FFD700;
    /* Golden Glasses */
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.glass-bridge {
    position: absolute;
    width: 10px;
    height: 2px;
    background: #FFD700;
    top: 11px;
    left: 21px;
}

/* Owl Beak */
.beak {
    position: absolute;
    top: 38px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #FF9800;
    z-index: 4;
}

/* Wings */
.wing {
    position: absolute;
    width: 20px;
    height: 35px;
    background: #5d4037;
    top: 20px;
    z-index: 1;
    border-radius: 50%;
}

.wing.left {
    left: -10px;
    transform: rotate(-20deg);
    animation: flapLeft 3s ease-in-out infinite;
}

.wing.right {
    right: -10px;
    transform: rotate(20deg);
    animation: flapRight 3s ease-in-out infinite;
}

/* Animations */
@keyframes blink {

    90%,
    100% {
        transform: scaleY(1);
    }

    95% {
        transform: scaleY(0.1);
    }
}

.notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border: 2px solid white;
}

.chatbot-hint {
    position: absolute;
    right: 95px;
    bottom: 20px;
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    font-size: 14.5px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s;
}

/* Chat Window */
#chatbot-window {
    position: absolute;
    bottom: 100px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    /* Mobilde ekrandan taşmasını önle */
    max-height: 500px;
    height: 70vh;
    background: white;
    border-radius: 25px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.3s;
}

#chatbot-window.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.chat-header {
    background: linear-gradient(to right, #4cc9f0, #4895ef);
    padding: 1rem 1.2rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    transition: background 0.5s ease;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    display: flex;
    gap: 5px;
}

.color-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-dot:hover {
    transform: scale(1.3);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.small-char {
    font-size: 24px;
}

#close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

#chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: var(--bot-bg);
    color: var(--text);
    border-bottom-left-radius: 2px;
}

.message.user {
    align-self: flex-end;
    background: var(--user-bg);
    color: white;
    border-bottom-right-radius: 2px;
}

/* Speaker Button in Messages */
.speak-btn {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.8;
    cursor: pointer;
    padding: 10px;
    /* Mobilde dokunmayı kolaylaştırmak için büyütüldü */
    margin-left: 5px;
    vertical-align: middle;
    transition: opacity 0.2s, transform 0.2s;
    position: relative;
    z-index: 10;
    touch-action: manipulation;
}

.speak-btn:active {
    transform: scale(0.9);
}

.speak-btn:hover {
    opacity: 1;
}

.speak-btn svg {
    width: 16px;
    height: 16px;
}

/* Suggestion Chips */
#suggestion-container {
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid #f1f5f9;
    background: #fff;
    scrollbar-width: none;
}

#suggestion-container::-webkit-scrollbar {
    display: none;
}

.suggestion-chip {
    background: #f1f5f9;
    color: #475569;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13.5px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.suggestion-chip:hover {
    background: #e2e8f0;
    border-color: var(--primary);
    color: var(--primary);
}

.suggestions-hidden {
    display: none !important;
}

.chat-input-area {
    padding: 1rem;
    display: flex;
    gap: 10px;
    border-top: 1px solid #eee;
}

#user-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: 'Fredoka', sans-serif;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #f8fafc;
    color: var(--text);
}

#user-input::placeholder {
    color: #94a3b8;
}

#user-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.15);
    background: #fff;
}

#mic-btn {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    touch-action: manipulation;
}

#mic-btn.recording {
    background: #ffe4e6;
    color: #e11d48;
    animation: pulseMic 1.5s infinite;
}

#mic-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
    /* SVG'nin tıklamayı yutmasını önle */
}

@keyframes pulseMic {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(225, 29, 72, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(225, 29, 72, 0);
    }
}

#send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    touch-action: manipulation;
}

#send-btn:hover {
    background: var(--secondary);
}

#send-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
    /* SVG'nin tıklamayı yutmasını önle */
}

.bounce {
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Redirect Suggestion Styles */
.suggestion-btn {
    background: #4895ef;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 10px;
    margin-top: 8px;
    cursor: pointer;
    font-size: 13.5px;
    display: block;
    width: fit-content;
    transition: opacity 0.3s;
}

.typing {
    font-style: italic;
    font-weight: bold;
    letter-spacing: 2px;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Floating Hearts */
.heart {
    position: fixed;
    font-size: 20px;
    color: #f72585;
    pointer-events: none;
    z-index: 2000;
    animation: flyUp 2s ease-out forwards;
}

@keyframes flyUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) scale(1.5);
        opacity: 0;
    }
}

/* Character Jumping */
.jump {
    animation: jumpOnce 0.5s ease;
}

@keyframes jumpOnce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-30px);
    }
}

/* ===== ÖZELLİK 3: Tık Tık Karakter Animasyonları ===== */

/* Baykuş konuşma animasyonu - gaga hafifçe açılır */
.character-face.talking .beak {
    animation: beakTalk 0.25s ease-in-out infinite alternate;
}

@keyframes beakTalk {
    from {
        transform: scaleY(1);
    }

    to {
        transform: scaleY(1.6) translateY(1px);
    }
}

/* Baykuş düşünüyor - başı bir yana eğilir */
.character-face.thinking {
    animation: owlThink 0.6s ease-in-out infinite alternate;
}

@keyframes owlThink {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(-12deg);
    }
}

/* Düşünme balonu - baykuşun üstünde */
.think-bubble {
    position: absolute;
    top: -28px;
    right: -10px;
    font-size: 14px;
    animation: bubblePop 0.4s ease-out;
    pointer-events: none;
    z-index: 10;
}

@keyframes bubblePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    70% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Baykuş mutlu - zıplama + büyüme */
.character-face.happy {
    animation: owlHappy 0.5s ease-in-out;
}

@keyframes owlHappy {
    0% {
        transform: scale(1) rotate(0deg);
    }

    30% {
        transform: scale(1.15) rotate(5deg);
    }

    60% {
        transform: scale(1.15) rotate(-5deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* ===== ÖZELLİK 4: Rozetler ===== */
.badge-counter {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.badge-counter:hover {
    background: rgba(255, 255, 255, 0.35);
}

.badge-popup {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    pointer-events: none;
}

.badge-popup.hidden {
    display: none;
}

.badge-popup.show {
    display: block;
    animation: badgeSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgeSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(30px) scale(0.7);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.badge-popup-content {
    background: linear-gradient(135deg, #FFD700, #FF8C00);
    border-radius: 20px;
    padding: 16px 28px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(255, 165, 0, 0.45);
    color: white;
}

.badge-popup-icon {
    font-size: 35px;
}

.badge-popup-title {
    font-weight: 700;
    font-size: 16px;
    margin-top: 4px;
}

.badge-popup-name {
    font-size: 13.5px;
    opacity: 0.9;
    margin-top: 2px;
}

/* ===== ÖZELLİK 5: Mikrofon Teşvik Tooltip ===== */
.mic-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.mic-tooltip {
    position: absolute;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    background: #2b2d42;
    color: white;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.18);
}

.mic-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2b2d42;
}

.mic-tooltip.visible {
    opacity: 1;
}

/* ===== ÖZELLİK 8: Gelişmiş Yazıyor Animasyonu ===== */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px !important;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: dotBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.18s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.36s;
}

@keyframes dotBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        background: #94a3b8;
    }

    30% {
        transform: translateY(-7px);
        background: var(--primary);
    }
}

/* Fuzzy eşleşme vurgusu */
.fuzzy-note {
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
    margin-top: 4px;
    display: block;
}

/* Mobil için ek düzenlemeler */
@media (max-width: 480px) {
    #chatbot-window {
        bottom: 90px;
        right: -10px;
        width: calc(100vw - 40px);
        height: 80vh;
        border-radius: 20px;
    }

    .chat-input-area {
        padding: 12px 10px;
    }

    #user-input {
        font-size: 16px;
        /* Mobilde focus olunca zoom yapmaması için en az 16px */
    }
}