/**
 * Pozitif Copilot — sayfa özel CSS.
 * (Önce: blade içinde inline <style> ve style="animation-delay" vardı.)
 *
 * KRİTİK: Filament'in hazır (prebuilt) CSS'i bu sayfanın Tailwind
 * sınıflarını İÇERMEZ (bg-gradient-to-r, bottom-6, w-14 vb. yok) ve proje
 * Vite çıktısı panele yüklenmez. Bu yüzden floating buton ve çekmecenin
 * gerçek yerleşimi BURADA, düz CSS ile garanti altına alınır.
 * Blade'deki Tailwind sınıfları yalnızca ilerici iyileştirmedir.
 */

/* Alpine.js ve Gizleme Garantisi: Inline style="display: none;" veya x-cloak kesinlikle gizlenmeli */
[style*="display: none"],
[style*="display:none"],
.copilot-drawer[style*="display: none"],
.copilot-drawer[style*="display:none"],
.copilot-dock[style*="display: none"],
.copilot-dock[style*="display:none"],
.copilot-fab[style*="display: none"],
.copilot-fab[style*="display:none"],
[x-cloak] {
    display: none !important;
}

/* Sağ alttaki yüzen buton (FAB) */
.copilot-fab {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 99999 !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 9999px !important;
    background: linear-gradient(to right, #2563eb, #4f46e5, #9333ea) !important;
    color: #ffffff !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none !important;
}

.copilot-fab:hover {
    transform: scale(1.05);
}

.copilot-fab:active {
    transform: scale(0.95);
}

.copilot-fab svg {
    width: 28px !important;
    height: 28px !important;
}

/* Sağdan açılan sohbet çekmecesi */
.copilot-drawer {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    z-index: 99998 !important;
    width: 100% !important;
    background: #ffffff !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45) !important;
    border-left: 1px solid #e5e7eb !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media (min-width: 640px) {
    .copilot-drawer {
        width: 460px !important;
    }

    .copilot-drawer.is-compact {
        width: 360px !important;
    }
}

.dark .copilot-drawer {
    background: #111827 !important;
    border-left-color: #1f2937 !important;
    color: #f9fafb !important;
}

/* Masaüstü ekranlarda kenetlenmiş (Push Layout) mod: Sayfa içeriğini dinamik sola iter */
@media (min-width: 1024px) {
    body.copilot-docked .fi-main-ctn {
        margin-right: 460px !important;
        max-width: calc(100vw - 460px) !important;
    }

    body.copilot-docked.copilot-compact .fi-main-ctn {
        margin-right: 360px !important;
        max-width: calc(100vw - 360px) !important;
    }

    body.copilot-docked .fi-main {
        max-width: 100% !important;
        margin-left: 0 !important;
        padding-left: 0.75rem !important;
        padding-right: 1.25rem !important;
    }

    body.copilot-docked .fi-ta-content,
    body.copilot-docked .fi-ta-table {
        overflow-x: auto !important;
    }

    .fi-main-ctn {
        transition: margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                    max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .fi-main {
        transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                    max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
}

/* Başlık butonları */
.copilot-header-btn {
    border: none !important;
    background: transparent !important;
    outline: none !important;
}

.copilot-header-btn--active {
    background-color: #dbeafe !important;
    color: #1d4ed8 !important;
}

.dark .copilot-header-btn--active {
    background-color: rgba(30, 58, 138, 0.5) !important;
    color: #93c5fd !important;
}

/* Küçültülmüş (minimized) dock bar */
.copilot-dock {
    position: fixed !important;
    bottom: 0 !important;
    right: 24px !important;
    z-index: 99998 !important;
    width: 320px !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-bottom: none !important;
    border-top-left-radius: 0.75rem !important;
    border-top-right-radius: 0.75rem !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dark .copilot-dock {
    background: #111827 !important;
    border-color: #1f2937 !important;
    color: #f9fafb !important;
}

/* Onay Modali ve Buton Stilleri */
.copilot-confirm-overlay {
    background-color: rgba(17, 24, 39, 0.75) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

.copilot-confirm-icon {
    background-color: #fef3c7 !important;
    color: #d97706 !important;
}

.dark .copilot-confirm-icon {
    background-color: rgba(120, 53, 15, 0.4) !important;
    color: #fbbf24 !important;
}

.copilot-confirm-cancel-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.6rem 1rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    background-color: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #e5e7eb !important;
    cursor: pointer !important;
    transition: background-color 0.15s !important;
    text-align: center !important;
    line-height: 1 !important;
}

.copilot-confirm-cancel-btn:hover {
    background-color: #e5e7eb !important;
}

.dark .copilot-confirm-cancel-btn {
    background-color: #374151 !important;
    color: #e5e7eb !important;
    border-color: #4b5563 !important;
}

.dark .copilot-confirm-cancel-btn:hover {
    background-color: #4b5563 !important;
}

.copilot-confirm-danger-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.6rem 1rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    background-color: #dc2626 !important;
    color: #ffffff !important;
    border: 1px solid #b91c1c !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3) !important;
    transition: background-color 0.15s, transform 0.1s !important;
    text-align: center !important;
    line-height: 1 !important;
}

.copilot-confirm-danger-btn:hover {
    background-color: #b91c1c !important;
}

.copilot-confirm-danger-btn:active {
    transform: scale(0.98) !important;
}

/* Yükleniyor animasyonu gecikmeleri (önce inline style="animation-delay" idi) */
.copilot-typing-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: #3b82f6;
    animation: copilot-bounce 1s infinite;
}

.copilot-typing-dot--1 {
    animation-delay: 0s;
}

.copilot-typing-dot--2 {
    animation-delay: 0.15s;
}

.copilot-typing-dot--3 {
    animation-delay: 0.3s;
}

@keyframes copilot-bounce {
    0%,
    100% {
        transform: translateY(0);
        opacity: 0.6;
    }

    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Çekmece içi basit HTML mesaj tipografisi */
.copilot-drawer .prose h2,
.copilot-drawer .prose h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 0.6rem;
    margin-bottom: 0.25rem;
    color: inherit;
}

.copilot-drawer .prose p {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.copilot-drawer .prose ul,
.copilot-drawer .prose ol {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    padding-left: 1.15rem;
    list-style-type: disc;
}

.copilot-drawer .prose ol {
    list-style-type: decimal;
}

.copilot-drawer .prose li {
    margin-top: 0.15rem;
    margin-bottom: 0.15rem;
}

.copilot-drawer .prose strong {
    font-weight: 600;
}

.copilot-drawer .prose a {
    color: #2563eb;
    text-decoration: underline;
}

.dark .copilot-drawer .prose a {
    color: #60a5fa;
}

/* Kullanıcı mesaj balonu */
.copilot-msg-user-container {
    display: flex !important;
    justify-content: flex-end !important;
    width: 100% !important;
    margin-bottom: 0.85rem !important;
}

.copilot-msg-user-bubble {
    max-width: 85% !important;
    background-color: #2563eb !important;
    color: #ffffff !important;
    border-radius: 1.25rem 1.25rem 0.25rem 1.25rem !important;
    padding: 0.65rem 1rem !important;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2) !important;
    word-break: break-word !important;
}

.copilot-msg-user-bubble p {
    color: #ffffff !important;
    margin: 0 !important;
    white-space: pre-wrap !important;
    line-height: 1.5 !important;
    font-size: 0.875rem !important;
}

.copilot-msg-user-bubble .copilot-msg-time {
    display: block !important;
    text-align: right !important;
    font-size: 0.65rem !important;
    color: rgba(255, 255, 255, 0.8) !important;
    margin-top: 0.25rem !important;
}

/* Asistan mesaj balonu */
.copilot-msg-assistant-container {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    gap: 0.6rem !important;
    width: 100% !important;
    margin-bottom: 0.85rem !important;
}

.copilot-msg-assistant-icon {
    width: 1.85rem !important;
    height: 1.85rem !important;
    border-radius: 0.5rem !important;
    background-color: #e0e7ff !important;
    color: #4f46e5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin-top: 0.15rem !important;
}

.dark .copilot-msg-assistant-icon {
    background-color: rgba(49, 46, 129, 0.6) !important;
    color: #a5b4fc !important;
}

.copilot-msg-assistant-bubble {
    max-width: 85% !important;
    background-color: #f3f4f6 !important;
    color: #111827 !important;
    border-radius: 1.25rem 1.25rem 1.25rem 0.25rem !important;
    padding: 0.65rem 1rem !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    word-break: break-word !important;
}

.dark .copilot-msg-assistant-bubble {
    background-color: #1f2937 !important;
    color: #f9fafb !important;
}

.copilot-msg-assistant-bubble .copilot-msg-time {
    display: block !important;
    text-align: left !important;
    font-size: 0.65rem !important;
    color: #9ca3af !important;
    margin-top: 0.35rem !important;
}

/* Dinamik büyüyebilen textarea giriş alanı */
.copilot-textarea-wrapper {
    display: flex !important;
    align-items: flex-end !important;
    gap: 0.5rem !important;
    width: 100% !important;
    background-color: #f3f4f6 !important;
    border-radius: 0.85rem !important;
    padding: 0.35rem 0.5rem 0.35rem 0.75rem !important;
    border: 1px solid #e5e7eb !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
}

.dark .copilot-textarea-wrapper {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

.copilot-textarea-wrapper:focus-within {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
}

.copilot-chat-textarea {
    flex: 1 1 0% !important;
    min-height: 38px !important;
    max-height: 160px !important;
    resize: none !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0.4rem 0 !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    color: #111827 !important;
    overflow-y: auto !important;
}

.dark .copilot-chat-textarea {
    color: #f9fafb !important;
}

.copilot-chat-textarea::placeholder {
    color: #9ca3af !important;
}

.copilot-send-button {
    flex-shrink: 0 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 0.65rem !important;
    background: #2563eb !important;
    color: #ffffff !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    margin-bottom: 2px !important;
    transition: background-color 0.15s, transform 0.1s !important;
}

.copilot-send-button:hover:not(:disabled) {
    background: #1d4ed8 !important;
    transform: scale(1.03) !important;
}

.copilot-send-button:active:not(:disabled) {
    transform: scale(0.95) !important;
}

.copilot-send-button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}
