﻿/* LiveAiMessage — desktop parity + modern chat + mobile */

.ai-chat-wrapper {
    /* Mevcut palet korunur; yalnızca vurgu renkleri temadan (fallback ile) okunur */
    --lam-bg: #ffffff;
    --lam-bg-muted: #f9fafb;
    --lam-border: #e5e7eb;
    --lam-text: #111827;
    --lam-text-muted: #6b7280;
    --lam-user-bg: #f3f4f6;
    --lam-user-border: #e5e7eb;
    --lam-ai-bg: #f7f8f8;
    --lam-ai-border: #e8eaea;
    --lam-ai-label: #0f766e;
    --lam-ai-title: #134e4a;
    --lam-accent: var(--primary, #0f766e);
    --lam-accent-hover: var(--secondary, #0d9488);
    --lam-danger: var(--danger, #ef4444);
    --lam-radius: 0;
    --lam-sidebar-w: 280px;
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    background: var(--lam-bg);
    border: none;
    border-radius: 0;
    overflow: hidden;
    margin: 0;
    box-shadow: none;
    font-size: 1rem;
}

.sod-tab-host:has(.ai-chat-wrapper),
.sod-tab-content-freeze:has(.ai-chat-wrapper),
.dt-card__body:has(.ai-chat-wrapper),
.dxbl-tabs-content-panel:has(.ai-chat-wrapper) {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    padding: 0 !important;
}

.sod-tab-host:has(.ai-chat-wrapper) > .sod-tab-content-freeze.is-active {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.ai-tools-backdrop {
    display: none;
}

.ai-tools-sidebar {
    width: var(--lam-sidebar-w);
    flex-shrink: 0;
    background: var(--lam-bg-muted);
    border-right: 1px solid var(--lam-border);
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, opacity 0.2s ease;
    overflow: hidden;
    z-index: 30;
}

.ai-tools-sidebar.collapsed {
    width: 0;
    border-right: none;
    opacity: 0;
    pointer-events: none;
}

.lam-sidebar-header {
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--lam-border);
    gap: 0.5rem;
}

.lam-sidebar-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--lam-text);
}

.lam-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--lam-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.lam-icon-btn:hover:not(:disabled) {
    background: #e5e7eb;
    color: var(--lam-text);
}

.lam-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.lam-icon-btn.active-rec {
    background: #fee2e2;
    color: #991b1b;
    animation: lam-pulse-red 1.5s infinite;
}

.lam-sidebar-body {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overflow-y: auto;
    min-height: 0;
}

.lam-sidebar-hint {
    font-size: 0.8rem;
    color: var(--lam-text-muted);
    line-height: 1.35;
    margin: 0;
}

.lam-tool-search {
    border-radius: 8px;
    border: 1px solid var(--lam-border);
    padding: 0.45rem 0.7rem;
    font-size: 0.875rem;
    width: 100%;
    background: #fff;
    color: var(--lam-text);
}

.lam-tool-search:focus {
    outline: none;
    border-color: var(--lam-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.lam-tools-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.lam-tool-group {
    background: #e5e7eb;
    padding: 0.70rem 0.55rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: #4b5563;
    border-radius: 6px;
    margin: 0.35rem 0 0.15rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.lam-tool-item {
    padding: 0.65rem 0.7rem;
    background: #fff;
    border: 1px solid var(--lam-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.lam-tool-item:hover,
.lam-tool-item.active {
    background: #eff6ff;
    border-color: #93c5fd;
}

.lam-tool-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--lam-text);
}

.lam-tool-desc {
    font-size: 0.8rem;
    color: var(--lam-text-muted);
    margin-top: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lam-tip-box {
    background: var(--lam-ai-bg);
    border: 1px solid var(--lam-ai-border);
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
    color: #166534;
    line-height: 1.4;
}

.lam-chat {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--lam-bg);
    position: relative;
}

.lam-header {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--lam-border);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: #fff;
    flex-shrink: 0;
}

.lam-header-title {
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--lam-text);
}

.lam-header-spacer {
    flex: 1;
}

.lam-lane {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: min(420px, 52vw);
    padding: 0.22rem 0.4rem 0.22rem 0.55rem;
    border: 1px solid var(--lam-border);
    border-radius: 999px;
    background: var(--lam-bg-muted);
    color: var(--lam-text);
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: .01em;
    flex-shrink: 1;
    min-width: 0;
}

.lam-lane-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #94a3b8;
}

.lam-lane-k {
    flex: 0 0 auto;
}

.lam-lane-v {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 550;
    color: var(--lam-text-muted);
    padding-left: 0.35rem;
    border-left: 1px solid var(--lam-border);
}

.lam-lane-support .lam-lane-dot { background: #64748b; }
.lam-lane-agent .lam-lane-dot { background: #0f766e; }
.lam-lane-vision .lam-lane-dot { background: #b45309; }
.lam-lane-coder .lam-lane-dot { background: #1d4ed8; }

.lam-lane-support { background: #f8fafc; }
.lam-lane-agent { background: #f0fdfa; border-color: #99f6e4; }
.lam-lane-vision { background: #fffbeb; border-color: #fde68a; }
.lam-lane-coder { background: #eff6ff; border-color: #bfdbfe; }

.lam-lane.is-switch {
    cursor: pointer;
}

.lam-lane.is-switch:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.lam-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: min(280px, 42vw);
    padding: 0.2rem 0.35rem 0.2rem 0.7rem;
    border: 1px solid var(--lam-border);
    border-radius: 999px;
    background: var(--lam-bg-muted);
    color: var(--lam-text);
    font-size: 0.78rem;
    font-weight: 600;
}

.lam-tool-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lam-chip-x {
    border: none;
    background: transparent;
    color: var(--lam-text-muted);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    font-size: 1rem;
}

.lam-chip-x:hover:not(:disabled) {
    background: #e5e7eb;
    color: var(--lam-text);
}

.lam-ghost-btn.on {
    background: #ecfdf5;
    border-color: #99f6e4;
    color: #0f766e;
}

.lam-messages {
    flex: 1;
    padding: 1rem 1.25rem 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--lam-bg);
    min-height: 0;
}

.lam-empty {
    margin: auto;
    max-width: 28rem;
    text-align: center;
    padding: 0.5rem 1.25rem;
}

.lam-empty h3 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -.02em;
    color: var(--lam-text);
}

.lam-empty p {
    margin: 0;
    font-size: 0.92rem;
    color: var(--lam-text-muted);
    line-height: 1.5;
}

.lam-bubble {
    max-width: 75%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 1.05rem;
    line-height: 1.55;
    word-break: break-word;
    border: 1px solid transparent;
    position: relative;
}

.lam-bubble.user {
    align-self: flex-end;
    max-width: min(640px, 85%);
    background: var(--lam-user-bg);
    border-color: var(--lam-user-border);
    color: var(--lam-text);
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

.lam-bubble.ai {
    align-self: stretch;
    max-width: 100%;
    background: var(--lam-ai-bg);
    border-color: var(--lam-ai-border);
    color: var(--lam-text);
    border-bottom-left-radius: 4px;
}

.lam-assistant-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--lam-ai-label);
    margin-bottom: 0.4rem;
}

.lam-md-body {
    white-space: normal;
}

.lam-md-body p {
    margin: 0 0 0.5rem;
}

.lam-md-body p:last-child {
    margin-bottom: 0;
}

.lam-md-body ul,
.lam-md-body ol {
    margin: 0.25rem 0 0.5rem 1.15rem;
}

.lam-md-body pre {
    background: #f3f4f6;
    padding: 0.55rem 0.65rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
}

.lam-md-body code {
    font-size: 0.8em;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

.lam-md-body pre code {
    background: transparent;
    padding: 0;
}

.lam-md-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.4rem 0;
    font-size: 0.9rem;
}

.lam-md-body th,
.lam-md-body td {
    border: 1px solid #d1d5db;
    padding: 0.3rem 0.45rem;
}

.lam-msg-actions {
    margin-top: 0.45rem;
    opacity: 0.55;
    transition: opacity 0.15s;
}

.lam-bubble.ai:hover .lam-msg-actions {
    opacity: 1;
}

.lam-copy-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.15rem 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.lam-copy-btn:hover {
    color: var(--lam-text);
}

.lam-suggestions {
    margin-top: 0.75rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--lam-border);
}

.lam-suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.lam-suggestions-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--lam-ai-title);
}

.lam-suggestions-hint {
    font-size: 0.8rem;
    color: var(--lam-text-muted);
    margin-bottom: 0.45rem;
}

.lam-suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.lam-suggestion-chip {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.88rem;
    color: var(--lam-text);
    margin: 0;
    cursor: pointer;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--lam-border);
    border-radius: 8px;
    background: #fff;
    transition: background 0.15s, border-color 0.15s;
}

.lam-suggestion-chip:hover {
    background: var(--lam-bg-muted);
    border-color: #cbd5e1;
}

.lam-suggestion-chip input {
    margin-top: 0.15rem;
}

.lam-thinking {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: var(--lam-bg-muted);
    color: var(--lam-text-muted);
    border: 1px solid var(--lam-border);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
}

.lam-dots {
    display: inline-flex;
    gap: 3px;
}

.lam-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--lam-text-muted);
    opacity: 0.35;
    animation: lam-dot 1.2s infinite ease-in-out;
}

.lam-dots span:nth-child(2) { animation-delay: 0.15s; }
.lam-dots span:nth-child(3) { animation-delay: 0.3s; }

.lam-attachment {
    margin: 0 0.85rem;
    background: var(--lam-bg-muted);
    border: 1px dashed var(--lam-border);
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #4b5563;
    gap: 0.5rem;
}

.lam-attachment-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lam-composer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--lam-border);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex-shrink: 0;
}

.lam-param-form {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.75rem;
    max-height: 320px;
    overflow-y: auto;
}

.lam-param-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--lam-text);
    margin-bottom: 0.5rem;
}

.lam-param-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
}

.lam-param-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.lam-param-label {
    font-size: 0.82rem;
    font-weight: 650;
    color: #374151;
}

.lam-param-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
    background: #fff;
    color: var(--lam-text);
}

.lam-ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--lam-border);
    background: #fff;
    color: #334155;
    cursor: pointer;
    min-height: 34px;
}

.lam-ghost-btn:hover:not(:disabled) {
    background: #f3f4f6;
}

.lam-ghost-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lam-input-shell {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    background: #fff;
    border: 1px solid var(--lam-border);
    border-radius: 12px;
    padding: 0.55rem 0.65rem 0.5rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.lam-input-shell:focus-within {
    border-color: var(--lam-accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.lam-prompt {
    width: 100%;
    border: none;
    resize: none;
    min-height: 52px;
    max-height: 140px;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--lam-text);
    background: transparent;
    padding: 0.15rem 0.2rem;
}

.lam-prompt:focus {
    outline: none;
}

.lam-prompt:disabled {
    opacity: 0.6;
}

.lam-composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.lam-composer-left,
.lam-composer-right {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.lam-menu-wrap {
    position: relative;
}

.lam-overflow-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--lam-border);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    padding: 0.35rem;
    z-index: 40;
}

.lam-overflow-menu button,
.lam-overflow-menu label {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.45rem;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 550;
    color: #374151;
    cursor: pointer;
}

.lam-overflow-menu button:hover:not(:disabled),
.lam-overflow-menu label:hover {
    background: #f3f4f6;
}

.lam-overflow-menu button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.lam-mic-select {
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    padding: 0.35rem;
    border: 1px solid var(--lam-border);
    border-radius: 6px;
}

.lam-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 44px;
    min-height: 40px;
    padding: 0.4rem 0.95rem;
    border-radius: 10px;
    border: none;
    background: var(--lam-accent);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 650;
    cursor: pointer;
}

.lam-send:hover:not(:disabled) {
    background: var(--lam-accent-hover);
}

.lam-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.lam-send.stop {
    background: var(--lam-danger);
}

.lam-send.stop:hover:not(:disabled) {
    background: #dc2626;
}

@keyframes lam-pulse-red {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes lam-dot {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

/* Tablet + phone: drawer overlay, compact chrome, reclaim footer space */
@media (max-width: 991.98px) {
    /* Hide MainLayout footer (incl. mb-10) only while this page is open */
    body:has(.ai-chat-wrapper) footer.card-footer {
        display: none !important;
    }

    /* Hide floating mobile SoDToolBar + İşlem Merkezi FAB on this page only */
    body:has(.ai-chat-wrapper) .mobile-toolbar,
    body:has(.ai-chat-wrapper) .mobile-toolbar.mobile-toolbar-open,
    body:has(.ai-chat-wrapper) .mobile-toolbar-collapsed,
    body:has(.ai-chat-wrapper) .mobile-toolbar-toggle {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
        opacity: 0 !important;
    }

    body:has(.ai-chat-wrapper) .sod-operation-center-root,
    body:has(.ai-chat-wrapper) .sod-operation-center-root .SoDOperationIcon,
    body:has(.ai-chat-wrapper) .sod-operation-center-root .expand-mobile {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .ai-chat-wrapper {
        margin: 0;
        width: 100%;
        height: calc(100dvh - var(--HeaderHeight, 4.5rem));
        max-height: none;
        border-radius: 0;
        overflow: hidden;
    }

    .ai-tools-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.35);
        z-index: 25;
    }

    .ai-tools-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(88vw, 320px);
        max-width: 320px;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
        transform: translateX(0);
        transition: transform 0.25s ease, width 0.25s ease, opacity 0.2s ease;
        z-index: 30;
    }

    .ai-tools-sidebar.collapsed {
        width: 0;
        max-width: 0;
        box-shadow: none;
        transform: translateX(-100%);
        opacity: 0;
        pointer-events: none;
    }

    .lam-header {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.5rem 0.65rem;
    }

    .lam-header .lam-btn-label {
        display: none;
    }

    .lam-header .lam-ghost-btn {
        min-width: 40px;
        padding: 0.35rem 0.55rem;
    }

    .lam-header-title {
        font-size: 0.88rem;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .lam-header-spacer {
        display: none;
    }

    .lam-mode-toggle {
        margin-left: auto;
    }

    .lam-mode-toggle button {
        padding: 0.35rem 0.55rem;
        font-size: 0.72rem;
        min-height: 36px;
    }

    .lam-messages {
        padding: 0.75rem;
        min-height: 0;
    }

    .lam-bubble.user {
        max-width: 92%;
    }

    .lam-bubble {
        font-size: 1rem !important;
        padding: 0.7rem 0.85rem;
    }

    .lam-msg-actions {
        opacity: 1;
    }

    .lam-param-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .lam-param-form {
        max-height: 40vh;
    }

    .lam-composer {
        padding: 0.55rem 0.65rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    }

    .lam-prompt {
        font-size: 1rem !important;
        min-height: 44px;
    }

    .lam-ghost-btn,
    .lam-suggestion-chip {
        min-height: 44px;
    }

    .lam-icon-btn,
    .lam-send {
        min-width: 44px;
        min-height: 44px;
    }

    .lam-overflow-menu {
        left: auto;
        right: 0;
    }

    .lam-md-body table,
    .lam-md-body pre {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* SoDToolBar ≤1199.98px body padding-bottom rezervini bu sayfada kaldır */
@media (max-width: 1199.98px) {
    html:has(.ai-chat-wrapper),
    body:has(.ai-chat-wrapper) {
        padding-bottom: 0 !important;
    }

    body:has(.ai-chat-wrapper) .mobile-toolbar,
    body:has(.ai-chat-wrapper) .mobile-toolbar.mobile-toolbar-open,
    body:has(.ai-chat-wrapper) .mobile-toolbar-collapsed,
    body:has(.ai-chat-wrapper) .mobile-toolbar-toggle {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
        opacity: 0 !important;
    }
}

@media (max-width: 480px) {
    .lam-header-title {
        display: none;
    }

    .lam-send .lam-send-label {
        display: none;
    }

    .lam-send {
        padding: 0.4rem 0.65rem;
    }
}
