/* AI Asistan Widget Styles */
.ai-asistan-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000; /* Düşük z-index, sadece toggle butonu için */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    pointer-events: none; /* Widget kapalıyken tıklamaları engelle */
    /* Koyu temalarda body color:#fff kalıtımını kır (tüm temalar) */
    color: #212529;
}

.ai-asistan-widget .ai-asistan-container,
.ai-asistan-widget .ai-asistan-messages,
.ai-asistan-widget .ai-siri-start-screen {
    color: #212529;
}

/* theme1/style.css içindeki genel .message-content kurallarını nötrle */
.ai-asistan-widget .message-content {
    min-height: auto !important;
}

.ai-asistan-widget .bot-message .message-content {
    background: #ffffff !important;
    color: #212529 !important;
}

.ai-asistan-widget .bot-message .message-content p,
.ai-asistan-widget .bot-message .message-content span,
.ai-asistan-widget .bot-message .message-content div,
.ai-asistan-widget .bot-message .message-content li,
.ai-asistan-widget .bot-message .message-content strong,
.ai-asistan-widget .bot-message .message-content em {
    color: inherit;
}

.ai-asistan-widget .bot-message .message-content a {
    color: #0d6efd;
}

/* Container kapalıyken sadece toggle butonu tıklanabilir */
.ai-asistan-widget .ai-asistan-toggle {
    pointer-events: auto;
}

/* Container açıkken widget yüksek z-index ve pointer events aktif */
.ai-asistan-widget.container-open {
    z-index: 99999 !important;
    pointer-events: auto;
}

/* Overlay (Mobil için arka plan) */
.ai-asistan-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
}

@media (max-width: 768px) {
    .ai-asistan-overlay {
        display: none; /* Mobilde overlay'i tamamen kaldırıyoruz */
    }
}

.ai-asistan-container {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    min-height: 400px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none; /* default: closed */
    flex-direction: column;
    overflow: hidden;
    z-index: 10001;
    pointer-events: none; /* Kapalıyken tıklamaları engelle */
}

/* Container açıkken pointer events aktif */
.ai-asistan-container.open {
    pointer-events: auto;
    display: flex !important;
}

/* open state */
.ai-asistan-container.open {
    display: flex !important;
}

.ai-asistan-header {
    background: #dc3545;
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

/* Header actions: Sepet + Şef Garson */
.ai-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-header-btn {
    border: 1px solid rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.14);
    color: #fff;
    height: 32px;               /* Sepet ve Şef Garson aynı boy */
    padding: 0 10px;            /* Yükseklik sabit olduğu için dikey padding yok */
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-sizing: border-box;
}

.ai-header-btn:hover {
    background: rgba(255,255,255,0.22);
}

.ai-header-badge {
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #fff;
    color: #dc3545;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
    padding: 0 6px;
}

.ai-header-waiter-btn {
    border-color: rgba(255,255,255,0.55);
}

.ai-header-close {
    color: #fff !important;
}

.ai-status-indicator {
    width: 10px;
    height: 10px;
    position: relative;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    position: relative;
}

.status-dot::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #dc3545;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.5;
    }
}

/* Header text readability */
.ai-asistan-header h6 {
    color: #ffffff !important;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}
.ai-asistan-header small {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 14px;
}
.ai-asistan-header #ai-asistan-close {
    color: #ffffff !important;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-asistan-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    padding-bottom: 200px; /* Input container için daha fazla boşluk */
    background: #f8f9fa;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
    scroll-behavior: smooth;
    box-sizing: border-box;
}

.message {
    margin-bottom: 0;
    display: flex;
    animation: fadeIn 0.3s ease-in;
    width: 100%;
    box-sizing: border-box;
    align-items: flex-start;
    flex-shrink: 0;
}

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

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

.message-content {
    max-width: 280px;
    min-width: auto;
    width: fit-content;
    height: auto;
    min-height: auto;
    padding: 8px 12px;
    border-radius: 16px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
    hyphens: auto;
    overflow: visible;
    display: inline-block;
    box-sizing: border-box;
}

.message-content p {
    margin: 0;
    padding: 0;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    font-size: 15px;
    line-height: 1.5;
    height: auto;
    min-height: auto;
}

.message-content wbr {
    display: inline-block;
}

.bot-message .message-content {
    background: white;
    color: #212529;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bot-message .message-content p {
    color: inherit;
}

.user-message .message-content {
    background: linear-gradient(135deg, #dc3545 0%, #c0392b 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Onaylıyorum butonu (sipariş onayı) */
.ai-confirm-wrapper {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
    width: 100%;
}

.ai-confirm-btn {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(40, 167, 69, 0.45);
    background: rgba(40, 167, 69, 0.10);
    color: #0b3d1a;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600; /* ürün butonlarıyla aynı */
    line-height: 1.2;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

/* Suggested products (AI) */
.ai-suggested-products {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-suggested-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-suggested-row-main {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
}

.ai-suggested-row-main .ai-suggested-btn {
    flex: 1;
    min-width: 0;
    width: auto;
}

.ai-variation-toggle {
    flex-shrink: 0;
    width: 42px;
    min-height: 44px;
    border: 1px solid rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.06);
    border-radius: 10px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    padding: 0;
}

.ai-variation-toggle:hover {
    background: rgba(220, 53, 69, 0.10);
}

.ai-variation-toggle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-suggested-btn {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.06);
    color: #111;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
    line-height: 1.2;
}

.ai-suggested-btn:hover {
    background: rgba(220, 53, 69, 0.10);
}

.ai-suggested-btn.disabled,
.ai-suggested-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-add-all-btn {
    width: 100%;
    margin-top: 4px;
    text-align: center;
    border: 1px solid rgba(25, 135, 84, 0.45);
    background: rgba(25, 135, 84, 0.10);
    color: #146c43;
    padding: 11px 12px;
    border-radius: 10px;
    font-weight: 700;
    line-height: 1.2;
}

.ai-add-all-btn:hover:not(:disabled) {
    background: rgba(25, 135, 84, 0.16);
}

.ai-add-all-btn.disabled,
.ai-add-all-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ai-variations {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-variation-btn {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: #111;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.2;
}

.ai-variation-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Bekleyen sepet: her satır kutu; üstte ürün adı, altta − + × */
.ai-pending-cart-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-cart-subsection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-cart-subsection-title {
    font-size: 13px;
    font-weight: 700;
    color: #222;
    margin-top: 2px;
}

.ai-cart-subsection-readonly .ai-pending-cart-hint {
    margin-bottom: 2px;
}

.ai-readonly-cart-row {
    opacity: 0.95;
}

.ai-pending-cart-hint {
    font-size: 12px;
    color: #555;
    line-height: 1.35;
}

.ai-pending-cart-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    box-sizing: border-box;
}

.ai-pending-cart-line-wrap {
    width: 100%;
    min-width: 0;
}

.ai-pending-cart-line-label {
    display: block;
    width: 100%;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.35;
    color: #111;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.ai-pending-cart-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.ai-cart-dec-btn,
.ai-cart-inc-btn,
.ai-cart-remove-btn {
    flex: 0 0 auto;
    min-width: 36px;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
}

.ai-cart-dec-btn,
.ai-cart-inc-btn {
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: #fff;
    color: #111;
}

.ai-cart-dec-btn:hover:not(:disabled),
.ai-cart-inc-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04);
}

.ai-cart-remove-btn {
    border: 1px solid rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.08);
    color: #c82333;
}

.ai-cart-remove-btn:hover:not(:disabled) {
    background: rgba(220, 53, 69, 0.14);
}

.ai-cart-dec-btn:disabled,
.ai-cart-inc-btn:disabled,
.ai-cart-remove-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ai-cart-clear-btn {
    width: 100%;
    margin-top: 4px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px dashed rgba(0, 0, 0, 0.22);
    background: transparent;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    color: #333;
}

.ai-cart-clear-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.03);
}

.ai-cart-clear-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.ai-cart-clear-confirm {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ai-cart-clear-confirm-msg {
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    margin-bottom: 12px;
}

.ai-cart-clear-confirm-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.ai-cart-clear-confirm-no,
.ai-cart-clear-confirm-yes {
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.18);
    background: #fff;
    color: #333;
}

.ai-cart-clear-confirm-no:hover {
    background: rgba(0, 0, 0, 0.04);
}

.ai-cart-clear-confirm-yes {
    border-color: rgba(220, 53, 69, 0.45);
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
}

.ai-cart-clear-confirm-yes:hover {
    background: rgba(220, 53, 69, 0.14);
}

.ai-confirm-btn:hover:not(.disabled) {
    background: rgba(40, 167, 69, 0.14);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(40, 167, 69, 0.22);
}

.ai-confirm-btn:active:not(.disabled) {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.35);
}

.ai-confirm-btn.disabled {
    opacity: 0.7;
    cursor: default;
    box-shadow: none;
}

@media (max-width: 768px) {
    .ai-confirm-wrapper {
        justify-content: flex-start;
    }

    .ai-confirm-btn {
        font-size: 12px;
        padding: 5px 12px;
    }
}

/* Alt chat bar - varsayılan olarak gizli (ilk Siri ekranında gözükmesin) */
.ai-asistan-input-container {
    display: none;
    padding: 0;
    background: white;
    border-top: 2px solid #dc3545; /* Kırmızı çizgi */
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 100002;
    width: 100%;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    flex-direction: column;
}

/* Sadece chat modunda göster (container'a chat-mode class'ı eklenince) */
.ai-asistan-container.chat-mode .ai-asistan-input-container {
    display: flex;
}

.ai-asistan-input-container .input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-asistan-input-container input,
.ai-asistan-input-container textarea {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 15px;
    z-index: 100003;
    position: relative;
}

.ai-asistan-input-container textarea {
    min-height: 44px;
    line-height: 1.4;
    overflow: hidden;
}

.ai-asistan-input-container button {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

/* Send button tweak */
#ai-send-btn strong {
    color: #ffffff;
}

/* Ensure send svg is visible */
#ai-send-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

/* Use currentColor for both fill and stroke */
#ai-send-btn {
    color: #ffffff !important;
}
#ai-send-btn svg path {
    fill: #ffffff !important;
    stroke: #ffffff !important;
}

/* Cancel button */
#ai-cancel-btn {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

#ai-cancel-btn:hover {
    background: #c82333 !important;
    border-color: #bd2130 !important;
}

#ai-cancel-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    stroke: #ffffff !important;
}

#ai-voice-btn {
    color: #dc3545;
}

#ai-voice-btn.recording {
    color: #dc3545;
    animation: pulse 1.5s infinite;
}

/* Siri Tarzı Chat Input */
.siri-chat-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 20px 16px; /* Input container'dan buraya taşındı */
}

.siri-chat-microphone-btn {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B35 0%, #dc3545 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    align-self: center;
}

/* Chat modunda mikrofon etrafında pulse efekti */
.siri-chat-microphone-btn::before,
.siri-chat-microphone-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(220, 53, 69, 0.3);
    animation: ripple-pulse-chat 2s infinite;
    z-index: -1;
}

.siri-chat-microphone-btn::after {
    animation-delay: 0.5s;
    border-color: rgba(255, 107, 53, 0.3);
}

@keyframes ripple-pulse-chat {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.6);
        opacity: 0;
    }
}

.siri-chat-microphone-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.siri-chat-microphone-btn:hover::before,
.siri-chat-microphone-btn:hover::after {
    animation-duration: 1.5s;
}

.siri-chat-microphone-btn:active {
    transform: scale(0.95);
}

.siri-chat-microphone-btn.recording {
    animation: pulse-microphone-chat 1.5s infinite;
}

.siri-chat-microphone-btn.recording::before,
.siri-chat-microphone-btn.recording::after {
    animation-duration: 1s;
    border-color: rgba(220, 53, 69, 0.5);
}

@keyframes pulse-microphone-chat {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 16px rgba(220, 53, 69, 0.3);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 6px 24px rgba(220, 53, 69, 0.5);
    }
}

.siri-chat-input-area {
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 8px 12px;
    min-height: 48px;
    max-height: 60px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.siri-chat-input-area:focus-within {
    background: #ffffff;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.siri-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    line-height: 1.4;
    padding: 8px 4px;
    resize: none;
    max-height: 44px;
    min-height: 32px;
    overflow-y: auto;
    font-family: inherit;
    color: #333333;
}

.siri-chat-input:focus {
    outline: none;
}

.siri-chat-input::placeholder {
    color: #999999;
}

.siri-chat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.siri-chat-send-btn,
.siri-chat-cancel-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.siri-chat-send-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.siri-chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.siri-chat-send-btn:active {
    transform: scale(0.95);
}

.siri-chat-cancel-btn {
    background: #dc3545;
    color: white;
}

.siri-chat-cancel-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.siri-chat-cancel-btn:active {
    transform: scale(0.95);
}

/* Voice status bar (Dinleniyor / Düşünüyor / Konuşuyor) */
#ai-voice-status {
    display: none; /* JS açıp kapatacak */
}

.siri-voice-status {
    text-align: center;
    padding: 10px 16px;
    font-size: 13px;
    color: #dc3545;
    font-weight: 600;
    width: 100%;
    order: 0; /* Input container içinde en üstte */
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(to bottom, rgba(220, 53, 69, 0.05), rgba(220, 53, 69, 0.02));
    border-bottom: 1px solid rgba(220, 53, 69, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.siri-voice-status .spinner-border-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
    border-color: #dc3545;
    border-right-color: transparent;
}

.ai-eq {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
    margin-right: 8px;
}

.ai-eq .bar {
    width: 3px;
    height: 6px;
    border-radius: 2px;
    background: linear-gradient(180deg, #ff6b35 0%, #dc3545 100%);
    animation: ai-eq-bounce 900ms ease-in-out infinite;
}

.ai-eq .bar:nth-child(2) { animation-delay: 120ms; }
.ai-eq .bar:nth-child(3) { animation-delay: 240ms; }
.ai-eq .bar:nth-child(4) { animation-delay: 360ms; }
.ai-eq .bar:nth-child(5) { animation-delay: 480ms; }

@keyframes ai-eq-bounce {
    0%, 100% { transform: scaleY(0.35); opacity: 0.7; }
    50% { transform: scaleY(1.4); opacity: 1; }
}

/* Chat modunda dinlerken mikrofon ikonunu çubuklara çevir */
.siri-chat-microphone-btn .ai-mic-eq {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    gap: 8px;
    height: 22px;
    pointer-events: none;
}

.siri-chat-microphone-btn .ai-mic-eq .dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(180deg, #2BD9FF 0%, #B24BFF 100%);
    opacity: 0.95;
    animation: ai-mic-dot 1200ms ease-in-out infinite;
}

.siri-chat-microphone-btn .ai-mic-eq .stem {
    width: 8px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(180deg, #7CFFCB 0%, #2BD9FF 30%, #4F7BFF 55%, #B24BFF 80%, #FF4FD8 100%);
    background-size: 100% 200%;
    animation: ai-mic-stem 1200ms ease-in-out infinite;
    filter: drop-shadow(0 6px 16px rgba(0,0,0,0.18));
}

/* 3 çizgi - ortası daha uzun */
.siri-chat-microphone-btn .ai-mic-eq .stem:nth-child(2) { animation-delay: 0ms;   transform-origin: center; }
.siri-chat-microphone-btn .ai-mic-eq .stem:nth-child(3) { animation-delay: 140ms; transform-origin: center; }
.siri-chat-microphone-btn .ai-mic-eq .stem:nth-child(4) { animation-delay: 280ms; transform-origin: center; }

.siri-chat-microphone-btn .ai-mic-eq .stem:nth-child(3) {
    height: 34px;
}

@keyframes ai-mic-stem {
    0%, 100% {
        transform: translateY(1px) scaleY(0.85);
        background-position: 0% 0%;
        opacity: 0.9;
    }
    50% {
        transform: translateY(-2px) scaleY(1.05);
        background-position: 0% 100%;
        opacity: 1;
    }
}

@keyframes ai-mic-dot {
    0%, 100% { transform: scale(0.9); opacity: 0.75; }
    50% { transform: scale(1.05); opacity: 1; }
}

.siri-chat-microphone-btn.recording svg {
    opacity: 0;
}
.siri-chat-microphone-btn.recording .ai-mic-eq {
    display: inline-flex;
}

/* Dinleme sırasında kırmızı yuvarlak arka planı kaldır, sadece şık çubuklar kalsın */
.ai-asistan-container.chat-mode .siri-chat-microphone-btn.recording {
    background: transparent !important;
    box-shadow: none !important;
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ai-asistan-container.chat-mode .siri-chat-microphone-btn.recording:hover {
    transform: none;
    box-shadow: none !important;
}

/* Klavye (chat) modunda mikrofonun etrafında ring/pulse animasyonu olmasın */
.ai-asistan-container.chat-mode .siri-chat-microphone-btn::before,
.ai-asistan-container.chat-mode .siri-chat-microphone-btn::after {
    display: none !important;
    animation: none !important;
}

.ai-asistan-container.chat-mode .siri-chat-microphone-btn.recording {
    animation: none !important;
}

.siri-voice-status .text-success {
    color: #dc3545 !important;
    font-weight: 600;
}

/* Konuşuyor animasyonu (ChatGPT/Siri benzeri) */
.ai-speaking {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ai-speaking-wave {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 14px;
}

.ai-speaking-wave .w {
    width: 3px;
    height: 6px;
    border-radius: 2px;
    background: linear-gradient(180deg, #7CFFCB 0%, #2BD9FF 45%, #B24BFF 100%);
    animation: ai-speaking-wave 900ms ease-in-out infinite;
}
.ai-speaking-wave .w:nth-child(2) { animation-delay: 120ms; }
.ai-speaking-wave .w:nth-child(3) { animation-delay: 240ms; }
.ai-speaking-wave .w:nth-child(4) { animation-delay: 360ms; }

@keyframes ai-speaking-wave {
    0%, 100% { transform: scaleY(0.45); opacity: 0.75; }
    50% { transform: scaleY(1.35); opacity: 1; }
}

.ai-speaking-label {
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #dc3545;
    font-size: 13px;
    line-height: 1;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.ai-asistan-toggle {
    width: auto;
    min-width: 52px;
    height: 52px;
    padding: 0 16px 0 12px;
    gap: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    border: none;
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.45), 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    right: 20px;
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s, visibility 0.3s;
    pointer-events: auto;
    overflow: visible;
    animation: ai-toggle-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ai-asistan-toggle-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-asistan-toggle-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    text-align: left;
    min-width: 0;
}

.ai-asistan-toggle-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.ai-asistan-toggle-sub {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.88;
    white-space: nowrap;
    margin-top: 2px;
}

@keyframes ai-toggle-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Container açıldığında toggle butonunu gizle - JavaScript ile kontrol ediliyor */

.ai-asistan-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(37, 99, 235, 0.5), 0 4px 12px rgba(0, 0, 0, 0.14);
}

.ai-asistan-toggle:active {
    transform: translateY(0) scale(0.98);
}

.ai-pulse {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(37, 99, 235, 0.35);
    animation: ripple 2.4s infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

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

.ai-asistan-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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

/* Typing Indicator */
.typing-dots {
    display: inline-block;
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    margin: 0 2px;
    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.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Mobile Keyboard Fix */
@media (max-width: 768px) {
    .ai-asistan-container {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        /* 100dvh: Mobil tarayıcı UI değişimlerinde daha doğru */
        height: 100dvh !important;
        max-height: 100dvh !important;
        min-height: 100dvh !important;
        border-radius: 0 !important;
        z-index: 99999 !important;
        margin: 0 !important;
        padding: 0 !important;
        padding-bottom: 0 !important;
        background: #ffffff !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        /* JS ile güncellenen klavye offset'i (VisualViewport) */
        --ai-kb-offset: 0px;
    }

    /* Only show when open */
    .ai-asistan-container:not(.open) {
        display: none !important;
    }
    
    .ai-asistan-messages {
        /* Kesin çözüm: input bloğu akışın içinde (fixed değil) → overlap olmaz */
        padding-bottom: 16px !important;
        margin-bottom: 0 !important;
        box-sizing: border-box !important;
        scroll-padding-bottom: 16px !important;
        /* Flex child scroll fix: aksi halde bazı Chromium türevlerinde son eleman kırpılabiliyor */
        min-height: 0 !important;
    }
    
    /* Voice status görünürken ekstra boşluk ekle (JavaScript ile class ekleniyor) */
    .ai-asistan-messages.voice-status-visible {
        padding-bottom: 16px !important;
        scroll-padding-bottom: 16px !important;
    }
    
    /* Alt chat bar - sadece chat modunda ve mobilde sabit altta */
    .ai-asistan-container.chat-mode .ai-asistan-input-container {
        /* KESİN ÇÖZÜM: input/mikrofon bloğu akışın parçası olsun (mesajlar altına giremez) */
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: 100002 !important;
        background: white !important;
        padding: 0 !important; /* Padding wrapper'a taşındı */
        border-top: 2px solid #dc3545 !important; /* Kırmızı çizgi */
        min-height: 90px !important;
        max-height: none !important; /* İçerik kadar yükseklik, input ve butonlar kesilmesin */
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important; /* Voice status'un tam genişlikte olması için */
        width: 100% !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
        box-sizing: border-box !important;
        /* Home indicator vb. için güvenlik */
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }
    
    .ai-asistan-widget {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
    }
    
    .ai-asistan-overlay {
        display: none !important; /* Mobilde overlay'i tamamen kaldır */
    }
    
    .ai-asistan-toggle {
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        min-width: min(280px, calc(100vw - 32px)) !important;
        height: 56px !important;
        padding: 0 20px 0 14px !important;
        z-index: 10000 !important;
        pointer-events: auto !important;
        box-shadow: 0 8px 32px rgba(37, 99, 235, 0.5), 0 2px 12px rgba(0, 0, 0, 0.15) !important;
    }

    .ai-asistan-toggle:hover {
        transform: translateX(-50%) translateY(-2px) !important;
    }

    .ai-asistan-toggle:active {
        transform: translateX(-50%) scale(0.98) !important;
    }

    .ai-asistan-toggle-title {
        font-size: 15px !important;
    }

    .ai-asistan-toggle-sub {
        font-size: 12px !important;
    }
    
    /* Container kapalıyken widget'ın diğer elementleri engellememesi için */
    .ai-asistan-widget:not(:has(.ai-asistan-container.open)) {
        pointer-events: none;
    }
    
    .ai-asistan-widget:not(:has(.ai-asistan-container.open)) .ai-asistan-toggle {
        pointer-events: auto; /* Sadece toggle butonu tıklanabilir */
    }
    
    /* Mobilde header ve footer'ı gizle */
    body.ai-asistan-open .page-wraper > *:not(.ai-asistan-widget) {
        display: none !important;
    }
    
    /* Body scroll'u engelle */
    body.ai-asistan-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        touch-action: none !important;
    }
    
    /* Container açıkken arka plan scroll'u engelle */
    body.ai-asistan-open .ai-asistan-container {
        touch-action: pan-y !important;
        overflow: hidden !important;
    }
    
    body.ai-asistan-open .ai-asistan-messages {
        touch-action: pan-y !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Container kapalıyken widget'ın diğer elementleri engellememesi için */
    .ai-asistan-widget:not(.container-open) {
        pointer-events: none !important;
    }
    
    .ai-asistan-widget:not(.container-open) .ai-asistan-toggle {
        pointer-events: auto !important; /* Sadece toggle butonu tıklanabilir */
    }
    
    /* Container açıkken widget yüksek z-index */
    .ai-asistan-widget.container-open {
        z-index: 99999 !important;
        pointer-events: auto !important;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .ai-asistan-container {
        width: calc(100vw - 20px);
        right: -10px;
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
    }
    
    .ai-asistan-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .ai-asistan-toggle {
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        z-index: 10000 !important;
    }
    
    .message-content {
        max-width: 220px;
    }
    
    /* Mobil klavye açıldığında container'ı yukarı kaydır */
    .ai-asistan-container.keyboard-open {
        height: calc(100vh - env(keyboard-inset-height, 0px)) !important;
        max-height: calc(100vh - env(keyboard-inset-height, 0px)) !important;
    }
}

/* Siri Tarzı Başlangıç Ekranı */
.ai-siri-start-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: #ffffff;
    overflow-y: auto;
}

.siri-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.siri-main-text {
    font-size: 28px;
    font-weight: 600;
    color: #333333;
    text-align: center;
    margin-bottom: 12px;
    line-height: 1.3;
}

.siri-example-text {
    font-size: 15px;
    color: #999999;
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.4;
}

/* Büyük Mikrofon Butonu */
.siri-microphone-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B35 0%, #dc3545 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

/* Mikrofon etrafında pulse efekti */
.siri-microphone-btn::before,
.siri-microphone-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(220, 53, 69, 0.4);
    animation: ripple-pulse 2s infinite;
    z-index: -1;
}

.siri-microphone-btn::after {
    animation-delay: 0.5s;
    border-color: rgba(255, 107, 53, 0.4);
}

@keyframes ripple-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 0;
    }
}

.siri-microphone-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(220, 53, 69, 0.4);
}

.siri-microphone-btn:hover::before,
.siri-microphone-btn:hover::after {
    animation-duration: 1.5s;
}

.siri-microphone-btn:active {
    transform: scale(0.95);
}

.siri-microphone-btn.recording {
    animation: pulse-microphone 1.5s infinite;
}

.siri-microphone-btn.recording::before,
.siri-microphone-btn.recording::after {
    animation-duration: 1s;
    border-color: rgba(220, 53, 69, 0.6);
}

@keyframes pulse-microphone {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(220, 53, 69, 0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 12px 40px rgba(220, 53, 69, 0.5);
    }
}

/* Önerilen Aksiyonlar (Desktop) */
.siri-suggested-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.siri-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    width: 100%;
    justify-content: center;
}

.siri-action-btn:hover {
    background: #eeeeee;
    border-color: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.siri-action-btn:active {
    transform: translateY(0);
}

.siri-action-btn svg {
    flex-shrink: 0;
}

/* Klavye ile Yaz Butonu - siri-action-btn ile aynı stil kullanır */

/* Mobil için Siri ekranı */
@media (max-width: 768px) {
    .ai-siri-start-screen {
        /* Üst başlık rahat okunacak, alt tarafta fazla boşluk kalmayacak şekilde */
        padding: 40px 20px 40px 20px;
        justify-content: flex-start;
    }
    
    .siri-content {
        width: 100%;
        max-width: 100%;
    }
    
    .siri-main-text {
        font-size: 24px;
    }
    
    .siri-example-text {
        font-size: 14px;
        margin-bottom: 50px;
    }
    
    .siri-microphone-btn {
        width: 90px;
        height: 90px;
        margin-bottom: 40px;
    }
    
    .siri-microphone-btn::before,
    .siri-microphone-btn::after {
        width: 90px;
        height: 90px;
    }
    
    .siri-microphone-btn svg {
        width: 36px;
        height: 36px;
    }
    
    .siri-suggested-actions {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        max-width: 280px;
        margin-bottom: 30px; /* Klavye butonu ile arasında boşluk */
    }
    
    .siri-action-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
    
    /* Klavye butonu artık siri-action-btn içinde, ayrı stil gerekmez */
    
    /* Voice status mobilde kırmızı çizgi hizasında, en üstte */
    .siri-voice-status {
        order: 0; /* En üste taşı - kırmızı çizgi hizasında */
        width: 100%;
        margin-top: 0;
        margin-bottom: 0;
        text-align: center;
        padding: 10px 16px;
        min-height: 40px;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: linear-gradient(to bottom, rgba(220, 53, 69, 0.05), rgba(220, 53, 69, 0.02));
        border-bottom: 1px solid rgba(220, 53, 69, 0.1);
    }
    
    /* Input container mobilde flex column */
    .ai-asistan-input-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Mobil için Siri Chat Input */
    .siri-chat-input-wrapper {
        gap: 10px;
        width: 100%;
        padding: 16px; /* Mobil için padding */
    }
    
    .siri-chat-microphone-btn {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
    }
    
    .siri-chat-microphone-btn::before,
    .siri-chat-microphone-btn::after {
        width: 56px;
        height: 56px;
    }
    
    .siri-chat-microphone-btn svg {
        width: 28px;
        height: 28px;
    }
    
    .siri-chat-input-area {
        min-height: 44px;
        max-height: 56px;
        padding: 6px 10px;
    }
    
    .siri-chat-input {
        font-size: 14px;
        padding: 6px 2px;
        max-height: 40px;
        min-height: 28px;
    }
    
    .siri-chat-send-btn,
    .siri-chat-cancel-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
    
    .siri-chat-send-btn svg,
    .siri-chat-cancel-btn svg {
        width: 18px;
        height: 18px;
    }
}

