/* ===================================================
   Amitai Chatbot v2.1 - El Sallama & Sohbet Balonu
   =================================================== */

:root {
    --amitai-primary: #1e3a8a;
    --amitai-primary-light: #3b82f6;
    --amitai-primary-dark: #1e40af;
    --amitai-secondary: #f1f5f9;
    --amitai-text: #1e293b;
    --amitai-text-light: #64748b;
    --amitai-white: #ffffff;
    --amitai-success: #10b981;
    --amitai-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --amitai-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --amitai-radius: 16px;
    --amitai-radius-sm: 12px;
    --amitai-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container */
.amitai-v2 {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483647;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.amitai-v2[data-position="left"] {
    right: auto;
    left: 20px;
}

.amitai-v2 *, .amitai-v2 *::before, .amitai-v2 *::after {
    box-sizing: border-box;
}

/* ==================== SOHBET BALONU ==================== */
.amitai-v2__bubble {
    position: absolute;
    bottom: 75px;
    right: 0;
    background: var(--amitai-white);
    padding: 14px 35px 14px 18px;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    animation: bubbleIn 0.5s ease-out, bubbleFloat 3s ease-in-out infinite 0.5s;
    white-space: nowrap;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: all 0.3s ease;
}

.amitai-v2__bubble-text {
    font-size: 14px;
    color: var(--amitai-text);
    font-weight: 500;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.amitai-v2__bubble.hidden {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: none;
}

.amitai-v2__bubble-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.amitai-v2__bubble-close:hover {
    color: #666;
}

/* Balon ok işareti */
.amitai-v2__bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--amitai-white);
}

/* Balon animasyonları */
@keyframes bubbleIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bubbleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes wave {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    30% { transform: rotate(14deg); }
    40% { transform: rotate(-4deg); }
    50% { transform: rotate(10deg); }
    60% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* Chat açıkken balon gizle */
.amitai-v2:not(.amitai-v2--closed) .amitai-v2__bubble {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: none;
}

/* ==================== LAUNCHER ==================== */
.amitai-v2__launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--amitai-primary) 0%, var(--amitai-primary-dark) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--amitai-shadow);
    transition: var(--amitai-transition);
    position: relative;
    overflow: visible;
}

.amitai-v2__launcher::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    border-radius: 50%;
}

.amitai-v2__launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 30px 60px -12px rgba(30, 58, 138, 0.4);
}

.amitai-v2__launcher:active {
    transform: scale(0.95);
}

.amitai-v2__launcher-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: var(--amitai-transition);
}

.amitai-v2__launcher-wave {
    position: absolute;
    bottom: -5px;
    left: -5px;
    font-size: 22px;
    animation: wave 1s ease-in-out infinite;
    transform-origin: 70% 70%;
    transition: var(--amitai-transition);
}

/* Chat açıkken avatar ve el gizle, X göster */
.amitai-v2:not(.amitai-v2--closed) .amitai-v2__launcher-avatar {
    opacity: 0;
    transform: scale(0);
}

.amitai-v2:not(.amitai-v2--closed) .amitai-v2__launcher-wave {
    opacity: 0;
    transform: scale(0);
}

.amitai-v2__launcher-icon {
    color: var(--amitai-white);
    transition: var(--amitai-transition);
}

.amitai-v2__launcher-icon--close {
    position: absolute;
    opacity: 0;
    transform: scale(0) rotate(-90deg);
}

.amitai-v2:not(.amitai-v2--closed) .amitai-v2__launcher-icon--close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* ==================== CHAT WINDOW ==================== */
.amitai-v2__window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 520px;
    background: var(--amitai-white);
    border-radius: var(--amitai-radius);
    box-shadow: var(--amitai-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: var(--amitai-transition);
}

.amitai-v2:not(.amitai-v2--closed) .amitai-v2__window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ==================== HEADER ==================== */
.amitai-v2__header {
    background: linear-gradient(135deg, var(--amitai-primary) 0%, var(--amitai-primary-dark) 100%);
    color: var(--amitai-white);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.amitai-v2__header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.amitai-v2__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
}

.amitai-v2__header-info {
    display: flex;
    flex-direction: column;
}

.amitai-v2__title {
    font-weight: 600;
    font-size: 16px;
}

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

.amitai-v2__status-dot {
    width: 8px;
    height: 8px;
    background: var(--amitai-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.amitai-v2__header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.amitai-v2__lang-selector {
    display: flex;
    gap: 4px;
}

.amitai-v2__lang-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.amitai-v2__lang-btn:hover,
.amitai-v2__lang-btn.active {
    background: rgba(255,255,255,0.3);
}

.amitai-v2__close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--amitai-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.amitai-v2__close-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ==================== MESSAGES ==================== */
.amitai-v2__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.amitai-v2__message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--amitai-radius-sm);
    animation: messageIn 0.3s ease-out;
    word-wrap: break-word;
}

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

.amitai-v2__message--bot {
    background: var(--amitai-white);
    color: var(--amitai-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--amitai-shadow-sm);
}

.amitai-v2__message--user {
    background: linear-gradient(135deg, var(--amitai-primary-light) 0%, var(--amitai-primary) 100%);
    color: var(--amitai-white);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ==================== TYPING ==================== */
.amitai-v2__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: #f8fafc;
}

.amitai-v2__typing-dots {
    display: flex;
    gap: 4px;
}

.amitai-v2__typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--amitai-text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.amitai-v2__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; }
}

.amitai-v2__typing-text {
    font-size: 12px;
    color: var(--amitai-text-light);
}

/* ==================== INPUT ==================== */
.amitai-v2__input-area {
    display: flex;
    padding: 16px;
    gap: 10px;
    border-top: 1px solid #e2e8f0;
    background: var(--amitai-white);
}

.amitai-v2__input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.amitai-v2__input:focus {
    border-color: var(--amitai-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.amitai-v2__send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--amitai-primary-light) 0%, var(--amitai-primary) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--amitai-white);
    transition: transform 0.2s, box-shadow 0.2s;
}

.amitai-v2__send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.amitai-v2__send-btn:active {
    transform: scale(0.95);
}

/* ==================== FOOTER ==================== */
.amitai-v2__footer {
    padding: 10px;
    text-align: center;
    font-size: 11px;
    color: var(--amitai-text-light);
    background: #f8fafc;
}

.amitai-v2__footer a {
    color: var(--amitai-primary);
    text-decoration: none;
}

.amitai-v2__footer a:hover {
    text-decoration: underline;
}

/* ==================== MOBILE ==================== */
@media (max-width: 480px) {
    .amitai-v2 {
        bottom: 10px;
        right: 10px;
    }
    
    .amitai-v2__window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        right: -10px;
        bottom: 70px;
    }
    
    .amitai-v2__bubble {
        right: 0;
        max-width: 250px;
        white-space: normal;
    }
}
