/* ============================================
   Chatbot2 Styles — Modularized from chatbot2.php
   ============================================ */

/* CSS Variables — Light Mode */
:root {
    --chatbot-bg: #f8f9fa;
    --chatbot-card-bg: #ededf5;
    --chatbot-border: #e9ecef;
    --chatbot-text: #212529;
    --chatbot-text-muted: #6c757d;
}

/* Dark Mode Variables */
body.dark-mode {
    --chatbot-bg: #0a0a0f;
    --chatbot-card-bg: #151029;
    --chatbot-border: #2d2640;
    --chatbot-text: #e8e8f0;
    --chatbot-text-muted: #a8a8b3;
}

/* ============================================
   Layout
   ============================================ */
.chatbot-wrapper {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--chatbot-bg);
    overflow: hidden;
    z-index: 1;
}

.chatbot-container {
    display: flex;
    height: 100%;
    background: var(--chatbot-bg);
    position: relative;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ============================================
   Sidebar
   ============================================ */
.chat-sidebar {
    width: 280px;
    background: var(--chatbot-card-bg);
    border-right: 1px solid var(--chatbot-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--chatbot-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--chatbot-card-bg);
}

.chat-sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.new-chat-btn {
    background: #6236ff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: var(--chatbot-card-bg);
}

/* Conversation date groups */
.chat-history-group {
    margin-bottom: 4px;
}

.chat-history-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--chatbot-text-muted);
    padding: 8px 12px 4px;
}

.chat-history-item {
    padding: 12px;
    margin-bottom: 4px;
    background: var(--chatbot-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.chat-history-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.chat-history-item.active {
    background: rgba(102, 126, 234, 0.15);
}

.chat-history-item-content {
    padding-right: 24px;
}

.chat-history-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-history-item-time {
    font-size: 0.75rem;
    color: var(--chatbot-text-muted);
}

.chat-history-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    color: #666;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.chat-history-item:hover .chat-history-delete-btn {
    opacity: 1;
}

.chat-history-delete-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    transform: scale(1.1);
}

/* Sidebar overlay backdrop (mobile) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* ============================================
   Chat Main Area
   ============================================ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    max-width: 100%;
}

.chat-header {
    padding: 16px 20px;
    background: var(--chatbot-card-bg);
    border-bottom: 1px solid var(--chatbot-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-header-left img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.chat-header-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-toggle {
    display: none;
    background: rgba(102, 126, 234, 0.1);
    color: #6236ff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.sidebar-toggle ion-icon {
    font-size: 24px;
}

/* ============================================
   Messages
   ============================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(200px + env(safe-area-inset-bottom));
    scroll-behavior: smooth;
}

.message-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: messageSlideIn 0.3s ease;
}

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

.message-item.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--chatbot-card-bg);
    border: 1px solid var(--chatbot-border);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.user-message .message-bubble {
    background: #6236ff;
    color: white;
    border: none;
}

.message-time {
    font-size: 0.75rem;
    color: var(--chatbot-text-muted);
    margin-top: 4px;
}

/* Message actions (feedback, copy, regenerate) */
.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-item:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    background: transparent;
    border: 1px solid var(--chatbot-border);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--chatbot-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.msg-action-btn:hover {
    background: rgba(98, 54, 255, 0.1);
    border-color: rgba(98, 54, 255, 0.3);
    color: #6236ff;
}

.msg-action-btn.active {
    color: #6236ff;
    border-color: rgba(98, 54, 255, 0.3);
}

/* Code block copy button */
.code-block-wrapper {
    position: relative;
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ccc;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.code-copy-btn.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* Markdown table styles */
.message-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
    font-size: 0.85rem;
}

.message-bubble table th,
.message-bubble table td {
    border: 1px solid var(--chatbot-border);
    padding: 8px 12px;
    text-align: left;
}

.message-bubble table th {
    background: rgba(98, 54, 255, 0.1);
    font-weight: 600;
}

/* Genel görsel stili — TradingView grafikleri, haber görselleri vb. */
/* Bubble genişliğine sığdır, köşeleri yuvarlat, tıklanabilir yap */
.message-bubble img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.message-bubble img:hover {
    opacity: 0.85;
}

/* Coin logo styles — inline with text, rounded */
/* Sabit boyut + background ile innerHTML güncellendiğinde yanıp sönme engellenir */
/* IMPORTANT: coin-inline-logo overrides the general img styles above */
.message-bubble img.coin-inline-logo {
    height: 20px;
    width: 20px;
    min-height: 20px;
    min-width: 20px;
    max-width: 20px;
    object-fit: contain;
    border-radius: 50%;
    vertical-align: middle;
    margin: 0 3px;
    display: inline-block;
    flex-shrink: 0;
    background: rgba(255,255,255,0.08);
    cursor: default;
}

.message-bubble img.coin-inline-logo:hover {
    opacity: 1;
}

.message-bubble a {
    color: #6236ff;
    text-decoration: underline;
}

.message-bubble a:hover {
    color: #7347ff;
}

/* ============================================
   Quick Replies
   ============================================ */
.quick-replies {
    padding: 12px 0;
    display: none;
    overflow: hidden;
    position: sticky;
    bottom: calc(80px + 56px + 20px + env(safe-area-inset-bottom));
    background: var(--chatbot-bg);
    z-index: 99;
    margin-bottom: -12px;
}

.quick-replies.show {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-replies-row {
    display: flex;
    overflow: hidden;
    position: relative;
}

.quick-replies-track {
    display: flex;
    gap: 10px;
    will-change: transform;
}

.quick-replies-row:nth-child(1) .quick-replies-track {
    animation: scrollLeft 40s linear infinite;
}

.quick-replies-row:nth-child(2) .quick-replies-track {
    animation: scrollRight 35s linear infinite;
}

.quick-replies-track:hover {
    animation-play-state: paused;
}

@keyframes scrollLeft {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes scrollRight {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}

.quick-reply-btn {
    padding: 10px 18px;
    background: rgba(98, 54, 255, 0.08);
    border: 1.5px solid rgba(98, 54, 255, 0.2);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    white-space: nowrap;
    color: var(--chatbot-text);
    font-size: 0.85rem;
    font-weight: 500;
    flex-shrink: 0;
}

.quick-reply-btn:hover {
    background: rgba(98, 54, 255, 0.15);
    border-color: rgba(98, 54, 255, 0.4);
    transform: translateY(-1px);
}

/* ============================================
   Input Area
   ============================================ */
.chat-input-wrapper {
    position: sticky;
    bottom: calc(56px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: var(--chatbot-card-bg);
    border-top: 1px solid var(--chatbot-border);
    z-index: 100;
}

.chat-input-form {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.chat-input-container {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--chatbot-border);
    border-radius: 12px;
    background: var(--chatbot-bg);
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    min-height: 48px;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: #6236ff;
    box-shadow: 0 0 0 3px rgba(98, 54, 255, 0.1);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    min-height: 48px;
    border-radius: 12px;
    background: #6236ff;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    align-self: flex-start;
}

.chat-send-btn:hover {
    background: #5129e6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(98, 54, 255, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Typing Indicator
   ============================================ */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6236ff;
    animation: typingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.empty-state ion-icon {
    font-size: 4rem;
    color: #6236ff;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--chatbot-text-muted);
    font-size: 0.9rem;
}

/* ============================================
   Position Cards & Interactive Components
   ============================================ */
.position-list-container { margin: 16px 0; }

.position-list-header {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border-left: 3px solid #6236ff;
}

.position-card {
    background: var(--chatbot-card-bg);
    border: 1px solid var(--chatbot-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.position-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.position-card.long { border-left: 4px solid #10b981; }
.position-card.short { border-left: 4px solid #ef4444; }

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.position-symbol { font-size: 1.1rem; font-weight: 600; }

.position-side-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.position-side-badge.long { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.position-side-badge.short { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.position-body { margin-bottom: 12px; }

.position-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
}

.position-label { color: var(--chatbot-text-muted); }
.position-value { font-weight: 500; }

.position-pnl {
    border-top: 1px solid var(--chatbot-border);
    margin-top: 8px;
    padding-top: 12px !important;
    font-size: 1rem !important;
}

.position-value.profit { color: #10b981; font-weight: 600; }
.position-value.loss { color: #ef4444; font-weight: 600; }

.position-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.position-btn {
    flex: 1;
    min-width: 100px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.position-btn.btn-danger { background: #ef4444; color: white; }
.position-btn.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }
.position-btn.btn-info { background: rgba(102, 126, 234, 0.1); color: #6236ff; border: 1px solid rgba(102, 126, 234, 0.3); }
.position-btn.btn-info:hover { background: rgba(102, 126, 234, 0.2); }

.position-empty { padding: 24px; text-align: center; color: var(--chatbot-text-muted); font-style: italic; }

/* Action Result Cards */
.action-result {
    background: var(--chatbot-card-bg);
    border: 1px solid var(--chatbot-border);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    text-align: center;
}

.action-result.success { background: rgba(16, 185, 129, 0.05); }

.result-icon { font-size: 3rem; margin-bottom: 12px; }
.result-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.result-details { color: var(--chatbot-text-muted); margin-bottom: 16px; }
.result-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.result-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-btn.btn-primary { background: #6236ff; color: white; }
.result-btn.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); }
.result-btn.btn-success { background: #10b981; color: white; }
.result-btn.btn-success:hover { background: #059669; transform: translateY(-2px); }
.result-btn.btn-info { background: rgba(102, 126, 234, 0.1); color: #6236ff; border: 1px solid rgba(102, 126, 234, 0.3); }
.result-btn.btn-info:hover { background: rgba(102, 126, 234, 0.2); }

/* ============================================
   Formation Card Styles
   ============================================ */
.formation-analysis-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 12px;
}

.formation-header {
    background: #6236ff;
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.formation-title { font-weight: 600; font-size: 15px; }
.formation-count { background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 12px; font-size: 13px; }

.formation-charts-grid {
    padding: 12px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(98, 54, 255, 0.3) transparent;
    scroll-padding-left: 12px;
}

.formation-charts-grid::-webkit-scrollbar {
    height: 4px;
}
.formation-charts-grid::-webkit-scrollbar-track {
    background: transparent;
}
.formation-charts-grid::-webkit-scrollbar-thumb {
    background: rgba(98, 54, 255, 0.3);
    border-radius: 4px;
}

.formation-chart-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    border: 2px solid transparent;
    /* 1.5 kart gorunsun: kart genisligi = %62 (100/1.5 ~= 66, peek icin %62) */
    min-width: 62%;
    max-width: 62%;
    flex-shrink: 0;
    scroll-snap-align: start;
}

.formation-chart-card.bullish { border-color: #10b981; background: rgba(16, 185, 129, 0.05); }
.formation-chart-card.bearish { border-color: #ef4444; background: rgba(239, 68, 68, 0.05); }
.formation-chart-card.neutral { border-color: #f59e0b; background: rgba(245, 158, 11, 0.05); }

.formation-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
}

.formation-type { font-weight: 600; font-size: 14px; color: #1f2937; }
.formation-timeframe { background: #6236FF; color: white; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.formation-direction { font-size: 12px; color: #6b7280; font-weight: 500; }
.formation-level { font-size: 12px; color: #f59e0b; font-weight: 600; }

.formation-chart-container { position: relative; height: 200px; background: white; border-radius: 6px; padding: 8px; }
.formation-chart-container canvas { max-height: 100%; }

.formation-empty { padding: 24px; text-align: center; color: #6b7280; }
.formation-empty p { margin: 0; }

.formation-list { padding: 8px; }

.formation-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 4px solid #ddd;
    background: #f8f9fa;
}

.formation-item.bullish { background: #ecfdf5; }
.formation-item.bearish { border-left-color: #ef4444; background: #fef2f2; }
.formation-item.neutral { border-left-color: #f59e0b; background: #fffbeb; }

.formation-icon { font-size: 24px; margin-right: 12px; min-width: 32px; text-align: center; }
.formation-details { flex: 1; }
.formation-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; color: #1f2937; }
.formation-desc { font-size: 13px; color: #6b7280; margin-bottom: 8px; }
.formation-tf { display: flex; flex-wrap: wrap; gap: 4px; }
.tf-badge { display: inline-block; background: rgba(102, 126, 234, 0.1); color: #6236ff; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ============================================
   TP/SL Modal
   ============================================ */
.tpsl-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpsl-modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.tpsl-modal-content {
    position: relative;
    background: var(--chatbot-card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.tpsl-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--chatbot-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tpsl-modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--chatbot-text); }

.tpsl-modal-close {
    background: none; border: none;
    font-size: 2rem;
    color: var(--chatbot-text-muted);
    cursor: pointer;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.tpsl-modal-close:hover { background: rgba(98, 54, 255, 0.1); color: #6236ff; }

.tpsl-modal-body { padding: 24px 20px; }

.tpsl-type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }

.tpsl-type-btn {
    padding: 12px 16px;
    border: 2px solid var(--chatbot-border);
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--chatbot-text);
}

.tpsl-type-btn ion-icon { font-size: 1.2rem; }
.tpsl-type-btn:hover { border-color: #6236ff; background: rgba(98, 54, 255, 0.05); }
.tpsl-type-btn.active { border-color: #6236ff; background: rgba(98, 54, 255, 0.1); color: #6236ff; }

.tpsl-input-group { margin-bottom: 16px; }
.tpsl-input-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--chatbot-text); font-size: 0.9rem; }

.tpsl-input-wrapper { position: relative; display: flex; align-items: center; }

.tpsl-input-wrapper input {
    flex: 1;
    padding: 12px 50px 12px 16px;
    border: 2px solid var(--chatbot-border);
    border-radius: 12px;
    background: var(--chatbot-bg);
    color: var(--chatbot-text);
    font-size: 1rem;
    transition: all 0.2s;
}

.tpsl-input-wrapper input:focus { outline: none; border-color: #6236ff; background: var(--chatbot-card-bg); }

.tpsl-input-suffix { position: absolute; right: 16px; font-weight: 600; color: #6236ff; font-size: 1.1rem; }
.tpsl-input-hint { display: block; margin-top: 8px; font-size: 0.8rem; color: var(--chatbot-text-muted); }

.tpsl-modal-footer { padding: 16px 20px; border-top: 1px solid var(--chatbot-border); display: flex; gap: 12px; }

.tpsl-btn { flex: 1; padding: 12px 20px; border: none; border-radius: 12px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.tpsl-btn-cancel { background: var(--chatbot-border); color: var(--chatbot-text); }
.tpsl-btn-cancel:hover { background: var(--chatbot-text-muted); }
.tpsl-btn-confirm { background: #6236ff; color: white; }
.tpsl-btn-confirm:hover { background: #7347ff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(98, 54, 255, 0.3); }

/* ============================================
   Dark Mode Overrides
   ============================================ */
body.dark-mode .chat-input { background: var(--chatbot-card-bg); color: var(--chatbot-text); border-color: var(--chatbot-border); }
body.dark-mode .message-bubble { background: #1a1a2e; border-color: #3d3555; color: #e8e8f0; }
body.dark-mode .user-message .message-bubble { background: #6236ff; color: white; border: none; }
body.dark-mode .chat-history-item { background: #16162a; color: #e8e8f0; }
body.dark-mode .chat-history-item:hover { background: rgba(98, 54, 255, 0.15); }
body.dark-mode .chat-history-item.active { background: rgba(98, 54, 255, 0.2); }
body.dark-mode .chat-history-item-title { color: #e8e8f0; }
body.dark-mode .chat-history-item-time { color: #8888a0; }
body.dark-mode .chat-history-delete-btn { color: #999; }
body.dark-mode .chat-history-delete-btn:hover { background: rgba(220, 53, 69, 0.2); color: #ff6b6b; }
body.dark-mode .chat-header { background: #151029; border-bottom-color: #2d2640; }
body.dark-mode .chat-header-title { color: #e8e8f0; }
body.dark-mode .chat-header-subtitle { color: #8888a0; }
body.dark-mode .chat-input { background: #16162a; border-color: #3d3555; color: #e8e8f0; }
body.dark-mode .chat-input::placeholder { color: #6c6c80; }
body.dark-mode .chat-input:focus { border-color: #6236ff; background: #1a1a2e; }
body.dark-mode .chat-sidebar { background: #0f0f1a; border-right-color: #2d2640; }
body.dark-mode .sidebar-header { background: #0f0f1a; border-bottom-color: #2d2640; }
body.dark-mode .sidebar-header h3 { color: #e8e8f0; }
body.dark-mode .quick-reply-btn { background: rgba(98, 54, 255, 0.15); border-color: rgba(98, 54, 255, 0.3); color: #e8e8f0; }
body.dark-mode .quick-reply-btn:hover { background: rgba(98, 54, 255, 0.25); border-color: rgba(98, 54, 255, 0.5); }
body.dark-mode .send-btn { background: #6236ff; }
body.dark-mode .send-btn:hover { background: #7347ff; }
body.dark-mode .chat-messages { background: #0a0a0f; }
body.dark-mode .empty-state h3 { color: #e8e8f0; }
body.dark-mode .empty-state p { color: #8888a0; }
body.dark-mode .message-time { color: #6c6c80; }
body.dark-mode .position-card { background: #16213e; border-color: #0f3460; }
body.dark-mode .action-result { background: #16213e; border-color: #0f3460; }
body.dark-mode .position-list-header { background: rgba(102, 126, 234, 0.2); }
body.dark-mode .formation-analysis-card { background: #16213e; }
body.dark-mode .formation-charts-grid { scrollbar-color: rgba(98, 54, 255, 0.4) transparent; }
body.dark-mode .formation-charts-grid::-webkit-scrollbar-thumb { background: rgba(98, 54, 255, 0.4); }
body.dark-mode .formation-chart-card { background: #0f3460; }
body.dark-mode .formation-chart-card.bullish { background: rgba(16, 185, 129, 0.1); border-color: #10b981; }
body.dark-mode .formation-chart-card.bearish { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; }
body.dark-mode .formation-chart-card.neutral { background: rgba(245, 158, 11, 0.1); border-color: #f59e0b; }
body.dark-mode .formation-type { color: #e2e8f0; }
body.dark-mode .formation-direction { color: #94a3b8; }
body.dark-mode .formation-chart-container { background: #1a2332; }
body.dark-mode .formation-empty { color: #94a3b8; }
body.dark-mode .formation-item { background: #0f3460; }
body.dark-mode .formation-item.bullish { background: rgba(16, 185, 129, 0.1); }
body.dark-mode .formation-item.bearish { background: rgba(239, 68, 68, 0.1); }
body.dark-mode .formation-item.neutral { background: rgba(245, 158, 11, 0.1); }
body.dark-mode .formation-name { color: #e2e8f0; }
body.dark-mode .formation-desc { color: #94a3b8; }
body.dark-mode .tpsl-modal-content { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8); }
body.dark-mode .chat-history-group-title { color: #8888a0; }

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .chatbot-container { width: 100vw; max-width: 100%; overflow-x: hidden; }
    
    .chat-sidebar {
        position: fixed;
        left: 0; top: 56px;
        height: calc(100vh - 56px);
        z-index: 1000;
        transform: translateX(-100%);
        width: 280px;
        max-width: 80vw;
    }
    
    .chat-sidebar.show { transform: translateX(0); }
    .chat-main { width: 100%; max-width: 100vw; }
    .chat-header { width: 100%; padding: 12px 16px; }
    .chat-messages { width: 100%; padding: 16px 12px; padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
    .message-content { max-width: 85%; }
    
    .chat-input-wrapper {
        width: 100%;
        padding: 12px 16px;
        position: fixed;
        bottom: calc(56px + env(safe-area-inset-bottom));
        left: 0; right: 0;
        background: var(--chatbot-card-bg);
        z-index: 100;
    }
    
    .chat-input-form { width: 100%; max-width: 100%; }
    .chat-input { width: 100%; font-size: 16px; }
    
    .quick-replies {
        width: 100%; padding: 8px 0;
        bottom: calc(70px + 56px + 16px + env(safe-area-inset-bottom));
        gap: 6px;
    }
    
    .quick-replies-row { padding: 0 8px; }
    .quick-replies-track { gap: 8px; }
    .quick-reply-btn { padding: 7px 12px; font-size: 0.6rem; border-radius: 14px; }
    .sidebar-toggle { display: flex !important; }
    
    body, html { overflow-x: hidden; max-width: 100vw; }
    #appCapsule { overflow-x: hidden; max-width: 100vw; }
    
    /* Message actions always visible on mobile */
    .message-actions { opacity: 1; }
    
    /* Formation kartlari mobilde daha genis gorunsun — 1 + yarim kart */
    .formation-chart-card {
        min-width: 75%;
        max-width: 75%;
    }
    .formation-header { padding: 10px 12px; }
    .formation-title { font-size: 13px; }
    .formation-count { font-size: 11px; padding: 3px 8px; }
    .formation-chart-container { height: 170px; }
}

/* ============================================
   Suggestion Pills (AI-generated follow-up questions)
   ============================================ */
.suggestion-pills-container {
    padding: 8px 16px;
    animation: fadeInUp 0.3s ease;
}

.suggestion-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-pill {
    background: var(--chatbot-card-bg);
    border: 1px solid var(--chatbot-border);
    color: var(--chatbot-text);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.suggestion-pill:hover {
    background: rgba(98, 54, 255, 0.15);
    border-color: rgba(98, 54, 255, 0.4);
    color: #6236ff;
    transform: translateY(-1px);
}

body.dark-mode .suggestion-pill:hover {
    background: rgba(98, 54, 255, 0.2);
    border-color: rgba(98, 54, 255, 0.5);
    color: #a78bfa;
}

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

@media (max-width: 768px) {
    .suggestion-pills-container {
        padding: 8px 12px 4px 12px;
    }
    
    .suggestion-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }
    
    .suggestion-pills::-webkit-scrollbar {
        display: none;
    }
    
    .suggestion-pill {
        flex-shrink: 0;
        font-size: 0.75rem;
        padding: 6px 12px;
    }
}

/* ============================================
   Image Lightbox — tıklayınca büyük görüntüle
   ============================================ */
.chatbot-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: lightboxFadeIn 0.2s ease;
    cursor: zoom-out;
}

.chatbot-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.chatbot-lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.chatbot-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.chatbot-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
