/* ==========================================================
   MADDEBEY YAPAY ZEKA HUKUK ASİSTANI - STİL SİSTEMİ (2026)
   ========================================================== */

/* 1. SOL ALT YÜZEN TETİKLEYİCİ BUTON */
.maddebey-launcher-wrap {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.maddebey-trigger-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0284c7 100%);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 25px -3px rgba(30, 58, 138, 0.45), 0 4px 10px -2px rgba(37, 99, 235, 0.3);
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.maddebey-trigger-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 30px -4px rgba(30, 58, 138, 0.55), 0 6px 14px -2px rgba(37, 99, 235, 0.4);
}

.maddebey-trigger-btn:active {
    transform: translateY(0) scale(0.96);
}

.maddebey-trigger-pulse {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 2px solid #38bdf8;
    animation: maddebeyPulseRing 2.2s infinite;
    pointer-events: none;
    opacity: 0.8;
}

@keyframes maddebeyPulseRing {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.22);
        opacity: 0;
    }
    100% {
        transform: scale(0.95);
        opacity: 0;
    }
}

.maddebey-launcher-badge {
    background: #0f172a;
    color: #f8fafc;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.835rem;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.maddebey-launcher-badge:hover {
    background: #1e293b;
    transform: translateY(-1px);
}

.maddebey-sparkle {
    color: #f59e0b;
    font-size: 0.95rem;
}

/* 2. CHAT PENCERESİ (MODAL / FLOATING WINDOW) */
.maddebey-chat-window {
    position: fixed;
    bottom: 96px;
    left: 24px;
    width: 420px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.maddebey-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* HEADER */
.maddebey-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.maddebey-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.maddebey-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.maddebey-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.maddebey-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #ffffff;
}

.maddebey-status {
    font-size: 0.735rem;
    color: #93c5fd;
    display: flex;
    align-items: center;
    gap: 5px;
}

.maddebey-online-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
}

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

.maddebey-icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.maddebey-icon-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* CHAT BODY */
.maddebey-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.maddebey-body::-webkit-scrollbar {
    width: 5px;
}
.maddebey-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* MESAJ BALONLARI */
.maddebey-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: maddebeyFadeIn 0.25s ease forwards;
}

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

.maddebey-msg.bot {
    align-self: flex-start;
}

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

.maddebey-bubble {
    padding: 12px 15px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.55;
    word-break: break-word;
}

.maddebey-msg.bot .maddebey-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.maddebey-msg.user .maddebey-bubble {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.maddebey-bubble p {
    margin: 0 0 8px 0;
}
.maddebey-bubble p:last-child {
    margin-bottom: 0;
}

.maddebey-bubble code {
    background: #eff6ff;
    color: #1e3a8a;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-family: monospace;
    font-size: 0.88em;
}

.maddebey-bubble strong {
    color: #0f172a;
    font-weight: 750;
}

.maddebey-msg.user .maddebey-bubble strong,
.maddebey-msg.user .maddebey-bubble code {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
}

/* KAYNAK KARTLARI */
.maddebey-cards-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.maddebey-card-item {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.18s ease;
}

.maddebey-card-item:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    transform: translateX(2px);
}

.maddebey-card-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.maddebey-card-tag {
    font-size: 0.72rem;
    font-weight: 800;
    color: #1e3a8a;
    text-transform: uppercase;
}

.maddebey-card-title {
    font-size: 0.825rem;
    font-weight: 700;
    color: #0f172a;
}

.maddebey-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.maddebey-card-amount {
    font-size: 0.85rem;
    font-weight: 800;
    color: #dc2626;
}

.maddebey-card-points {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
}

/* ÖNERİ CHIPLERİ */
.maddebey-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.maddebey-chip {
    background: #ffffff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-size: 0.775rem;
    font-weight: 650;
    padding: 5px 10px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.maddebey-chip:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    transform: translateY(-1px);
}

/* YAZIYOR EFEKTİ */
.maddebey-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    width: fit-content;
}

.maddebey-typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: maddebeyBounce 1.4s infinite ease-in-out both;
}

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

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

/* FOOTER / INPUT */
.maddebey-footer {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.maddebey-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.maddebey-input {
    flex: 1;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.885rem;
    outline: none;
    font-family: inherit;
    transition: all 0.18s ease;
}

.maddebey-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.maddebey-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #1e3a8a;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
}

.maddebey-send-btn:hover {
    background: #2563eb;
    transform: scale(1.04);
}

.maddebey-send-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.maddebey-disclaimer {
    font-size: 0.685rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.3;
}

/* ================= MOBİL UYUMLULUK ================= */
@media (max-width: 640px) {
    .maddebey-launcher-wrap {
        bottom: 16px;
        left: 16px;
    }
    
    .maddebey-launcher-badge {
        display: none; /* Mobilde sade yuvarlak buton */
    }

    .maddebey-trigger-btn {
        width: 52px;
        height: 52px;
    }

    .maddebey-chat-window {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 88vh;
        max-height: 88vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .maddebey-chat-window.active {
        transform: translateY(0);
    }
}
