/* =========================================
   WEBRETA LIVE CHAT PRO - FRONTEND CSS
   Dynamic Theme Colors
   ========================================= */

/* Fallback değerleri - PHP tarafından override edilecek */
:root {
    --wb-bubble: #6f42c1;
    --wb-header: #6f42c1;
    --wb-user-bg: #6f42c1;
    --wb-admin-bg: #ffffff;
}

#webreta-chat-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* =========================================
   1. CHAT BALONCUĞU (Launcher)
   ========================================= */
#webreta-chat-bubble {
    width: 64px;
    height: 64px;
    background: var(--wb-bubble);
    border-radius: 50%;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#webreta-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#webreta-chat-bubble svg {
    width: 30px;
    height: 30px;
    fill: #fff;
}

/* Bildirim Badge */
#wb-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    border: 3px solid #fff;
    min-width: 22px;
    height: 22px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    padding: 0 5px;
    animation: wbPulse 2s infinite;
}

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

/* =========================================
   2. CHAT PENCERE
   ========================================= */
#webreta-chat-window {
    width: 380px;
    height: 580px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 16px;
    animation: wbSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header */
.wb-header {
    background: var(--wb-header);
    padding: 18px 20px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wb-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
}

.wb-header-title svg {
    width: 22px;
    height: 22px;
    fill: #fff;
    opacity: 0.9;
}

.wb-status-dot-header {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: wbOnline 2s infinite;
}

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

.wb-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.wb-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* =========================================
   3. MESAJ ALANI
   ========================================= */
.wb-body {
    flex: 1;
    background: linear-gradient(180deg, #f8f9fc 0%, #f1f3f9 100%);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wb-body::-webkit-scrollbar {
    width: 5px;
}

.wb-body::-webkit-scrollbar-track {
    background: transparent;
}

.wb-body::-webkit-scrollbar-thumb {
    background: rgba(111, 66, 193, 0.2);
    border-radius: 3px;
}

/* Hoşgeldin Notu */
.wb-welcome-note {
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(111, 66, 193, 0.1);
}

.wb-welcome-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
}

.wb-welcome-note h4 {
    margin: 0 0 6px;
    color: #1a1a2e;
    font-size: 15px;
    font-weight: 700;
}

.wb-welcome-note p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
}

/* Mesaj Baloncukları */
.wb-msg-wrapper {
    display: flex;
    width: 100%;
    gap: 8px;
    margin-bottom: 4px;
    animation: wbMsgIn 0.25s ease-out;
}

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

.wb-msg-wrapper.user {
    justify-content: flex-end;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    flex-shrink: 0;
    font-weight: 600;
    margin-top: auto;
}

.msg-avatar.admin {
    background: var(--wb-bubble);
}

.wb-msg {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 78%;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

/* Kullanıcı Mesajı */
.wb-msg-wrapper.user .wb-msg {
    background: var(--wb-user-bg);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.wb-msg-wrapper.user .wb-msg a {
    color: #fff;
    text-decoration: underline;
}

/* Admin Mesajı */
.wb-msg-wrapper.admin .wb-msg {
    background: var(--wb-admin-bg);
    color: #1a1a2e;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f5;
}

.wb-msg-wrapper.admin .wb-msg a {
    color: var(--wb-bubble);
    font-weight: 600;
}

.wb-time {
    display: block;
    font-size: 10px;
    opacity: 0.6;
    text-align: right;
    margin-top: 4px;
}

/* Yazıyor Animasyonu */
.wb-typing-indicator {
    background: #fff;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.wb-typing-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--wb-bubble);
    animation: wbTyping 1.4s infinite ease-in-out both;
    margin-right: 4px;
}

.wb-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.wb-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes wbTyping {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* =========================================
   4. HAZIR MESAJLAR
   ========================================= */
.wb-quick-replies {
    background: #fff;
    border-top: 1px solid #f0f0f5;
    padding: 12px 14px;
    display: flex;
    gap: 8px;
    overflow-x: scroll;
    overflow-y: hidden;
    flex-wrap: nowrap;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    cursor: grab;
    /* Masaüstünde ince scrollbar göster */
    scrollbar-width: thin;
    scrollbar-color: rgba(111, 66, 193, 0.3) transparent;
}

.wb-quick-replies::-webkit-scrollbar {
    height: 4px;
}

.wb-quick-replies::-webkit-scrollbar-track {
    background: transparent;
}

.wb-quick-replies::-webkit-scrollbar-thumb {
    background: rgba(111, 66, 193, 0.3);
    border-radius: 2px;
}

.wb-quick-replies::-webkit-scrollbar-thumb:hover {
    background: rgba(111, 66, 193, 0.5);
}

.wb-quick-replies:active {
    cursor: grabbing;
}

.wb-quick-btn {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    color: #4b5563;
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
    user-select: none;
	margin: 0;
	background: rgba(111, 66, 193, 0.05);
}

.wb-quick-btn:hover {
    border-color: var(--wb-bubble);
    color: var(--wb-bubble);
    background: rgba(0, 0, 0, 0.03);
}

.wb-quick-btn:active {
    transform: scale(0.96);
}

/* =========================================
   5. FOOTER (INPUT ALANI)
   ========================================= */
.wb-footer {
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #f0f0f5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wb-input-wrapper {
    flex: 1;
}

.wb-footer input {
    width: 100%;
    height: 44px;
    border: 2px solid #e5e7eb;
    border-radius: 22px !important;
    padding: 0 18px;
    font-size: 14px;
    outline: none;
    background: #fafafa;
    transition: all 0.2s;
    color: #1a1a2e;
	margin: 0;
}

.wb-footer input:focus {
    background: #fff;
    border-color: var(--wb-bubble);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.wb-footer input::placeholder {
    color: #9ca3af;
}

/* İkon Butonlar */
.wb-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 50%;
	margin:0;
}

.wb-icon-btn:hover {
    color: var(--wb-bubble);
    background: rgba(0, 0, 0, 0.05);
}

.wb-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Gönder Butonu */
.wb-send-btn {
    width: 44px;
    height: 44px;
	padding-right: 11px;
	padding-left: 13px;
    border-radius: 50%;
    background: var(--wb-bubble);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	margin: 0;
}

.wb-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.wb-send-btn svg {
    width: 22px;
    height: 22px;
}

/* Emoji Picker */
#wbEmojiPicker {
    position: absolute;
    bottom: 65px;
    left: 12px;
    background: #fff;
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    z-index: 100;
    border: 1px solid #f0f0f5;
    animation: wbPopIn 0.2s ease-out;
}

@keyframes wbPopIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

#wbEmojiPicker span {
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    text-align: center;
    border-radius: 8px;
    transition: background 0.15s;
}

#wbEmojiPicker span:hover {
    background: rgba(111, 66, 193, 0.1);
}

/* =========================================
   6. OVERLAY EKRANLAR
   ========================================= */
.wb-overlay-screen {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100% - 60px);
    background: #fff;
    z-index: 50;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.wb-overlay-screen h3 {
    color: #1a1a2e;
    margin-bottom: 8px;
}

.wb-overlay-screen p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
}

.wb-overlay-screen input {
    width: 100%;
    padding: 14px 18px;
    margin: 0 0 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    font-size: 15px;
    transition: border-color 0.2s;
}

.wb-overlay-screen input:focus {
    outline: none;
    border-color: var(--wb-bubble);
}

.wb-overlay-screen button,
.wb-login-btn {
    padding: 14px 32px;
    background: var(--wb-bubble);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.wb-overlay-screen button:hover,
.wb-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* =========================================
   7. MOBİL RESPONSIVE
   ========================================= */
@media (max-width: 480px) {
    #webreta-chat-container {
        bottom: 16px;
        right: 16px;
    }

    #webreta-chat-bubble {
        width: 58px;
        height: 58px;
    }

    #webreta-chat-window {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 95% !important;
        height: 75vh !important;
        margin: 10px !important;
        border-radius: 24px 24px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2) !important;
    }

    .wb-header {
        border-radius: 24px 24px 0 0;
    }

    .wb-body {
        padding: 12px;
    }

    .wb-msg {
        max-width: 85%;
    }

    #wbEmojiPicker {
        width: 90%;
        left: 5%;
        bottom: 75px;
    }

    .wb-footer input {
        height: 42px;
    }

    .wb-send-btn {
        width: 42px;
        height: 42px;
    }
}

/* Temp Mesaj */
.wb-msg-wrapper.temp {
    opacity: 0.6;
}