/* ==========================================================================
   1. DEĞİŞKENLER VE TEMA AYARLARI
   ========================================================================== */
:root {
    --lawbot-primary: #0f172a;
    --lawbot-bg: #ffffff;
    --lawbot-text: #334155;
    --lawbot-bubble-bot: #f1f5f9;
    --lawbot-bubble-user: #1e3a8a;
    --lawbot-user-text: #ffffff;
    --lawbot-border: #e2e8f0;
    --lawbot-header-text: #ffffff;
    --lawbot-action-btn-hover: rgba(255, 255, 255, 0.15);
    --lawbot-overlay: rgba(0, 0, 0, 0.4);
}

/* Karanlık Mod Aktif Olduğunda Devreye Girecek Renkler */
#lawbot-wrapper.dark-theme {
    --lawbot-bg: #1e293b;
    --lawbot-text: #f8fafc;
    --lawbot-bubble-bot: #334155;
    --lawbot-border: #475569;
    --lawbot-header-text: #f8fafc;
    --lawbot-action-btn-hover: rgba(255, 255, 255, 0.1);
    --lawbot-overlay: rgba(0, 0, 0, 0.6);
}

/* KESİN GİZLEME KURALI (JS'den gelen .hidden sınıfının çalışması için şart) */
.hidden {
    display: none !important;
}

/* ==========================================================================
   2. ANA PANEL VE TETİKLEYİCİ (TRIGGER) BUTON
   ========================================================================== */
#lawbot-wrapper {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#lawbot-trigger-btn {
    background: var(--lawbot-primary);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s;
    overflow: hidden;
}

/* Hover */
#lawbot-trigger-btn:hover { 
    transform: scale(1.05); 
}

#lawbot-trigger-btn svg {
    width: 60px;
    height: 60px;
    position: relative;
    z-index: 2;
}

/* ✨ ALTIN - BEYAZ hızlı dönen border */
#lawbot-trigger-btn::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        var(--gold),
        #ffffff,
        var(--gold-light),
        #ffffff,
        var(--gold)
    );
    animation: goldSpin 2s linear infinite; /* 🔥 hızlı */
    z-index: 0;
}

/* İç katman */
#lawbot-trigger-btn::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--lawbot-primary);
    border-radius: 50%;
    z-index: 1;
}

/* Döndürme */
@keyframes goldSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   3. SOHBET PENCERESİ (CHAT WINDOW) - MASAÜSTÜ
   ========================================================================== */
#lawbot-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 520px;
    background: var(--lawbot-bg);
    border: 1px solid var(--lawbot-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background 0.3s, border-color 0.3s;
}

/* ==========================================================================
   4. SOHBET NAVBAR / HEADER BÖLÜMÜ
   ========================================================================== */
#lawbot-header {
    background: var(--lawbot-primary);
    color: var(--lawbot-header-text);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--lawbot-border);
}

.lawbot-brand { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.lawbot-brand h4 { 
    margin: 0; 
    font-size: 15px; 
    font-weight: 600; 
}

.lawbot-dot { 
    width: 8px; 
    height: 8px; 
    background: #10b981; 
    border-radius: 50%; 
}

.lawbot-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lawbot-actions button {
    background: transparent;
    border: none;
    color: var(--lawbot-header-text);
    font-size: 18px;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.lawbot-actions button:hover {
    background: var(--lawbot-action-btn-hover);
}

/* ==========================================================================
   5. MESAJ ALANI VE BALONCUKLAR (MESSAGES & BUBBLES)
   ========================================================================== */
#lawbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--lawbot-bg);
}

.lawbot-msg { 
    display: flex; 
    margin-bottom: 14px; 
}

.lawbot-msg.msg-user { justify-content: flex-end; }
.lawbot-msg.msg-bot { justify-content: flex-start; }

.msg-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
}

.msg-user .msg-bubble {
    background: var(--lawbot-bubble-user);
    color: var(--lawbot-user-text);
    border-top-right-radius: 2px;
}

.msg-bot .msg-bubble {
    background: var(--lawbot-bubble-bot);
    color: var(--lawbot-text);
    border-top-left-radius: 2px;
}

/* ASİSTAN YAZIYOR ALANI VE ANIMASYONU */
#lawbot-typing { 
    padding: 10px 16px; 
    font-size: 13px; 
    color: #64748b;
    background: var(--lawbot-bg);
    border-top: 1px dashed var(--lawbot-border);
    font-style: italic;
}

#lawbot-typing span {
    animation: lawbotDotPulse 1.4s infinite both;
}

#lawbot-typing span:nth-child(2) { animation-delay: .2s; }
#lawbot-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes lawbotDotPulse {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

/* ==========================================================================
   6. ALT FORM / INPUT ALANI (FOOTER)
   ========================================================================== */
#lawbot-footer {
    padding: 12px;
    border-top: 1px solid var(--lawbot-border);
    display: flex;
    gap: 8px;
    background: var(--lawbot-bg);
}

#lawbot-input {
    flex: 1;
    border: 1px solid var(--lawbot-border);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    background: var(--lawbot-bg);
    color: var(--lawbot-text);
    transition: border-color 0.2s;
}

#lawbot-input:focus {
    border-color: var(--lawbot-bubble-user);
}

#lawbot-send-btn {
    background: var(--lawbot-bubble-user);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

/* ==========================================================================
   7. RESPONSIVE / MOBİL DETAYLAR (TAM ORTALI VE GÜVENLİ KART TASARIMI)
   ========================================================================== */
@media (max-width: 480px) {
    #lawbot-wrapper:not(:has(#lawbot-chat-window.hidden)) {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: var(--lawbot-overlay);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.3s;
    }

    #lawbot-wrapper:not(:has(#lawbot-chat-window.hidden)) #lawbot-trigger-btn {
        display: none;
    }

    #lawbot-chat-window {
        position: relative;
        bottom: auto;
        right: auto;
        width: 90vw;
        max-width: 360px;
        height: 80vh;
        max-height: 540px;
        border-radius: 16px;
        border: 1px solid var(--lawbot-border);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    }

    #lawbot-header {
        padding: 14px 16px;
    }

    #lawbot-footer {
        padding: 12px;
    }
}

