/**
 * KATI HUKUK - AI Chat Widget Styles
 * Modern ve Profesyonel Chat Widget CSS
 */

/* Reset ve Base Styles */
.kati-chat-widget,
.kati-chat-widget *,
.kati-chat-widget *::before,
.kati-chat-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.kati-chat-widget {
    position: fixed;
    bottom: 20px ;
    right: 45px;
    z-index: 1050;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    direction: ltr;
    touch-action: manipulation;
}

/* Chat Toggle Button */
.kati-chat-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #BC0927, #000000);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.kati-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.4);
}

.kati-chat-toggle.active {
    background: linear-gradient(135deg, #000000, #BC0927);
}

.toggle-icon {
    position: relative;
    width: 24px;
    height: 24px;
}

.toggle-icon i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: white;
    transition: all 0.3s ease;
}

.toggle-icon .fa-times {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg);
}

.kati-chat-toggle.active .toggle-icon .fa-comments {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-90deg);
}

.kati-chat-toggle.active .toggle-icon .fa-times {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid white;
}

.notification-badge.show {
    display: flex;
}

/* Welcome Bubble */
.kati-welcome-bubble {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.kati-welcome-bubble.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bubble-content {
    display: flex;
    padding: 16px;
    gap: 12px;
}

.bubble-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #BC0927, #000000);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bubble-avatar i {
    color: white;
    font-size: 16px;
}

.bubble-text {
    flex: 1;
}

.bubble-text strong {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 4px;
}

.bubble-text span {
    color: #666;
    font-size: 13px;
}

.bubble-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bubble-close:hover {
    color: #333;
}

/* Chat Window */
.kati-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    will-change: opacity, visibility, transform;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.kati-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Chat Header */
.kati-chat-header {
    background: linear-gradient(135deg, #2F2F2F, #1A1A1A);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-info .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #BC0927;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-info .avatar i {
    color: white;
    font-size: 18px;
}

.header-info .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-info .info h4 {
    color: white;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.header-info .status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #28a745;
    border-radius: 50%;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-actions button {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.header-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Chat Messages */
.kati-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    will-change: scroll-position;
}

.kati-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.kati-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

/* Chat Message */
.chat-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-message.user .message-avatar {
    background: #6c757d;
    color: white;
    font-size: 12px;
}

.chat-message.assistant .message-avatar {
    background: linear-gradient(135deg, #BC0927, #000000);
    color: white;
    font-size: 12px;
}

.message-content {
    flex: 1;
    max-width: 250px;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #BC0927, #000000);
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.chat-message.assistant .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.message-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #999;
    display: flex;
    gap: 8px;
}

.chat-message.user .message-meta {
    justify-content: flex-end;
}

.message-meta .mode {
    background: rgba(255, 255, 255, 0.1);
    color: #BC0927;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
}

/* Typing Indicator */
.kati-typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.kati-typing-indicator.show {
    display: flex;
}

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

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #BC0927;
    animation: typing 1.4s ease-in-out infinite;
}

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

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

.typing-text {
    color: #666;
    font-size: 12px;
    font-style: italic;
}

/* Chat Input */
.kati-chat-input {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 12px 16px;
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 20px;
    padding: 6px 8px 6px 12px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.3);
    background: white;
}

#kati-message-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    min-height: 18px;
    max-height: 80px;
    padding: 6px 0;
}

#kati-message-input::placeholder {
    color: #999;
}

.send-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: linear-gradient(135deg, #BC0927, #000000);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #e9ecef;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    margin-top: 6px;
    text-align: center;
}

.input-footer small {
    color: #999;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.input-footer i {
    color: #28a745;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .kati-chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .kati-chat-window {
        width: calc(100vw - 30px);
        max-width: 350px;
        height: 70vh;
        max-height: 500px;
        bottom: 75px;
        right: 0;
    }
    
    .kati-welcome-bubble {
        width: calc(100vw - 30px);
        max-width: 300px;
    }
    
    .kati-chat-toggle {
        width: 56px;
        height: 56px;
        touch-action: manipulation;
    }
    
    .message-content {
        max-width: calc(100vw - 120px);
    }
}

@media (max-width: 576px) {
    .kati-chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .kati-chat-window {
        width: calc(100vw - 20px);
        height: 60vh;
        max-height: 400px;
    }
    
    .kati-chat-toggle {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 480px) {
    .kati-chat-toggle {
        width: 54px;
        height: 54px;
    }
    
    .toggle-icon i {
        font-size: 18px;
    }
    
    .kati-chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        right: 8px;
        bottom: 70px;
    }
}

/* Animations */
@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* Utility */
.kati-chat-widget a {
    color: #BC0927;
    text-decoration: none;
}

.kati-chat-widget a:hover {
    text-decoration: underline;
}