/* ═══════════════════════════════════════════════════════════════════
   AI ASISTAN — Dashboard sohbet paneli + ayarlar
   Tum kos1eler keskin (border-radius: 0). Responsive + dark mode.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Floating action button ─────────────────────────────────────── */
.ai-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1400;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, var(--yl-primary) 0%, var(--yl-accent) 100%);
    color: #fff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(59,125,221,0.4), 0 0 0 0 rgba(59,125,221,0.5);
    transition: box-shadow 0.2s, transform 0.15s;
    animation: aiFabPulse 3s ease-in-out infinite;
}
.ai-fab:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 24px rgba(59,125,221,0.55);
}
.ai-fab-label { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.1em; }
.ai-fab-status {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 9px;
    height: 9px;
    background: #6b7280;
    border: 2px solid var(--yl-primary-dark, #0f2548);
}
.ai-fab-status.is-ready { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.8); }

@keyframes aiFabPulse {
    0%, 100% { box-shadow: 0 4px 18px rgba(59,125,221,0.4), 0 0 0 0 rgba(59,125,221,0.35); }
    50%      { box-shadow: 0 4px 18px rgba(59,125,221,0.4), 0 0 0 9px rgba(59,125,221,0); }
}

/* ── Panel (sag drawer) ─────────────────────────────────────────── */
.ai-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1410;
    width: 420px;
    max-width: 92vw;
    height: 100%;
    background: #fff;
    border-left: 1px solid #d0d5dd;
    box-shadow: -8px 0 28px rgba(15,37,72,0.16);
    display: flex;
    flex-direction: column;
    transform: translateX(105%);
    transition: transform 0.24s cubic-bezier(0.3,0.7,0.3,1);
}
.ai-panel-open { transform: translateX(0); }
.app-root.dark .ai-panel { background: #0d1117; border-left-color: #30363d; }

.ai-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    background: linear-gradient(120deg, var(--yl-primary-dark, #0f2548) 0%, var(--yl-primary, #1a3a6b) 60%, var(--yl-primary-light, #2a5298) 100%);
    color: #fff;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.ai-panel-head::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120px 60px at 85% 0%, rgba(255,255,255,0.16), transparent 70%);
    pointer-events: none;
}
.ai-panel-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.92rem; letter-spacing: 0.01em; z-index: 1; }
.ai-panel-title svg { filter: drop-shadow(0 0 4px rgba(255,255,255,0.5)); }
.ai-panel-head-actions { display: flex; gap: 3px; z-index: 1; }
.ai-head-btn {
    background: rgba(255,255,255,0.12); border: none; color: #fff;
    width: 28px; height: 28px; cursor: pointer; border-radius: 0;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.12s, transform 0.12s;
}
.ai-head-btn:hover { background: rgba(255,255,255,0.28); transform: translateY(-1px); }

/* ── Body / mesajlar ────────────────────────────────────────────── */
.ai-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f4f6f9;
    background-image: radial-gradient(600px 300px at 100% 0%, rgba(59,125,221,0.05), transparent 60%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.app-root.dark .ai-panel-body { background: #161b22; background-image: radial-gradient(600px 300px at 100% 0%, rgba(59,125,221,0.08), transparent 60%); }

.ai-notice {
    background: #fff; border: 1px solid #e2e8f0; border-left: 3px solid var(--yl-accent); padding: 16px; font-size: 0.82rem;
}
.app-root.dark .ai-notice { background: #1c2030; border-color: #30363d; border-left-color: var(--yl-accent); color: #e6edf3; }
.ai-notice strong { color: var(--yl-primary); }
.app-root.dark .ai-notice strong { color: #7ba7e8; }
.ai-notice p { margin: 6px 0 12px; color: #6b7280; }
.ai-notice-btn, .ai-notice-btn:hover {
    background: linear-gradient(135deg, var(--yl-primary) 0%, var(--yl-accent) 100%); color: #fff; border: none; padding: 8px 16px;
    cursor: pointer; border-radius: 0; font-weight: 600; font-size: 0.8rem; transition: transform 0.12s, box-shadow 0.12s;
}
.ai-notice-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,125,221,0.35); }

.ai-welcome { color: #6b7280; font-size: 0.84rem; animation: aiFadeIn 0.3s ease; }
.ai-welcome p { margin: 0 0 10px; }
.ai-suggestions { display: flex; flex-direction: column; gap: 6px; }
.ai-suggestions button {
    text-align: left; background: #fff; border: 1px solid #d0d5dd; border-left: 2px solid transparent; padding: 9px 12px;
    cursor: pointer; border-radius: 0; font-size: 0.8rem; color: #374151; font-weight: 500;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.ai-suggestions button:hover {
    background: #eef3fb; border-color: var(--yl-accent); border-left-color: var(--yl-accent);
    color: var(--yl-primary); transform: translateX(2px);
}
.app-root.dark .ai-suggestions button { background: #1c2030; border-color: #30363d; color: #adb5bd; }
.app-root.dark .ai-suggestions button:hover { background: #21283a; }

.ai-msg { display: flex; align-items: flex-end; gap: 6px; animation: aiMsgIn 0.22s ease; }
.ai-msg-user { justify-content: flex-end; }
.ai-msg-assistant { justify-content: flex-start; }

@keyframes aiMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes aiFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ai-msg-avatar {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
    color: #fff;
}
.ai-msg-avatar-ai { background: linear-gradient(135deg, var(--yl-primary) 0%, var(--yl-accent) 100%); }
.ai-msg-avatar-user { background: #6b7280; }

.ai-msg-bubble {
    max-width: 78%;
    padding: 9px 12px;
    font-size: 0.84rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-radius: 0;
}
.ai-msg-user .ai-msg-bubble { background: linear-gradient(135deg, var(--yl-accent) 0%, var(--yl-primary) 100%); color: #fff; box-shadow: 0 2px 8px rgba(59,125,221,0.25); }
.ai-msg-assistant .ai-msg-bubble { background: #fff; color: #1f2937; border: 1px solid #e2e8f0; border-left: 2px solid var(--yl-accent); }
.app-root.dark .ai-msg-assistant .ai-msg-bubble { background: #1c2030; color: #e6edf3; border-color: #30363d; border-left-color: var(--yl-accent); }

/* Yaziyor animasyonu */
.ai-typing { display: inline-flex; gap: 4px; align-items: center; }
.ai-typing span {
    width: 6px; height: 6px; background: var(--yl-accent); border-radius: 50%;
    animation: aiBlink 1.2s infinite both;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiBlink { 0%,80%,100% { opacity: 0.3; } 40% { opacity: 1; } }

/* ── Onay kartlari ──────────────────────────────────────────────── */
.ai-confirm-block {
    background: #fffbeb; border: 1px solid #fde68a; border-top: 3px solid #d97706; padding: 11px;
    animation: aiFadeIn 0.25s ease;
}
.app-root.dark .ai-confirm-block { background: rgba(120,80,15,0.18); border-color: #78350f; border-top-color: #d97706; }
.ai-confirm-head {
    font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
    color: #b45309; margin-bottom: 8px;
}
.app-root.dark .ai-confirm-head { color: #fbbf24; }

.ai-confirm-card {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: #fff; border: 1px solid #e2e8f0; padding: 8px 10px; margin-bottom: 6px;
    border-left: 3px solid #d97706; transition: opacity 0.15s;
}
.ai-confirm-card.rejected { opacity: 0.55; border-left-color: #9ca3af; }
.app-root.dark .ai-confirm-card { background: #1c2030; border-color: #30363d; }
.ai-confirm-title { font-size: 0.8rem; font-weight: 700; color: #1f2937; }
.app-root.dark .ai-confirm-title { color: #e6edf3; }
.ai-confirm-summary { font-size: 0.76rem; color: #6b7280; margin-top: 1px; }
.ai-confirm-toggle { display: flex; gap: 2px; flex-shrink: 0; }
.ai-tg {
    border: 1px solid #d1d5db; background: #fff; color: #6b7280;
    font-size: 0.68rem; font-weight: 700; padding: 3px 8px; cursor: pointer; border-radius: 0;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ai-tg-yes.on { background: #16a34a; color: #fff; border-color: #16a34a; }
.ai-tg-no.on  { background: #dc2626; color: #fff; border-color: #dc2626; }
.app-root.dark .ai-tg { background: #161b22; border-color: #30363d; }

.ai-confirm-apply {
    width: 100%; margin-top: 5px; background: linear-gradient(135deg, #d97706, #b45309); color: #fff; border: none;
    padding: 9px; font-size: 0.82rem; font-weight: 700; cursor: pointer; border-radius: 0;
    transition: transform 0.12s, box-shadow 0.12s;
}
.ai-confirm-apply:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(217,119,6,0.35); }
.ai-confirm-apply:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }

.ai-error {
    background: #fef2f2; border: 1px solid #fecaca; border-left: 3px solid #dc2626; color: #dc2626;
    padding: 9px 11px; font-size: 0.8rem;
}
.app-root.dark .ai-error { background: rgba(127,29,29,0.2); border-color: #7f1d1d; border-left-color: #dc2626; color: #fca5a5; }

/* ── Input ──────────────────────────────────────────────────────── */
.ai-panel-input {
    display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid #d0d5dd;
    flex-shrink: 0;
}
.app-root.dark .ai-panel-input { background: #0d1117; border-top-color: #30363d; }
.ai-panel-input textarea {
    flex: 1; resize: none; border: 1px solid #d0d5dd; padding: 9px 11px;
    font-size: 0.84rem; font-family: inherit; border-radius: 0; max-height: 120px;
    color: #1f2937; line-height: 1.4; transition: border-color 0.15s, box-shadow 0.15s;
}
.ai-panel-input textarea:focus {
    outline: none; border-color: var(--yl-accent); box-shadow: 0 0 0 3px rgba(59,125,221,0.15);
}
.app-root.dark .ai-panel-input textarea { background: #161b22; border-color: #30363d; color: #e6edf3; }
.ai-send-btn {
    background: linear-gradient(135deg, var(--yl-primary) 0%, var(--yl-accent) 100%); color: #fff; border: none; width: 42px; cursor: pointer;
    border-radius: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: transform 0.12s, box-shadow 0.12s;
}
.ai-send-btn:hover:not(:disabled) { transform: translateY(-1px) scale(1.04); box-shadow: 0 4px 12px rgba(59,125,221,0.4); }
.ai-send-btn:disabled { opacity: 0.5; cursor: default; }

/* ═══════════ AYARLAR MODAL ═══════════ */
.ai-set-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1500; }
.ai-set-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
    z-index: 1510; width: 540px; max-width: 94vw; max-height: 90vh; overflow: hidden;
    background: #fff; border: 1px solid #d0d5dd; box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
}
.app-root.dark .ai-set-modal { background: #0d1117; border-color: #30363d; }
.ai-set-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: linear-gradient(120deg, var(--yl-primary-dark, #0f2548) 0%, var(--yl-primary, #1a3a6b) 100%); color: #fff; font-weight: 700; font-size: 0.92rem;
}
.ai-set-close { background: none; border: none; color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.ai-set-tabs { display: flex; border-bottom: 1px solid #e2e8f0; background: #f8f9fb; flex-shrink: 0; }
.app-root.dark .ai-set-tabs { background: #161b22; border-bottom-color: #30363d; }
.ai-set-tab {
    flex: 1; padding: 10px; background: none; border: none; border-bottom: 2px solid transparent;
    cursor: pointer; font-size: 0.82rem; font-weight: 600; color: #6b7280;
}
.ai-set-tab.active { color: #3b7ddd; border-bottom-color: #3b7ddd; background: #fff; }
.app-root.dark .ai-set-tab.active { background: #0d1117; }
.ai-set-body { padding: 16px; overflow-y: auto; }

.ai-set-field { margin-bottom: 11px; }
.ai-set-field label { display: block; font-size: 0.74rem; font-weight: 600; color: #6b7280; margin-bottom: 3px; }
.ai-set-field input {
    width: 100%; box-sizing: border-box; border: 1px solid #d0d5dd; padding: 7px 9px;
    font-size: 0.82rem; border-radius: 0; color: #1f2937;
}
.app-root.dark .ai-set-field input { background: #161b22; border-color: #30363d; color: #e6edf3; }
.ai-set-row2 { display: flex; gap: 10px; }
.ai-set-row2 .ai-set-field { flex: 1; }
.ai-set-row3 { display: flex; gap: 10px; align-items: flex-end; }
.ai-set-row3 .ai-set-field { flex: 1; }
.ai-set-narrow { max-width: 90px; }
.ai-set-sub { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #9ca3af; margin: 10px 0 6px; }
.ai-set-check { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: #374151; margin-bottom: 10px; cursor: pointer; }
.ai-set-check.ai-set-inline { margin-bottom: 9px; white-space: nowrap; }
.app-root.dark .ai-set-check { color: #adb5bd; }

.ai-set-msg { padding: 8px 10px; font-size: 0.78rem; margin: 6px 0; }
.ai-set-msg.ok  { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.ai-set-msg.err { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

.ai-set-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.ai-set-save {
    background: linear-gradient(135deg, var(--yl-primary) 0%, var(--yl-accent) 100%); color: #fff; border: none; padding: 8px 18px; font-weight: 700;
    font-size: 0.82rem; cursor: pointer; border-radius: 0; transition: transform 0.12s, box-shadow 0.12s;
}
.ai-set-save:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,125,221,0.35); }
.ai-set-save:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
.ai-set-test {
    background: #fff; color: #3b7ddd; border: 1px solid #3b7ddd; padding: 8px 14px; font-weight: 600;
    font-size: 0.82rem; cursor: pointer; border-radius: 0;
}
.ai-set-test:hover { background: #eef3fb; }
.app-root.dark .ai-set-test { background: transparent; }
.ai-set-note { font-size: 0.7rem; color: #9ca3af; margin-top: 10px; line-height: 1.4; }

@media (max-width: 560px) {
    .ai-panel { width: 100vw; max-width: 100vw; }
    .ai-set-row2, .ai-set-row3 { flex-direction: column; gap: 0; align-items: stretch; }
    .ai-set-narrow { max-width: none; }
}
