/* assets/css/live_chat.css - Alfa Keşif Canlı Destek Widget Stilleri */

:root {
    --ak-primary: #4f46e5;
    --ak-primary-hover: #4338ca;
    --ak-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
    --ak-bg-dark: #0f172a;
    --ak-bubble-user: #4f46e5;
    --ak-bubble-admin: #ffffff;
    --ak-text-admin: #1e293b;
    --ak-text-light: #f8fafc;
    --ak-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

/* Floating Launcher Button (Canlı Destek Capsule / Pill) */
#ak-chat-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    height: 52px;
    padding: 0 20px 0 16px;
    border-radius: 30px;
    background: var(--ak-gradient);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.45), 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 999990;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#ak-chat-launcher:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.6), 0 4px 12px rgba(0, 0, 0, 0.2);
}

#ak-chat-launcher.ak-launcher-open {
    padding: 0;
    width: 52px;
    border-radius: 50%;
}

#ak-chat-launcher.ak-launcher-open .ak-launcher-label,
#ak-chat-launcher.ak-launcher-open .ak-online-beacon {
    display: none;
}

.ak-launcher-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ak-chat-launcher .ak-launcher-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

/* Canlı Destek Metni */
.ak-launcher-label {
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Pulsing Green Online Indicator */
.ak-online-beacon {
    position: absolute;
    top: -3px;
    right: -4px;
    width: 9px;
    height: 9px;
    background-color: #10b981;
    border-radius: 50%;
    border: 1.5px solid #ffffff;
}

.ak-online-beacon::after {
    content: '';
    position: absolute;
    top: -1.5px;
    left: -1.5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #10b981;
    animation: ak-pulse-beacon 2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    opacity: 0.7;
    z-index: -1;
}

@keyframes ak-pulse-beacon {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(2.4);
        opacity: 0;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

#ak-chat-launcher .ak-unread-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
}

/* Chat Container Window */
#ak-chat-widget {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: var(--ak-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999991;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

#ak-chat-widget.ak-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Chat Header */
.ak-chat-header {
    background: var(--ak-gradient);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.ak-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.ak-status-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 11px;
    height: 11px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.ak-header-text h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #ffffff;
}

.ak-header-text span {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ak-header-actions button {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    padding: 4px;
    transition: opacity 0.2s ease;
}

.ak-header-actions button:hover {
    opacity: 1;
}

/* Modern Guest Onboarding Card (Pre-Chat Gate) */
.ak-guest-card {
    position: absolute;
    top: 74px;
    left: 0;
    right: 0;
    bottom: 64px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 22px;
    box-sizing: border-box;
    overflow-y: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ak-guest-card.ak-card-hide {
    opacity: 0;
    transform: translateY(-12px);
    pointer-events: none;
}

.ak-guest-card-body {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ak-guest-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
    align-self: flex-start;
}

.ak-guest-card-body h4 {
    margin: 0 0 6px 0;
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.ak-guest-card-body p {
    margin: 0 0 16px 0;
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.45;
}

.ak-guest-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.ak-form-field {
    position: relative;
    width: 100%;
}

.ak-field-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
    transition: color 0.2s ease;
}

.ak-form-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 10.5px 14px 10.5px 36px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 13px;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.ak-form-field input:focus {
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.ak-form-field:focus-within .ak-field-icon {
    color: #4f46e5;
}

.ak-guest-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ak-guest-submit-btn {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--ak-gradient);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    margin-top: 4px;
}

.ak-guest-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}

.ak-guest-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ak-guest-privacy {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Shake Animation */
@keyframes akShake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.ak-shake {
    animation: akShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Messages Area */
.ak-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.ak-msg {
    max-width: 82%;
    display: flex;
    flex-direction: column;
    animation: akFadeIn 0.25s ease-out;
}

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

.ak-msg-system {
    align-self: center;
    max-width: 90%;
    background: rgba(79, 70, 229, 0.08);
    color: #4338ca;
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 12px;
    text-align: center;
    line-height: 1.4;
    border: 1px dashed rgba(79, 70, 229, 0.25);
}

.ak-msg-user {
    align-self: flex-end;
}

.ak-msg-user .ak-bubble {
    background: var(--ak-bubble-user);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
}

.ak-msg-admin {
    align-self: flex-start;
}

.ak-msg-admin .ak-bubble {
    background: var(--ak-bubble-admin);
    color: var(--ak-text-admin);
    border-radius: 16px 16px 16px 4px;
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.ak-msg-meta {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    display: flex;
    gap: 4px;
}

.ak-msg-user .ak-msg-meta {
    justify-content: flex-end;
}

.ak-msg-admin .ak-msg-meta {
    justify-content: flex-start;
}

/* Chat Footer / Input */
.ak-chat-footer {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ak-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.ak-chat-input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13.5px;
    outline: none;
    background: #f8fafc;
    transition: all 0.2s ease;
    resize: none;
    max-height: 80px;
    line-height: 1.3;
    font-family: inherit;
}

.ak-chat-input:focus {
    background: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.ak-input-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.95);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px dashed #cbd5e1;
    user-select: none;
    transition: all 0.2s ease;
    z-index: 5;
    padding: 0 12px;
}

.ak-input-lock-overlay:hover {
    background: #ffffff;
    border-color: #4f46e5;
    color: #4f46e5;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}

.ak-chat-footer.ak-locked {
    background: #f8fafc;
}

.ak-chat-footer.ak-locked .ak-send-btn {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

.ak-msg-welcome {
    background: rgba(16, 185, 129, 0.09) !important;
    color: #065f46 !important;
    border: 1px dashed rgba(16, 185, 129, 0.35) !important;
    font-weight: 500;
    text-align: left !important;
}

.ak-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ak-gradient);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

.ak-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsiveness (Above .mobile-bottom-nav) */
@media (max-width: 768px) {
    #ak-chat-launcher {
        right: 15px;
        /* Positioned above the 70px + safe-area mobile bottom navigation bar */
        bottom: calc(84px + env(safe-area-inset-bottom));
        height: 44px;
        padding: 0 15px 0 12px;
        border-radius: 25px;
        gap: 8px;
        z-index: 999990;
        box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
    }

    #ak-chat-launcher .ak-launcher-icon {
        font-size: 17px;
    }

    .ak-launcher-label {
        font-size: 13px;
    }

    #ak-chat-launcher.ak-launcher-open {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
    }

    #ak-chat-widget {
        right: 10px;
        left: 10px;
        /* Rests cleanly above bottom navigation bar */
        bottom: calc(82px + env(safe-area-inset-bottom));
        width: auto;
        height: calc(100vh - 140px - env(safe-area-inset-bottom));
        max-height: 560px;
        border-radius: 18px;
        z-index: 999995;
    }

    .ak-guest-card {
        top: 68px;
        bottom: 58px;
        padding: 14px 16px;
    }

    .ak-guest-card-body h4 {
        font-size: 15.5px;
    }

    .ak-guest-card-body p {
        font-size: 11.5px;
        margin-bottom: 12px;
    }

    .ak-form-field input {
        padding: 9px 12px 9px 34px;
        font-size: 12.5px;
    }

    .ak-guest-submit-btn {
        height: 40px;
        font-size: 13px;
    }

    .ak-input-lock-overlay span {
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    #ak-chat-launcher {
        right: 10px;
        padding: 0 12px 0 10px;
    }

    .ak-launcher-label {
        font-size: 12px;
    }
}
