/**
 * Chatbot Widget Styles
 * Modern ve responsive chatbot arayüzü için CSS stilleri
 */

.chatbot-widget {
    position: fixed;
    z-index: 100000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

/* Widget Positioning */
.chatbot-widget.bottom-right {
    bottom: 70px;
    right: 20px;
}

.chatbot-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

.chatbot-widget.top-right {
    top: 20px;
    right: 20px;
}

.chatbot-widget.top-left {
    top: 20px;
    left: 20px;
}

/* Chat Button */
.chatbot-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: pulse 2s infinite;
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4), 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4), 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4), 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.chatbot-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
    animation: none;
}

.chatbot-button:hover::before {
    opacity: 1;
}

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

/* Tooltip */
.chatbot-button::after {
    content: 'Bize yazın! Size yardımcı olalım';
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.chatbot-button::after::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: rgba(0, 0, 0, 0.8);
}

.chatbot-button:hover::after {
    opacity: 1;
    visibility: visible;
    right: 85px;
}

.chatbot-button .chatbot-icon {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.chatbot-button:hover .chatbot-icon {
    transform: scale(1.1);
}

/* Notification Badge */
.chatbot-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Chat Window */
.chatbot-window {
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 8px 25px rgba(0,0,0,0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 10px;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.05);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.chatbot-avatar svg {
    width: 22px;
    height: 22px;
}

.chatbot-info {
    flex: 1;
}

.chatbot-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-status.online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* Header Controls */
.chatbot-controls {
    display: flex;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.chatbot-controls button {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.chatbot-controls button:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

.chatbot-controls button:active {
    transform: scale(0.95);
}

.chatbot-controls svg {
    width: 16px;
    height: 16px;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    position: relative;
}

.chatbot-messages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, rgba(248,249,250,1) 0%, rgba(248,249,250,0) 100%);
    pointer-events: none;
    z-index: 1;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* Welcome Message */
.chatbot-welcome {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

/* Messages */
.chatbot-message {
    max-width: 85%;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.chatbot-message.user {
    margin-left: auto;
    flex-direction: row-reverse;
    text-align: right;
}

.chatbot-message.user .chatbot-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 32px;
    height: 32px;
}

.chatbot-message.user .chatbot-avatar svg {
    width: 18px;
    height: 18px;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    position: relative;
    max-width: 100%;
}

.chatbot-message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}

.chatbot-message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.message-content.error {
    background: #fee !important;
    color: #c53030 !important;
    border-color: #feb2b2 !important;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 6px;
    padding: 0 4px;
    opacity: 0.8;
}

.chatbot-message.user .message-time {
    text-align: right;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 20px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Input Area */
.chatbot-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    position: relative;
}

.chatbot-input-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent 0%, #e9ecef 50%, transparent 100%);
}

.chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 8px 12px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.chatbot-input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 25px;
}

.chatbot-input-container:focus-within {
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chatbot-input-container:focus-within::before {
    opacity: 0.05;
}

.chatbot-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    padding: 10px 0;
    color: #333;
    position: relative;
    z-index: 1;
}

.chatbot-input::placeholder {
    color: #999;
    transition: color 0.2s ease;
}

.chatbot-input-container:focus-within .chatbot-input::placeholder {
    color: #bbb;
}

/* Input Buttons */
.chatbot-input-container button {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.chatbot-input-container button:hover {
    background: rgba(108, 117, 125, 0.1);
    color: #495057;
    transform: scale(1.05);
}

.chatbot-input-container button:active {
    transform: scale(0.95);
}

.chatbot-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
}

.chatbot-send:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
    transform: scale(1.05) !important;
}

.chatbot-send:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.chatbot-input-container svg {
    width: 18px;
    height: 18px;
}

/* Input Info */
.chatbot-input-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 11px;
    color: #6c757d;
}

.char-count {
    transition: color 0.2s ease;
}

.char-count.warning {
    color: #f39c12;
}

.char-count.danger {
    color: #e74c3c;
    font-weight: 600;
}

.rate-limit-info {
    color: #e74c3c !important;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Dark Theme */
.chatbot-widget.dark .chatbot-window {
    background: #2c3e50;
    color: #ecf0f1;
    border-color: #34495e;
}

.chatbot-widget.dark .chatbot-messages {
    background: linear-gradient(to bottom, #34495e 0%, #2c3e50 100%);
}

.chatbot-widget.dark .chatbot-message.bot .message-content {
    background: #3c4f66;
    color: #ecf0f1;
    border-color: #4a5f7a;
}

.chatbot-widget.dark .chatbot-input-area {
    background: #2c3e50;
    border-top-color: #34495e;
}

.chatbot-widget.dark .chatbot-input-container {
    background: #34495e;
    border-color: #4a5f7a;
}

.chatbot-widget.dark .chatbot-input-container:focus-within {
    background: #3c4f66;
    border-color: #667eea;
}

.chatbot-widget.dark .chatbot-input {
    color: #ecf0f1;
}

.chatbot-widget.dark .chatbot-input::placeholder {
    color: #95a5a6;
}

.chatbot-widget.dark .chatbot-input-container button {
    color: #95a5a6;
}

.chatbot-widget.dark .chatbot-input-container button:hover {
    background: rgba(149, 165, 166, 0.1);
    color: #bdc3c7;
}

.chatbot-widget.dark .typing-dots {
    background: #3c4f66;
    border-color: #4a5f7a;
}

.chatbot-widget.dark .typing-dots span {
    background: #95a5a6;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        max-width: none;
        max-height: none;
        border-radius: 12px;
    }
    
    .chatbot-widget.bottom-right,
    .chatbot-widget.bottom-left {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .chatbot-widget.top-right,
    .chatbot-widget.top-left {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .chatbot-button {
        width: 56px;
        height: 56px;
    }
    
    .chatbot-button .chatbot-icon {
        width: 24px;
        height: 24px;
    }
    
    .chatbot-messages {
        padding: 16px;
    }
    
    .chatbot-input-area {
        padding: 16px;
    }
    
    .chatbot-message {
        max-width: 90%;
    }
}

@media (max-width: 320px) {
    .chatbot-window {
        width: calc(100vw - 10px);
        height: calc(100vh - 60px);
    }
    
    .chatbot-widget.bottom-right,
    .chatbot-widget.bottom-left,
    .chatbot-widget.top-right,
    .chatbot-widget.top-left {
        bottom: 5px;
        top: 5px;
        right: 5px;
        left: 5px;
    }
}

/* Animations */
.message-fade-in {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chatbot-button.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4), 0 0 0 8px rgba(102, 126, 234, 0.1);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    }
}

/* Loading States */
.chatbot-loading {
    opacity: 0.7;
    pointer-events: none;
}

.chatbot-loading .chatbot-send {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Accessibility */
.chatbot-widget button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.chatbot-input:focus {
    outline: none;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chatbot-button {
        border: 2px solid #000;
    }
    
    .chatbot-message.bot .message-content {
        border: 1px solid #000;
    }
    
    .chatbot-input-container {
        border: 2px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .chatbot-widget *,
    .chatbot-widget *::before,
    .chatbot-widget *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .chatbot-widget {
        display: none !important;
    }
}