/* AI Ana Sayfa - Gemini esintili, sağ chat */

.ai-simple {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-hero {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.08), #eef2ff);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.ai-hero__content.single {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-hero h1 {
    font-size: 28px;
    margin: 6px 0 10px;
}

.ai-hero .lead {
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 11px;
    color: var(--text-secondary);
    margin: 0;
}

.hero-badges,
.canvas-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid transparent;
    background: var(--border-color-light);
    color: var(--text-secondary);
}

.pill.success {
    background: rgba(16, 185, 129, 0.12);
    color: #0f5132;
    border-color: rgba(16, 185, 129, 0.2);
}

.pill.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue-dark);
    border-color: rgba(59, 130, 246, 0.2);
}

.pill.neutral {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.pill.subtle {
    font-size: 11px;
}

.pill.outline {
    background: transparent;
    border-color: var(--border-color);
}

.mini-pill {
    border-radius: 8px;
    background: var(--border-color-light);
    padding: 4px 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--border-color-light);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 6px 10px;
    border: 1px solid transparent;
    font-size: 13px;
}

.chip.secondary {
    background: #eef2ff;
    border-color: rgba(59, 130, 246, 0.25);
    color: var(--primary-blue-dark);
}

.chat-wrapper {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 520px;
}

.chat-header {
    padding: 14px;
    border-bottom: 1px solid var(--border-color-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-weight: 700;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--background);
}

/* OLD STYLES - REPLACED BY NEW DESIGN BELOW */

.chat-form {
    padding: 12px;
    border-top: 1px solid var(--border-color-light);
    background: var(--surface);
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-wrap input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 12px;
    font-size: 14px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    background: var(--background);
}

.input-wrap input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

.send-btn {
    border: none;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    color: white;
    padding: 10px 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.send-btn:disabled {
    opacity: 0.6;
}

.ghost-btn {
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
}

.quick-prompts {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-table {
    width: 100%;
    overflow-x: auto;
    margin-top: 8px;
}

.inline-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.table-thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #f9fafb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-link {
    color: #1f6feb;
    text-decoration: underline;
    font-weight: 600;
}

.table-thumb-link {
    display: inline-block;
}

/* Fancybox (AI sayfası) */
.fancybox__container {
    --fancybox-bg: rgba(10, 12, 14, 0.9);
    --fancybox-color: #fff;
    --fancybox-accent-color: #3b82f6;
    z-index: 13000;
}

.fancybox__slide {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.fancybox__content {
    max-width: 90vw;
    max-height: 90vh;
}

.fancybox__image {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    background: #0b0c0f;
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
}

.fancybox__thumbs {
    --fancybox-thumbs-width: 96px;
    --fancybox-thumbs-height: 96px;
}

.inline-table th,
.inline-table td {
    border: 1px solid var(--border-color);
    padding: 6px 8px;
}

.inline-table th {
    background: var(--border-color-light);
    font-weight: 600;
    color: var(--text-secondary);
}

.image-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.image-thumb {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    text-decoration: none;
    min-width: 96px;
}

.image-thumb img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #f9fafb;
}

.image-thumb:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
}

.image-caption {
    font-size: 12px;
    color: #4b5563;
}

@media (max-width: 1100px) {
    .chat-wrapper {
        min-height: 440px;
    }
}

/* ========================================
   AI CHAT LAYOUT - RESPONSIVE UI/UX
   ======================================== */

.ai-layout {
    display: flex;
    min-height: 100vh;
    background: #fff;
}

/* SIDEBAR OVERLAY (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* HAMBURGER MENU TOGGLE (Mobile) */
.menu-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e0e0e0;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.menu-toggle:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* APP BRANDING - HAKKE AI Logo */
.app-branding {
    position: fixed;
    top: 18px;
    left: 72px;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 1002;
    padding: 8px 16px 8px 12px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    pointer-events: none;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.3px;
}

/* SIDEBAR */
.ai-sidebar {
    width: 280px;
    min-width: 280px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-right: none;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 24px;
    padding-top: 40px;
}

.new-chat-btn {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 12px;
    padding-left: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.history-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 500;
}

.history-item i {
    color: rgba(255, 255, 255, 0.6);
}

/* NAV LINKS (Rapor, Ürünler) */
.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-item a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-item i {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    width: 20px;
    text-align: center;
}

/* SIDEBAR SECTIONS */
.sidebar-section {
    margin-bottom: 20px;
}

/* SIDEBAR FOOTER & NAV ICONS */
.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.sidebar-nav-icons {
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
}

.nav-icon-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-icon-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
}

/* MAIN CHAT AREA */
.ai-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    position: relative;
    height: 100vh;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 20px 140px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    scroll-behavior: smooth;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    max-width: 800px;
    padding: 40px 20px;
}

.welcome-content h1 {
    font-size: 32px;
    margin-bottom: 24px;
    color: #333;
}

.quick-prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    width: 100%;
    margin-top: 20px;
}

.prompt-card {
    background: #f5f7fb;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.prompt-card:hover {
    border-color: #0b57d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.prompt-card i {
    font-size: 20px;
    color: #0b57d0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    flex-shrink: 0;
}

.prompt-card span {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* CHAT MESSAGES */
.chat-messages {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 10px;
    min-height: min-content;
}

.chat-bubble {
    display: flex;
    gap: 12px;
    line-height: 1.6;
    font-size: 15px;
    width: 100%;
}

.chat-bubble.user {
    justify-content: flex-end;
}

.chat-bubble.user .message-content {
    background: #f0f4f9;
    padding: 12px 16px;
    border-radius: 18px;
    color: #1e293b;
    word-wrap: break-word;
    max-width: 70%;
    width: auto;
    display: inline-block;
}

/* AI Messages - No Bubble Style */
.chat-bubble.assistant {
    align-items: flex-start;
    gap: 12px;
}

.chat-bubble.assistant .ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-bubble.assistant .message-content {
    flex: 1;
    color: #1e293b;
    padding: 0;
    background: transparent;
}

.chat-bubble.assistant .ai-label {
    font-weight: 600;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
}

/* Thinking Indicator */
.chat-bubble.thinking {
    align-items: flex-start;
}

.chat-bubble.thinking .ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-bubble.thinking .thinking-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble.thinking .ai-label {
    font-weight: 600;
    font-size: 13px;
    color: #64748b;
}

.thinking-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 0;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: thinking-bounce 1.4s infinite ease-in-out;
}

.thinking-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.chat-meta {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* INPUT AREA */
/* INPUT AREA - FLOATING STYLE */
.input-area-wrapper {
    padding: 20px;
    display: flex;
    justify-content: center;
    background: linear-gradient(to top, rgba(255,255,255,1) 70%, rgba(255,255,255,0));
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    pointer-events: none;
}

.chat-form {
    width: 100%;
    max-width: 800px;
    pointer-events: auto;
    /* Re-enable clicks on form */
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    padding: 8px;
    transition: box-shadow 0.2s ease;
}

.chat-form:focus-within {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: #cbd5e1;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: transparent;
    padding: 4px 8px;
}

#chatInput {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 4px;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    max-height: 200px;
    font-family: inherit;
    color: #1e293b;
}

#chatInput:focus {
    outline: none;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    /* Rounded square */
    background: #0f172a;
    /* Dark elegant color */
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.send-btn:hover:not(:disabled) {
    background: #1e293b;
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: #94a3b8;
    opacity: 0.7;
    cursor: not-allowed;
}

.input-footer {
    display: none;
    /* Hide disclaimer for cleaner look, or style minimally */
}

/* DATA TABLES (Responsive) */
.inline-table {
    width: 100%;
    overflow-x: auto;
    margin-top: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}

.inline-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 400px;
}

.inline-table th,
.inline-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

.inline-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

.inline-table tr:last-child td {
    border-bottom: none;
}

.inline-table tr:hover {
    background: #f9f9f9;
}

/* ========================================
   RESPONSIVE MEDIA QUERIES
   ======================================== */

/* Desktop (1024px+) - Sidebar toggleable */
@media (min-width: 1024px) {
    .menu-toggle {
        display: flex;
        top: 20px;
        left: 20px;
        z-index: 1001;
    }

    .app-branding {
        display: flex;
    }

    .ai-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .ai-sidebar.open {
        left: 0;
    }

    /* Overlay on desktop when sidebar is open */
    .sidebar-overlay.active {
        display: block;
        opacity: 0.4;
    }

    /* Adjust input area - always full width on desktop */
    .input-area-wrapper {
        left: 0;
        width: 100%;
    }
}

/* Tablet (768px - 1023px) - Sidebar collapsible */
@media (max-width: 1023px) {
    .ai-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: none;
    }

    .ai-sidebar.open {
        left: 0;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.25);
    }

    .menu-toggle {
        display: flex;
    }

    .chat-container {
        padding: 14px 14px 130px 14px;
    }

    .welcome-content h1 {
        font-size: 28px;
    }

    .quick-prompts-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Mobile (< 768px) - Full mobile optimization */
@media (max-width: 767px) {
    .menu-toggle {
        top: 12px;
        left: 12px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .chat-container {
        padding: 12px 10px 120px 10px;
    }

    .welcome-content h1 {
        font-size: 24px;
    }

    .quick-prompts-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .prompt-card {
        padding: 12px;
    }

    .chat-messages {
        padding: 10px 5px;
        gap: 16px;
    }

    .chat-bubble {
        font-size: 14px;
    }

    #chatInput {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    .input-container {
        padding: 6px 12px;
    }

    .send-btn {
        width: 32px;
        height: 32px;
    }

    .inline-table {
        font-size: 11.5px;
        border-radius: 6px;
    }

    .inline-table th,
    .inline-table td {
        padding: 8px 10px;
    }

    .inline-table table {
        min-width: 300px;
    }
}

/* Extra small mobile (< 480px) */
@media (max-width: 479px) {
    .welcome-content h1 {
        font-size: 20px;
    }

    .prompt-card span {
        font-size: 13px;
    }

    .inline-table {
        font-size: 10.5px;
    }

    .inline-table th,
    .inline-table td {
        padding: 6px 8px;
    }
}
