/* =========================================================
   TITAN SAVUNMA COGNITIVE CORE V3.0 | EXECUTIVE & CORPORATE STİL
   
   🔧 V3.0: Fütüristik neonlar silindi, ağır "Executive Navy & Titanium" eklendi.
   ========================================================= */

:root {
    --t-bg: #090c10; /* Derin Kurumsal Siyah */
    --t-panel-base: rgba(14, 20, 28, 0.95); /* Mat Antrasit */
    --t-panel-deep: #0e141c; 
    --t-border: rgba(255, 255, 255, 0.05);
    --t-border-strong: rgba(255, 255, 255, 0.1);
    
    --t-primary: #1e3a8a; /* Ağır Kurumsal Lacivert (Executive Navy) */
    --t-primary-hover: #1e40af;
    --t-primary-soft: rgba(30, 58, 138, 0.1);
    
    --t-titanium: #94a3b8; /* Titanyum / Gümüş Vurgular */
    --t-titanium-soft: rgba(148, 163, 184, 0.15);
    
    --t-accent: #059669; /* Mat Onay Yeşili (Online) */
    
    --t-text: #e2e8f0;
    --t-text-bright: #ffffff;
    --t-text-muted: #64748b;
    
    --t-ease: cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* =========================================================
   ✨ WRAPPER + TETİKLEYİCİ (SOLA HİZALI)
   ========================================================= */
#titan-ai-wrapper {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 999999;
    font-family: 'Inter', sans-serif;
}

#titan-ai-trigger {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--t-bg);
    border: 2px solid var(--t-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s var(--t-ease);
    display: flex;
    align-items: center;
    justify-content: center;
}

#titan-ai-trigger:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    border-color: var(--t-titanium);
}

#titan-ai-trigger img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    border-radius: 50%;
    transform: scale(1.15);
    transition: transform 0.3s var(--t-ease);
}

#titan-ai-trigger:hover img {
    transform: scale(1.18);
}

/* =========================================================
   ✨ ANA TERMİNAL PENCERESİ (SOLDAN AÇILIR)
   ========================================================= */
#titan-ai-window {
    position: absolute;
    bottom: 95px;
    left: 0;
    width: 380px;
    height: 560px; 
    background: var(--t-panel-deep);
    border: 1px solid var(--t-border-strong);
    border-radius: 4px; /* Keskin, kurumsal köşeler */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    animation: titanPop 0.3s var(--t-ease) forwards;
}

@keyframes titanPop {
    0% { opacity: 0; transform: scale(0.95) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* =========================================================
   ✨ HEADER
   ========================================================= */
#titan-ai-header {
    background: #090c10;
    padding: 16px 20px;
    border-bottom: 1px solid var(--t-border-strong);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#titan-ai-header .title {
    color: var(--t-titanium);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

#titan-ai-header .title::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--t-accent);
    border-radius: 50%;
    box-shadow: 0 0 4px var(--t-accent);
}

#titan-ai-close {
    color: var(--t-text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#titan-ai-close:hover {
    color: var(--t-text-bright);
}

/* =========================================================
   ✨ MESAJ ALANI (GÖVDE)
   ========================================================= */
#titan-ai-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--t-primary) transparent;
}

#titan-ai-body::-webkit-scrollbar { width: 4px; }
#titan-ai-body::-webkit-scrollbar-track { background: transparent; }
#titan-ai-body::-webkit-scrollbar-thumb { background: var(--t-primary); border-radius: 2px; }

/* MESAJ BALONLARI */
.t-msg {
    max-width: 85%;
    line-height: 1.6;
    font-size: 0.88rem;
    padding: 12px 16px;
    border-radius: 4px;
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    animation: msgFadeIn 0.3s ease-out forwards;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.t-msg.bot {
    background: #111827;
    color: var(--t-text);
    border-left: 3px solid var(--t-primary);
    align-self: flex-start;
}

.t-msg.user {
    background: var(--t-primary);
    color: var(--t-text-bright);
    align-self: flex-end;
    text-align: right;
}

/* =========================================================
   ✨ SEÇENEK BUTONLARI (CHIPS)
   ========================================================= */
#titan-ai-options {
    padding: 12px 20px;
    background: #090c10;
    border-top: 1px solid var(--t-border-strong);
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 250px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--t-primary) transparent;
}

.t-option-btn {
    background: transparent;
    color: var(--t-text);
    border: 1px solid var(--t-border-strong);
    padding: 10px 14px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    text-align: left;
    transition: all 0.2s ease;
    font-weight: 500;
}

.t-option-btn:hover {
    background: var(--t-primary-soft);
    border-color: var(--t-primary);
    color: var(--t-text-bright);
    padding-left: 18px; /* Hafif içeri kayma efekti */
}

/* =========================================================
   ✨ YENİ: FREE-TEXT CHAT INPUT BAR
   ========================================================= */
#titan-ai-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #090c10;
    border-top: 1px solid var(--t-border-strong);
}

#titan-ai-input {
    flex: 1;
    background: #111827;
    border: 1px solid var(--t-border-strong);
    color: var(--t-text-bright);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    padding: 10px 12px;
    border-radius: 3px;
    outline: none;
    transition: border-color 0.2s;
}

#titan-ai-input::placeholder {
    color: var(--t-text-muted);
}

#titan-ai-input:focus {
    border-color: var(--t-primary);
}

#titan-ai-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#titan-ai-send {
    width: 38px;
    height: 38px;
    background: var(--t-primary);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#titan-ai-send:hover:not(:disabled) {
    background: var(--t-primary-hover);
}

#titan-ai-send:disabled {
    background: var(--t-border-strong);
    color: var(--t-text-muted);
    cursor: not-allowed;
}

/* =========================================================
   ✨ MOBİL DUYARLILIK
   ========================================================= */
@media (max-width: 480px) {
    #titan-ai-wrapper {
        bottom: 20px;
        left: 20px;
    }
    
    #titan-ai-trigger {
        width: 65px;
        height: 65px;
    }
    
    #titan-ai-window {
        width: calc(100vw - 30px);
        height: 75vh;
        bottom: 80px;
        left: -5px;
        max-width: 400px;
    }
    
    #titan-ai-header { padding: 12px 16px; }
    #titan-ai-body { padding: 16px; }
    .t-msg { font-size: 0.82rem; }
    #titan-ai-options { padding: 10px 16px; }
    .t-option-btn { font-size: 0.78rem; padding: 8px 12px; }
    #titan-ai-input-bar { padding: 10px 16px; }
}

/* =========================================================
   V6 | HİBRİT SOHBET, SES VE ERİŞİLEBİLİRLİK
   ========================================================= */
#titan-ai-wrapper,
#titan-ai-wrapper * {
    box-sizing: border-box;
}

#titan-ai-wrapper [hidden] {
    display: none !important;
}

.titan-ai-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

#titan-ai-trigger {
    padding: 0;
    appearance: none;
}

#titan-ai-window.is-open {
    display: flex;
    height: min(650px, calc(100vh - 150px));
}

#titan-ai-header {
    gap: 12px;
    min-height: 68px;
}

.titan-ai-heading {
    min-width: 0;
}

#titan-ai-header .title {
    line-height: 1.25;
    letter-spacing: 0.08em;
}

#titan-ai-header .subtitle {
    margin: 5px 0 0 14px;
    color: var(--t-text-muted);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
}

.titan-ai-header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}

.titan-ai-icon-btn,
.titan-ai-input-btn {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--t-border-strong);
    border-radius: 4px;
    background: #111827;
    color: var(--t-text);
    font: 600 0.75rem/1 'Inter', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.titan-ai-icon-btn {
    width: 44px;
    height: 44px;
    padding: 0;
}

.titan-ai-icon-btn .fa,
.titan-ai-input-btn .fa {
    width: 1em;
    color: currentColor;
    font-size: 17px;
    line-height: 1;
    text-align: center;
    pointer-events: none;
}

#titan-ai-close {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
}

.titan-ai-icon-btn:hover:not(:disabled),
.titan-ai-input-btn:hover:not(:disabled),
.titan-ai-icon-btn.is-active {
    background: var(--t-primary);
    border-color: var(--t-primary-hover);
    color: var(--t-text-bright);
}

.titan-ai-icon-btn:focus-visible,
.titan-ai-input-btn:focus-visible,
#titan-ai-trigger:focus-visible,
.t-option-btn:focus-visible,
#titan-ai-input:focus-visible {
    outline: 3px solid #93c5fd !important;
    outline-offset: 2px !important;
}

.titan-ai-icon-btn:disabled,
.titan-ai-input-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#titan-ai-body {
    min-height: 120px;
}

#titan-ai-status {
    display: none;
    margin: 0;
    padding: 9px 20px;
    border-top: 1px solid transparent;
    color: var(--t-text-muted);
    background: #0b1119;
    font-size: 0.76rem;
    line-height: 1.4;
}

#titan-ai-status.is-visible {
    display: block;
}

#titan-ai-status.is-error {
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.35);
}

#titan-ai-status.is-warning {
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.35);
}

#titan-ai-status.is-success,
#titan-ai-status.is-listening {
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.35);
}

#titan-ai-options:empty {
    display: none;
}

.t-option-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    width: 100%;
    text-decoration: none;
}

.t-option-btn--cta {
    background: var(--t-primary);
    border-color: var(--t-primary-hover);
    color: var(--t-text-bright);
}

#titan-ai-privacy {
    margin: 0;
    padding: 9px 20px;
    color: #94a3b8;
    background: #090c10;
    border-top: 1px solid var(--t-border-strong);
    font-size: 0.7rem;
    line-height: 1.35;
}

#titan-ai-input-bar {
    margin: 0;
}

#titan-ai-input {
    min-width: 0;
    min-height: 44px;
}

#titan-ai-mic,
#titan-ai-send {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    flex: 0 0 44px;
}

#titan-ai-send {
    background: var(--t-primary);
    color: #fff;
}

#titan-ai-mic.is-listening {
    color: #fff;
    background: #b91c1c;
    border-color: #ef4444;
    animation: titanListening 1.2s ease-in-out infinite;
}

@keyframes titanListening {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

@media (prefers-reduced-motion: reduce) {
    #titan-ai-window,
    .t-msg,
    #titan-ai-mic.is-listening {
        animation: none !important;
    }
}

@media (max-width: 480px) {
    #titan-ai-window.is-open {
        width: calc(100vw - 24px);
        height: calc(100dvh - 105px);
        max-height: 760px;
        left: -8px;
        bottom: 76px;
    }

    #titan-ai-header {
        padding: 10px 12px;
    }

    #titan-ai-header .title {
        font-size: 0.78rem;
    }

    #titan-ai-header .subtitle {
        margin-left: 14px;
        font-size: 0.68rem;
    }

    #titan-ai-body,
    #titan-ai-options {
        padding-left: 12px;
        padding-right: 12px;
    }

    #titan-ai-status,
    #titan-ai-privacy {
        padding-left: 12px;
        padding-right: 12px;
    }

    #titan-ai-input-bar {
        padding: 10px 12px;
        gap: 6px;
    }

    #titan-ai-mic,
    #titan-ai-send {
        width: 44px;
        min-width: 44px;
        padding: 0;
        flex-basis: 44px;
    }
}
