/* =========================================================
   GLOBAL Z-INDEX
   ========================================================= */
#esimChatLauncher{ z-index:2147483646 !important; }
#esimChatContainer{ z-index:2147483647 !important; }

/* =========================================================
   LAUNCHER
   ========================================================= */
.esim-chat-launcher{
    position:fixed;
    right:20px;
    bottom:20px;
}

/* Tablet: safe-area üstü */
@media (max-width:991px){
    .esim-chat-launcher{
        right:14px;
        bottom:calc(14px + env(safe-area-inset-bottom, 0px));
    }
}

/* Mobilde nav üstüne daha yukarı al (%25 ekran) */
@media (max-width:480px){
    .esim-chat-launcher{
        right:14px;
        bottom:calc(25vh + env(safe-area-inset-bottom, 0px) + 14px);
    }
}

/* SADECE MOBİLDE: chat açıkken launcher gizlensin */
@media (max-width:480px){
    body.esim-chat-open #esimChatLauncher{
        display:none !important;
    }
}

/* =========================================================
   HINT
   ========================================================= */
.esim-chat-hint{
    position:absolute;
    right:20px;
    bottom:72px;
    width:max-content;
    max-width:300px;
    min-width:220px;
    background:#fff;
    color:#333;
    padding:10px 14px;
    border-radius:14px;
    box-shadow:0 10px 24px rgba(0,0,0,.12);
    border:1px solid rgba(0,0,0,.06);
    font-size:13px;
    font-weight:700;
    line-height:1.2;
    opacity:0;
    transform:translateY(8px);
    pointer-events:none;
    transition:opacity .25s ease, transform .25s ease;
}
.esim-chat-hint::after{
    content:"";
    position:absolute;
    right:9px;
    bottom:-8px;
    width:14px;
    height:14px;
    background:#fff;
    transform:rotate(45deg);
    border-right:1px solid rgba(0,0,0,.06);
    border-bottom:1px solid rgba(0,0,0,.06);
    box-shadow:6px 6px 14px rgba(0,0,0,.05);
}
.esim-chat-launcher.show-hint .esim-chat-hint{
    opacity:1;
    transform:translateY(0);
}

/* Mobil + Tablet hint kapalı */
@media (max-width:991px){
    .esim-chat-hint{ display:none !important; }
}

/* =========================================================
   CHAT BUTTON (SADECE GIF)
   ========================================================= */
:root{
    --esim-launcher-size: 72px;         /* GIF boyutu (desktop) */
    --esim-launcher-size-mobile: 62px;  /* GIF boyutu (mobile) */
}

/* Buton sadece tıklanabilir alan */
.esim-chat-button{
    width:auto;
    height:auto;
    padding:0;
    border:none;
    background:transparent !important;
    box-shadow:none !important;
    border-radius:0 !important;
    cursor:pointer;
    position:relative;
    animation:none !important;
    transform:none;
}

/* İstersen kalsın: hafif hover */
.esim-chat-button:hover{
    transform:scale(1.05);
}

/* GIF */
.esim-chat-button .chat-icon{
    display:block;
}
.esim-chat-button .chat-icon img{
    width:var(--esim-launcher-size);
    height:auto;
    object-fit:contain;
    display:block;
    border-radius:12px; /* köşesiz olsun dersen kaldır */
}

/* Mobilde GIF küçült */
@media (max-width:480px){
    .esim-chat-button .chat-icon img{
        width:var(--esim-launcher-size-mobile);
    }
}

/* Badge */
.esim-chat-badge{
    position:absolute;
    top:-6px;
    right:-6px;
    background:#ff4757;
    color:#fff;
    border-radius:50%;
    width:20px;
    height:20px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:11px;
    font-weight:700;
    border:2px solid #fff;
}

/* =========================================================
   CHAT CONTAINER
   ========================================================= */
.esim-chat-container{
    position:fixed;
    right:20px;
    bottom:calc(20px + var(--esim-launcher-size) + 2vh);
    width:380px;
    height:550px;
    background:#fff;
    border-radius:20px;
    box-shadow:0 10px 40px rgba(0,0,0,.25);
    display:none;
    flex-direction:column;
    overflow:hidden;
}
.esim-chat-container.active{
    display:flex;
    animation:slideUp .35s cubic-bezier(.68,-.55,.265,1.55);
}
@keyframes slideUp{
    from{ opacity:0; transform:translateY(25px) scale(.95); }
    to{ opacity:1; transform:translateY(0) scale(1); }
}

/* Mobil/Tablet fullscreen */
@media (max-width:991px){
    .esim-chat-container{
        position:fixed !important;
        inset:0 !important;
        width:100vw !important;
        height:100dvh !important;
        border-radius:0 !important;
        right:auto !important;
        bottom:auto !important;
        left:0 !important;
        top:0 !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
        transform:none !important;
    }
    @supports not (height:100dvh){
        .esim-chat-container{ height:100vh !important; }
    }
}

/* =========================================================
   HEADER
   ========================================================= */
.esim-chat-header{
    background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);
    color:#fff;
    padding:18px 18px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    box-shadow:0 2px 10px rgba(0,0,0,.08);
}
.esim-chat-header-left{ display:flex; align-items:center; gap:12px; }

.esim-chat-avatar{
    width:44px; height:44px;
    border-radius:50%;
    background:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    position:relative;
}
.esim-online-badge{
    position:absolute;
    bottom:0; right:0;
    width:12px; height:12px;
    background:#2ecc71;
    border:2px solid #fff;
    border-radius:50%;
}

.esim-chat-info h3{
    font-size:16px;
    font-weight:700;
    margin-bottom:2px;
}
.esim-chat-status{
    font-size:12px;
    opacity:.95;
    display:flex;
    align-items:center;
    gap:5px;
}
.esim-chat-status::before{
    content:'●';
    color:#2ecc71;
    font-size:10px;
}

.esim-close-btn{
    background:rgba(255,255,255,.2);
    border:none;
    color:#fff;
    font-size:22px;
    cursor:pointer;
    width:34px;
    height:34px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:10px;
}

/* Mobilde header daha kısa */
@media (max-width:480px){
    .esim-chat-header{ padding:10px 12px !important; }
    .esim-chat-avatar{ width:34px !important; height:34px !important; font-size:18px !important; }
    .esim-chat-info h3{ font-size:14px !important; margin-bottom:0 !important; }
    .esim-chat-status{ font-size:11px !important; }
    .esim-close-btn{ width:30px !important; height:30px !important; font-size:20px !important; border-radius:8px !important; }
}

/* =========================================================
   BODY
   ========================================================= */
.esim-chat-body{
    flex:1;
    padding:18px;
    overflow-y:auto;
    background:#f8f9fa;
    padding-bottom:110px; /* input bar yer aç */
}
@media (max-width:991px){
    .esim-chat-body{
        padding:14px !important;
        padding-bottom:calc(110px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* =========================================================
   INPUT BAR (GARANTİ)
   ========================================================= */
.esim-chat-inputbar{
    position:absolute;
    left:0;
    right:0;
    bottom:0;
    background:#fff;
    border-top:1px solid #e6e6e6;
    padding:10px 12px;
    padding-bottom:calc(10px + env(safe-area-inset-bottom, 0px));
    display:flex;
    gap:10px;
    align-items:flex-end;
}

/* iOS zoom fix */
.esim-chat-textarea{
    flex:1;
    resize:none;
    padding:10px 12px;
    border-radius:12px;
    border:1px solid rgba(0,0,0,.15);
    outline:none;
    font-size:16px;
    line-height:1.35;
    max-height:120px;
    overflow:auto;
    background:#fff;
}
.esim-chat-textarea:focus{
    border-color:#667eea;
    box-shadow:0 0 0 3px rgba(102,126,234,.12);
}

.esim-chat-sendbtn{
    padding:10px 14px;
    border-radius:12px;
    border:none;
    cursor:pointer;
    font-weight:900;
    color:#fff;
    background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);
    box-shadow:0 6px 18px rgba(102,126,234,.22);
    white-space:nowrap;
}

@supports (-webkit-touch-callout:none){
    .esim-chat-container textarea,
    .esim-chat-container input,
    .esim-chat-container select{
        font-size:16px !important;
    }
}

/* =========================================================
   MESSAGES
   ========================================================= */
.esim-message{ margin-bottom:16px; animation:fadeIn .3s ease; }
@keyframes fadeIn{
    from{ opacity:0; transform:translateY(10px); }
    to{ opacity:1; transform:translateY(0); }
}

.esim-message.bot{ display:flex; gap:10px; align-items:flex-start; }
.esim-bot-avatar{
    width:36px; height:36px;
    border-radius:50%;
    background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:18px;
    flex-shrink:0;
    color:#fff;
}

.esim-message-content{
    background:#fff;
    padding:14px 16px;
    border-radius:16px;
    border-bottom-left-radius:6px;
    max-width:78%;
    box-shadow:0 2px 8px rgba(0,0,0,.08);
    line-height:1.55;
    font-size:14px;
    color:#333;
}

.esim-message.user{ display:flex; justify-content:flex-end; }
.esim-message.user .esim-message-content{
    background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);
    color:#fff;
    border-bottom-right-radius:6px;
    border-bottom-left-radius:16px;
}

/* =========================================================
   OPTIONS + ANIM
   ========================================================= */
.esim-options-container{
    display:flex;
    flex-direction:column;
    gap:10px;
    margin-top:10px;
    padding-left:46px;
}
.esim-option-btn{
    background:#fff;
    border:2px solid #667eea;
    color:#667eea;
    padding:14px 18px;
    border-radius:14px;
    cursor:pointer;
    transition:all .25s ease;
    font-size:14px;
    font-weight:700;
    text-align:center;
    box-shadow:0 2px 8px rgba(0,0,0,.05);
}
.esim-option-btn:hover{
    background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);
    color:#fff;
}

@keyframes esimPopIn{
    from{ opacity:0; transform:translateY(10px) scale(.98); }
    to{ opacity:1; transform:translateY(0) scale(1); }
}
.esim-anim-in{ opacity:0; animation:esimPopIn .22s ease-out forwards; }
.esim-anim-delay-1{ animation-delay:.08s; }
.esim-anim-delay-2{ animation-delay:.14s; }
.esim-anim-delay-3{ animation-delay:.20s; }

/* Typing indicator */
.esim-typing-indicator{
    display:none;
    padding:12px 16px;
    background:#fff;
    border-radius:16px;
    border-bottom-left-radius:6px;
    width:fit-content;
    box-shadow:0 2px 8px rgba(0,0,0,.08);
}
.esim-typing-indicator.active{ display:flex; gap:6px; }
.esim-typing-dot{
    width:9px; height:9px;
    border-radius:50%;
    background:#667eea;
    animation:typing 1.4s infinite;
}
.esim-typing-dot:nth-child(2){ animation-delay:.2s; }
.esim-typing-dot:nth-child(3){ animation-delay:.4s; }
@keyframes typing{
    0%,60%,100%{ transform:translateY(0); }
    30%{ transform:translateY(-12px); }
}

/* Solved */
.esim-solved-wrap{ padding-left:46px; margin-top:12px; }
.esim-solved-box{
    background:#fff;
    border:1px solid rgba(102,126,234,.18);
    border-radius:16px;
    padding:14px;
    box-shadow:0 8px 24px rgba(0,0,0,.06);
    display:flex;
    flex-direction:column;
    gap:12px;
}
.esim-solved-title{
    font-size:13.5px;
    font-weight:900;
    color:#1f2330;
}
.esim-solved-actions{
    display:flex;
    flex-direction:column;
    gap:10px;
}
.esim-solved-actions .esim-solved-btn{
    width:100%;
    justify-content:center;
    padding:12px;
    border-radius:14px;
    font-weight:900;
}

/* Footer mobilde kapalı */
@media (max-width:991px){
    .esim-chat-footer{ display:none !important; }
}
