/**
 * CevapBot Web Widget Styles
 */

:root {
    --cevapbot-primary-color: #007bff;
    --cevapbot-bg-color: #ffffff;
    --cevapbot-text-color: #333333;
    --cevapbot-border-color: #e0e0e0;
    --cevapbot-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --cevapbot-border-radius: 12px;
}

#cevapbot-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cevapbot-text-color);
    z-index: 9999;
}

/* Chat Button Wrapper */
.cevapbot-chat-button-wrapper {
    position: fixed;
    z-index: 10000;
}

/* Chat Button */
.cevapbot-chat-button {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--cevapbot-primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--cevapbot-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.cevapbot-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.cevapbot-chat-button svg {
    width: 24px;
    height: 24px;
}

/* Badge */
.cevapbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 2px 6px;
    background-color: #ef4444;
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10001;
}

.cevapbot-badge-pulse {
    animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
    }
}

/* Position Classes */
.cevapbot-position-bottom-right .cevapbot-chat-button-wrapper {
    bottom: 20px;
    right: 20px;
}

.cevapbot-position-bottom-left .cevapbot-chat-button-wrapper {
    bottom: 20px;
    left: 20px;
}

.cevapbot-position-top-right .cevapbot-chat-button-wrapper {
    top: 20px;
    right: 20px;
}

.cevapbot-position-top-left .cevapbot-chat-button-wrapper {
    top: 20px;
    left: 20px;
}

.cevapbot-position-bottom-right .cevapbot-chat-window {
    bottom: 90px;
    right: 20px;
}

.cevapbot-position-bottom-left .cevapbot-chat-window {
    bottom: 90px;
    left: 20px;
}

.cevapbot-position-top-right .cevapbot-chat-window {
    top: 90px;
    right: 20px;
}

.cevapbot-position-top-left .cevapbot-chat-window {
    top: 90px;
    left: 20px;
}

/* Chat Window */
.cevapbot-chat-window {
    position: fixed;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background-color: var(--cevapbot-bg-color);
    border-radius: var(--cevapbot-border-radius);
    box-shadow: var(--cevapbot-shadow);
    display: flex;
    flex-direction: column;
    z-index: 10001;
}

.cevapbot-hidden {
    display: none !important;
}

/* Chat Header */
.cevapbot-chat-header {
    background-color: var(--cevapbot-primary-color);
    color: white;
    padding: 16px 20px;
    border-radius: var(--cevapbot-border-radius) var(--cevapbot-border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cevapbot-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.cevapbot-close-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.cevapbot-close-button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.cevapbot-close-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
.cevapbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cevapbot-message {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    white-space: pre-wrap; /* Satır sonlarını koru */
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cevapbot-message-user {
    align-self: flex-end;
    background-color: var(--cevapbot-primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.cevapbot-message-bot {
    align-self: flex-start;
    background-color: #f1f1f1;
    color: var(--cevapbot-text-color);
    border-bottom-left-radius: 4px;
}

/* Chat Input Container */
.cevapbot-chat-input-container {
    padding: 16px;
    border-top: 1px solid var(--cevapbot-border-color);
    display: flex;
    gap: 8px;
    align-items: center;
}

.cevapbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--cevapbot-border-color);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.cevapbot-input:focus {
    border-color: var(--cevapbot-primary-color);
}

.cevapbot-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--cevapbot-primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
}

.cevapbot-send-button:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

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

.cevapbot-send-button svg {
    width: 20px;
    height: 20px;
}

/* Error Message */
.cevapbot-error {
    background-color: #fee;
    color: #c33;
    padding: 10px 14px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 13px;
    border-left: 3px solid #c33;
}

/* Scrollbar Styling */
.cevapbot-messages::-webkit-scrollbar {
    width: 6px;
}

.cevapbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cevapbot-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.cevapbot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive - Tablet ve Mobil */
@media (max-width: 768px) {
    .cevapbot-chat-window {
        width: calc(100vw - 20px);
        max-width: 100%;
        /* Fallback for browsers that don't support dvh */
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }

    /* Use dynamic viewport height if supported */
    @supports (height: 100dvh) {
        .cevapbot-chat-window {
            height: calc(100dvh - 100px);
            max-height: calc(100dvh - 100px);
        }
    }

    .cevapbot-position-bottom-right .cevapbot-chat-window,
    .cevapbot-position-bottom-left .cevapbot-chat-window {
        bottom: 90px;
        left: 10px;
        right: 10px;
        width: calc(100vw - 20px);
    }

    .cevapbot-position-top-right .cevapbot-chat-window,
    .cevapbot-position-top-left .cevapbot-chat-window {
        top: 90px;
        left: 10px;
        right: 10px;
        width: calc(100vw - 20px);
    }

    .cevapbot-messages {
        padding: 16px;
    }

    .cevapbot-chat-header {
        padding: 14px 16px;
    }

    .cevapbot-chat-header h3 {
        font-size: 16px;
    }

    .cevapbot-chat-input-container {
        padding: 12px;
    }
}

/* Responsive - Küçük Mobil Cihazlar */
@media (max-width: 480px) {
    .cevapbot-chat-button {
        width: 56px;
        height: 56px;
    }

    .cevapbot-chat-button svg {
        width: 22px;
        height: 22px;
    }

    .cevapbot-position-bottom-right .cevapbot-chat-button-wrapper {
        bottom: 16px;
        right: 16px;
    }

    .cevapbot-position-bottom-left .cevapbot-chat-button-wrapper {
        bottom: 16px;
        left: 16px;
    }

    .cevapbot-position-top-right .cevapbot-chat-button-wrapper {
        top: 16px;
        right: 16px;
    }

    .cevapbot-position-top-left .cevapbot-chat-button-wrapper {
        top: 16px;
        left: 16px;
    }

    .cevapbot-chat-window {
        width: calc(100vw - 16px);
        /* Fallback for browsers that don't support dvh */
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        border-radius: 16px 16px 0 0;
    }

    /* Use dynamic viewport height if supported */
    @supports (height: 100dvh) {
        .cevapbot-chat-window {
            height: calc(100dvh - 80px);
            max-height: calc(100dvh - 80px);
        }
    }

    .cevapbot-position-bottom-right .cevapbot-chat-window,
    .cevapbot-position-bottom-left .cevapbot-chat-window {
        bottom: 80px;
        left: 8px;
        right: 8px;
        width: calc(100vw - 16px);
    }

    .cevapbot-position-top-right .cevapbot-chat-window,
    .cevapbot-position-top-left .cevapbot-chat-window {
        top: 80px;
        left: 8px;
        right: 8px;
        width: calc(100vw - 16px);
    }

    .cevapbot-messages {
        padding: 12px;
    }

    .cevapbot-message {
        max-width: 85%;
        font-size: 13px;
    }

    .cevapbot-input {
        padding: 10px 14px;
        font-size: 13px;
    }

    .cevapbot-send-button {
        width: 36px;
        height: 36px;
    }

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

