/* --- Samet Fidancı Web Sitesi - AI ve Not Defteri Eklentisi Stilleri --- */

:root {
    --ai-primary: #D97757;
    --ai-primary-hover: #C66646;
    --ai-primary-glow: rgba(217, 119, 87, 0.25);
    --ai-bg-glass: rgba(255, 255, 255, 0.85);
    --ai-border: rgba(0, 0, 0, 0.08);
    --ai-text-main: #1a1a1a;
    --ai-text-muted: #666666;
    --ai-bubble-user: #f5eae5;
    --ai-bubble-bot: #f3f4f6;
    --ai-input-bg: #ffffff;
    --ai-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Dark mode uyumluluğu - otomatik geçiş */
html.dark, html[class*="dark"], html[data-theme="dark"], body.dark {
    --ai-bg-glass: rgba(26, 26, 26, 0.95);
    --ai-border: rgba(255, 255, 255, 0.08);
    --ai-text-main: #f3f4f6;
    --ai-text-muted: #a1a1aa;
    --ai-bubble-user: #3a221a;
    --ai-bubble-bot: #2d2d2d;
    --ai-input-bg: #2d2d2d;
    --ai-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
}

/* --- YÜZEN ASİSTAN BUTONU (FAB) --- */
.ai-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-hover));
    box-shadow: 0 4px 12px rgba(217, 119, 87, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    border: none;
    outline: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-fab:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 6px 16px rgba(217, 119, 87, 0.40);
}

.ai-fab svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
    transition: transform 0.3s ease;
}

.ai-fab.active svg {
    transform: rotate(90deg);
}

/* --- ASİSTAN ÇEKMECESİ (DRAWER) --- */
.ai-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100%;
    background: var(--ai-bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--ai-shadow);
    border-left: 1px solid var(--ai-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Montserrat', sans-serif;
    color: var(--ai-text-main);
}

@media (max-width: 480px) {
    .ai-drawer {
        width: 100%;
        right: -100%;
    }
}

.ai-drawer.open {
    right: 0;
}

/* Header */
.ai-header {
    padding: 20px;
    border-bottom: 1px solid var(--ai-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
}

.ai-header-title svg {
    width: 22px;
    height: 22px;
    color: var(--ai-primary);
}

.ai-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--ai-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.ai-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--ai-text-main);
}

/* Sekmeler (Tabs) */
.ai-tabs {
    display: flex;
    border-bottom: 1px solid var(--ai-border);
    background: rgba(0, 0, 0, 0.02);
}

.ai-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: transparent;
    border: none;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ai-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.ai-tab:hover {
    color: var(--ai-text-main);
}

.ai-tab.active {
    color: var(--ai-primary);
    border-bottom-color: var(--ai-primary);
}

/* Tab İçerikleri */
.ai-tab-content {
    flex: 1;
    overflow-y: auto;
    display: none;
    position: relative;
}

.ai-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* --- YAPAY ZEKA SOHBET ALANI --- */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: ai-message-fade 0.3s ease-out forwards;
}

@keyframes ai-message-fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message.bot {
    background: var(--ai-bubble-bot);
    color: var(--ai-text-main);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.ai-message.user {
    background: var(--ai-bubble-user);
    color: var(--ai-text-main);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(2, 183, 104, 0.05);
}

.ai-message-notice {
    font-size: 0.75rem;
    color: var(--ai-text-muted);
    font-style: italic;
    margin-top: 6px;
    border-top: 1px dashed var(--ai-border);
    padding-top: 4px;
}

/* Öneri Soruları */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
}

.ai-suggestion-btn {
    background: transparent;
    border: 1px solid var(--ai-primary);
    color: var(--ai-primary);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-suggestion-btn:hover {
    background: var(--ai-primary);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Chat Input */
.ai-chat-input-container {
    padding: 15px 20px 25px;
    border-top: 1px solid var(--ai-border);
    display: flex;
    gap: 10px;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid var(--ai-border);
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 0.9rem;
    outline: none;
    background: var(--ai-input-bg);
    color: var(--ai-text-main);
    transition: all 0.2s ease;
    resize: none;
    height: 42px;
    max-height: 120px;
}

.ai-chat-input::placeholder {
    color: var(--ai-text-muted);
}

.ai-chat-input:focus {
    border-color: var(--ai-primary);
    background: var(--ai-input-bg);
    box-shadow: 0 0 0 3px var(--ai-primary-glow);
}

.ai-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--ai-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.ai-send-btn:hover {
    background: var(--ai-primary-hover);
    transform: scale(1.05);
}

.ai-send-btn svg {
    width: 18px;
    height: 18px;
}

/* Yazıyor Animasyonu */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--ai-bubble-bot);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--ai-text-muted);
    border-radius: 50%;
    animation: ai-bounce 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ai-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --- SAYFA NOTLARI ALANI --- */
.ai-notes-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-notes-welcome {
    font-size: 0.85rem;
    color: var(--ai-text-muted);
    line-height: 1.6;
    background: rgba(2, 183, 104, 0.05);
    border-left: 3px solid var(--ai-primary);
    padding: 12px;
    border-radius: 4px;
}

.ai-note-card {
    border: 1px solid var(--ai-border);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    transition: all 0.2s ease;
}

.ai-note-card:hover {
    border-color: var(--ai-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.ai-note-quote {
    font-size: 0.8rem;
    color: var(--ai-text-muted);
    font-style: italic;
    border-left: 2px solid #ccc;
    padding-left: 8px;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-note-text {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
}

.ai-note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.ai-note-date {
    font-size: 0.7rem;
    color: var(--ai-text-muted);
}

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

.ai-note-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.ai-note-btn-go {
    color: var(--ai-primary);
}

.ai-note-btn-go:hover {
    background: rgba(2, 183, 104, 0.1);
}

.ai-note-btn-del {
    color: #ef4444;
}

.ai-note-btn-del:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Tüm Notlar İçin Ekstra */
.ai-notes-toggle-scope {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.ai-notes-scope-title {
    font-weight: 700;
    font-size: 0.9rem;
}

.ai-notes-scope-btn {
    font-size: 0.75rem;
    color: var(--ai-primary);
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.ai-notes-scope-btn:hover {
    text-decoration: underline;
}

/* Boş Durum */
.ai-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--ai-text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.ai-empty-state svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
}

/* --- VURGULAMA VE METİN SEÇİM ARAÇLARI --- */

/* Vurgulanmış Metinler */
.site-highlight {
    background: rgba(217, 119, 87, 0.20);
    border-bottom: 2px dashed rgba(217, 119, 87, 0.50);
    cursor: pointer;
    position: relative;
    border-radius: 2px;
    transition: background 0.2s;
    font-style: normal;
}

.site-highlight:hover {
    background: rgba(217, 119, 87, 0.35);
}

/* Seçim Yüzen Toolbar (Tooltip popover) */
.ai-selection-popover {
    position: absolute;
    background: #1e1e1e;
    border-radius: 30px;
    padding: 6px 12px;
    display: flex;
    gap: 4px;
    z-index: 10000;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    transform: translateX(-50%) translateY(-100%);
    margin-top: -10px;
    animation: popover-scale 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popover-scale {
    from { opacity: 0; transform: translateX(-50%) translateY(-100%) scale(0.8); }
    to { opacity: 1; transform: translateX(-50%) translateY(-100%) scale(1); }
}

.ai-selection-popover::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #1e1e1e transparent;
    display: block;
    width: 0;
}

.ai-popover-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
    white-space: nowrap;
}

.ai-popover-btn:hover {
    background: rgba(255,255,255,0.15);
}

.ai-popover-btn svg {
    width: 14px;
    height: 14px;
    color: var(--ai-primary);
}

.ai-popover-divider {
    width: 1px;
    background: rgba(255,255,255,0.15);
    margin: 4px 0;
}

/* Not Ekleme Popover Girişi */
.ai-note-editor-popover {
    position: absolute;
    background: #ffffff;
    border: 1px solid var(--ai-border);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    border-radius: 16px;
    padding: 15px;
    z-index: 10001;
    width: 280px;
    transform: translateX(-50%) translateY(-100%);
    margin-top: -10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: popover-scale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-note-editor-popover::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #ffffff transparent;
    display: block;
    width: 0;
}

.ai-note-editor-textarea {
    width: 100%;
    height: 70px;
    border: 1px solid var(--ai-border);
    border-radius: 8px;
    padding: 8px;
    font-size: 0.85rem;
    resize: none;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    background: var(--ai-input-bg);
    color: var(--ai-text-main);
}

.ai-note-editor-textarea::placeholder {
    color: var(--ai-text-muted);
}

.ai-note-editor-textarea:focus {
    border-color: var(--ai-primary);
}

.ai-note-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ai-note-editor-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.ai-note-editor-save {
    background: var(--ai-primary);
    color: #ffffff;
}

.ai-note-editor-save:hover {
    background: var(--ai-primary-hover);
}

.ai-note-editor-cancel {
    background: #f3f4f6;
    color: var(--ai-text-muted);
}

.ai-note-editor-cancel:hover {
    background: #e5e7eb;
}

/* Vurgu Üzerinde Hover Edince Çıkan Not Tooltipi */
.ai-highlight-tooltip {
    position: absolute;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(4px);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    z-index: 10002;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 220px;
    word-break: break-word;
    transform: translateX(-50%) translateY(-100%);
    margin-top: -8px;
    pointer-events: auto; /* delete link clickability */
    animation: tooltip-fade 0.15s ease-out;
    text-align: center;
}

@keyframes tooltip-fade {
    from { opacity: 0; transform: translateX(-50%) translateY(-90%); }
    to { opacity: 1; transform: translateX(-50%) translateY(-100%); }
}

.ai-highlight-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: rgba(30, 30, 30, 0.95) transparent;
    display: block;
    width: 0;
}

.ai-tooltip-delete-btn {
    color: #fca5a5;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    margin-left: 8px;
    font-weight: 600;
    text-decoration: underline;
    padding: 2px 4px;
    display: inline-block;
}

.ai-tooltip-delete-btn:hover {
    color: #ef4444;
}

/* --- AI Çekmecesi Açıldığında Sayfayı Sola Yaslama Stilleri --- */
@media (min-width: 769px) {
    body.ai-drawer-open {
        padding-right: 400px;
    }
    body {
        transition: padding-right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    /* Fixed Navigation Bar (Ana Sayfa) */
    body.ai-drawer-open .nav {
        right: 400px !important;
    }
    .nav {
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    /* Fixed Navigation Header (Blog & Yazılar) */
    body.ai-drawer-open .nav-header {
        right: 400px !important;
    }
    .nav-header {
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    /* Fixed Scroll Progress */
    body.ai-drawer-open .scroll-progress {
        right: 400px !important;
    }
    .scroll-progress {
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    /* Fixed WhatsApp Button */
    body.ai-drawer-open [class*="whatsapp"], 
    body.ai-drawer-open [href*="wa.me"] {
        right: 420px !important;
    }
    [class*="whatsapp"], 
    [href*="wa.me"] {
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s ease, box-shadow 0.2s ease !important;
    }
}
