/* ===========================
   CHATBOT CONTAINER & LAYOUT
   =========================== */
:root {
    --chat-bg: #0a0a0a;
    --chat-header-bg: #111111;
    --chat-border: rgba(255, 255, 255, 0.1);
    --chat-text: #ffffff;
    --chat-accent: #ffffff;
    --chat-user-msg: #ffffff;
    --chat-user-text: #000000;
    --chat-bot-msg: rgba(255, 255, 255, 0.08);
    --chat-bot-text: #ffffff;
    --chat-input-bg: #1a1a1a;
}

.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100010; /* Above header (100000-100003) */
    font-family: 'Outfit', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Mobile specific positioning */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 20px !important;
        right: 20px !important;
        z-index: 100010 !important; /* Must be above header! */
    }
}

/* Force cursor visibility for all children */
.chatbot-container * {
    cursor: auto;
}
.chatbot-container button,
.chatbot-container a {
    cursor: pointer;
}

/* ===========================
   TOGGLE BUTTON
   =========================== */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ffffff;
    color: #000000;
    border: none;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-toggle.active {
    transform: rotate(90deg);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    transition: opacity 0.3s;
}

.chatbot-toggle .close-icon {
    position: absolute;
    opacity: 0;
}

.chatbot-toggle.active .chat-icon {
    opacity: 0;
}

.chatbot-toggle.active .close-icon {
    opacity: 1;
}

.chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff3b30;
    color: white;
    font-size: 11px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #000;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-5px);}
    60% {transform: translateY(-3px);}
}

/* ===========================
   CHAT WINDOW
   =========================== */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    padding: 16px 20px;
    background: var(--chat-header-bg);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(255,255,255,0.1);
}

.chatbot-avatar img {
    width: 36px;
    height: auto;
    object-fit: contain;
}

.chatbot-header-text h4 {
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.status-online {
    color: #4ade80;
    font-size: 12px;
}

.chatbot-minimize {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
}

.chatbot-minimize:hover {
    color: #fff;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    background: linear-gradient(to bottom, #0a0a0a, #0f0f0f);
}

/* Custom Scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
}

.bot-message {
    align-self: flex-start;
}

.bot-message .message-content {
    background: var(--chat-bot-msg);
    color: var(--chat-bot-text);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}

.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background: var(--chat-user-msg);
    color: var(--chat-user-text);
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    margin-top: 4px;
    margin-left: 4px;
}

.user-message .message-time {
    text-align: right;
    margin-right: 4px;
}

/* Chat Option Buttons (Conversational Flow) */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    animation: slideIn 0.4s ease;
}

.chat-option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    font-family: 'Outfit', sans-serif;
    position: relative;
    overflow: hidden;
}

.chat-option-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    transition: width 0.3s ease;
}

.chat-option-btn:hover:not(:disabled)::before {
    width: 100%;
}

.chat-option-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.chat-option-btn:active:not(:disabled) {
    transform: translateX(2px);
}

.chat-option-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Quick Replies (Legacy - keeping for backwards compatibility) */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-reply {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.quick-reply:hover {
    background: #fff;
    color: #000;
    transform: translateY(-2px);
}

/* Input Area */
.chatbot-input-wrapper {
    padding: 16px;
    background: var(--chat-header-bg);
    border-top: 1px solid var(--chat-border);
}

.chatbot-form {
    display: flex;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    background: var(--chat-input-bg);
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    padding: 12px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: rgba(255,255,255,0.3);
}

.chatbot-send {
    background: #fff;
    color: #000;
    border: none;
    width: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chatbot-send:hover {
    transform: scale(1.05);
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chat-bot-msg);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-bottom: 10px;
}

.chatbot-typing span {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
    opacity: 0.6;
}

.chatbot-typing span:nth-child(1) { animation-delay: 0s; }
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Mobile Responsive - PC GİBİ KÜÇÜK POPUP */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 15px !important;
        right: 15px !important;
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
        box-shadow: 0 6px 24px rgba(255, 255, 255, 0.25);
    }

    /* Mobilde de PC gibi sağ alt köşede küçük popup */
    .chatbot-window {
        position: absolute !important;
        bottom: 80px !important;
        right: 0 !important;
        left: auto !important;
        top: auto !important;
        width: 360px !important;
        max-width: calc(100vw - 30px) !important;
        height: 550px !important;
        max-height: calc(100vh - 120px) !important;
        border-radius: 20px !important;
        transform-origin: bottom right !important;
    }

    .chatbot-window.active {
        transform: translateY(0) scale(1) !important;
        opacity: 1 !important;
    }

    .chatbot-header {
        padding: 14px 16px !important;
    }

    .chatbot-messages {
        padding: 16px !important;
    }

    .chatbot-input-wrapper {
        padding: 14px !important;
    }

    .message-content {
        font-size: 14px !important;
        padding: 12px 15px !important;
        max-width: 85%;
    }

    .chat-option-btn {
        padding: 14px 16px !important;
        font-size: 14px !important;
    }
}
