/* ========================
   AI CHATBOT STYLES
   Modern, Glassmorphism Design
   ======================== */

.ai-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Floating Button */
.chat-toggle-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #001145 0%, #002966 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 17, 69, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chat-toggle-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-toggle-btn:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 17, 69, 0.6);
}

.chat-toggle-btn:hover::before {
    opacity: 1;
}

.chat-toggle-btn svg {
    width: 32px;
    height: 32px;
    fill: white;
    transition: transform 0.3s ease;
}

.chat-toggle-btn:hover svg {
    transform: rotate(10deg) scale(1.1);
}

/* Notification Pulse */
.chat-toggle-btn.has-notification::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ff4757;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-notification 2s infinite;
}

@keyframes pulse-notification {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 80px;
    right: 30px;
    width: 400px;
    max-height: calc(90vh - 80px); /* Masaüstü için geri getirildi */
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.chat-window.active {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #001145 0%, #002966 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: headerGlow 8s linear infinite;
}

@keyframes headerGlow {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    animation: pulse-status 2s infinite;
}

@keyframes pulse-status {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 17, 69, 0.2);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 17, 69, 0.3);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: #ffffff;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #001145 0%, #002966 100%);
    box-shadow: 0 4px 12px rgba(0, 17, 69, 0.3);
}

.message-content {
    max-width: 75%;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.message.bot .message-bubble {
    background: #ffffff;
    color: #2c3e50;
    border: 1px solid rgba(0, 17, 69, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #001145 0%, #002966 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 17, 69, 0.3);
}

.message-time {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 6px;
    display: block;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 12px;
    padding: 16px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.typing-indicator.active {
    opacity: 1;
    transform: translateY(0);
}

.typing-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 14px 18px;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(0, 17, 69, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #95a5a6;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-area {
    padding: 20px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 17, 69, 0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 24px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #001145;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 17, 69, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    padding: 8px;
    outline: none;
    color: #2c3e50;
}

.chat-input::placeholder {
    color: #95a5a6;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #001145 0%, #002966 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 17, 69, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* File Upload Styles */
.chat-file-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid rgba(0, 17, 69, 0.1);
    color: #001145;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-file-btn:hover {
    background: rgba(0, 17, 69, 0.05);
    border-color: #001145;
}

.chat-file-btn svg {
    width: 20px;
    height: 20px;
    fill: #001145;
}

.chat-image-preview {
    display: none;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    align-items: center;
    gap: 12px;
}

.chat-image-preview.active {
    display: flex;
}

.preview-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.preview-info {
    flex: 1;
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

.preview-close:hover {
    color: #ff4757;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
}

.welcome-message h4 {
    color: #001145;
    margin-bottom: 12px;
    font-size: 20px;
}

.welcome-message p {
    font-size: 14px;
    line-height: 1.6;
}

.quick-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.quick-question-btn {
    background: #ffffff;
    border: 2px solid rgba(0, 17, 69, 0.1);
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #001145;
    transition: all 0.3s ease;
    text-align: left;
}

.quick-question-btn:hover {
    background: #001145;
    color: white;
    border-color: #001145;
    transform: translateX(4px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body.chat-open {
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    .chat-window {
        width: 100vw !important;
        height: 100dvh !important;
        max-height: none !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
        inset: 0 !important;
    }

    .ai-chat-widget { /* Chat kapalıyken AI butonu */
        bottom: 30px;
        right: 30px;
    }

    .ai-chat-widget.open .chat-toggle-btn { /* Chat aktifken AI butonunu gizle */
        display: none !important;
    }

    .chat-header {
        padding-top: calc(20px + env(safe-area-inset-top));
    }

    .chat-input-area {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .chat-toggle-btn {
        width: 60px;
        height: 60px;
    }

    .chat-toggle-btn svg {
        width: 28px;
        height: 28px;
    }
}

/* Smooth Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}