/* ==========================================================================
   NOTIFORGE — VIEWS: KÜTÜPHANE (LIBRARY VIEW)
   Arama çubuğu, tür/etiket filtreleri, klasörler, atölye sentez banner'ı,
   editoryal not kartları, sözlük ve görev kartları.
   ========================================================================== */

/* ==========================================================================
   📖 NOTIFORGE ZİHİNSEL KÜTÜPHANE: EDİTORYAL & PASTEL TASARIM STİLLERİ 🌿
   ========================================================================== */

.library-container {
    max-width: 680px;
    margin: 0 auto;
    padding-bottom: 5rem;
}

/* 1. Kütüphane Başlık ve Sayaç Alanı */
.lib-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    padding: 2px 4px 0 4px;
}

.lib-header-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--accent-ink);
    margin: 0 0 4px 0;
    line-height: 1.15;
}

.lib-header-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.lib-stats-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
}

.lib-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lib-header-action-btn {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--accent-ink);
    padding: 5px 11px;
    border-radius: var(--r-md);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: all 0.16s ease;
}

.lib-header-action-btn:hover {
    background: var(--accent-soft);
    border-color: var(--border-strong);
    color: var(--accent-ink);
}

/* 2. Modern Pill Arama Çubuğu */
.lib-search-wrapper {
    margin-bottom: 12px;
}

.lib-search-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-pill);
    padding: 4px 8px 4px 12px;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.04);
    transition: all 0.2s ease;
}

.lib-search-pill:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14), 0 2px 10px rgba(var(--accent-rgb), 0.06);
}

.lib-search-icon {
    font-size: 0.92rem;
    color: var(--text-muted);
}

.lib-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    color: var(--text-primary);
    outline: none;
    padding: 6px 2px;
    font-family: inherit;
}

.lib-search-input::placeholder {
    color: var(--text-faint);
    font-size: 0.78rem;
}

.lib-search-btn-clear {
    background: var(--accent-soft);
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lib-search-btn-mic {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.16s ease;
}

.lib-search-btn-mic:hover {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-text);
}

/* 3. Ana Tür Pill Sekmeleri */
.lib-type-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    background: var(--surface-3);
    padding: 4px;
    border-radius: var(--r-md);
}

.lib-type-tab-btn {
    flex: 1;
    padding: 7px 10px;
    border: none;
    border-radius: var(--r-sm);
    font-weight: 800;
    font-size: 0.76rem;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.18s ease;
}

.lib-type-tab-btn:hover {
    color: var(--accent-ink);
}

.lib-type-tab-btn.active {
    background: #143825;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(20, 56, 37, 0.25);
}

.lib-type-tab-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: var(--r-pill);
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
}

.lib-type-tab-btn.active .lib-type-tab-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

/* 4. Yatay Etiket Çubuğu */
.lib-tags-container {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 12px;
    scrollbar-width: none;
}

.lib-tags-container::-webkit-scrollbar {
    display: none;
}

.lib-tag-chip {
    white-space: nowrap;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 0.70rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.16s ease;
}

.lib-tag-chip:hover {
    background: var(--surface-3);
    color: var(--accent-ink);
}

.lib-tag-chip.active {
    background: #1a422d;
    border-color: #1a422d;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(26, 66, 45, 0.2);
}

.lib-tag-chip-count {
    opacity: 0.75;
    font-size: 0.75rem;
}

/* 4.5 📁 Klasör Barı & Kartları */
.lib-folders-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    margin-bottom: 10px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}
.lib-folders-bar::-webkit-scrollbar { display: none; }

.lib-folder-card {
    --folder-color: #2d5a43;
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 108px;
    max-width: 170px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 9px 12px;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--folder-color);
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.lib-folder-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.lib-folder-card:focus-visible { outline: 2px solid var(--folder-color); outline-offset: 2px; }
.lib-folder-card.active {
    background: color-mix(in srgb, var(--folder-color) 10%, var(--surface));
    border-color: var(--folder-color);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--folder-color) 22%, transparent);
}
.lib-folder-card-head { display: flex; align-items: center; gap: 6px; width: 100%; }
.lib-folder-icon { font-size: 1.05rem; line-height: 1; }
.lib-folder-name {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--accent-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.lib-folder-count { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.lib-folder-edit-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0 2px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.6;
}
.lib-folder-edit-btn:hover { opacity: 1; color: var(--accent-ink); }

.lib-folder-add-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 9px 12px;
    border-radius: var(--r-md);
    border: 1.5px dashed var(--border-strong);
    background: transparent;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
}
.lib-folder-add-btn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent-text); }

/* Not kartı üzerindeki klasör rozeti */
.lib-folder-badge {
    --folder-color: #2d5a43;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    color: var(--folder-color);
    background: color-mix(in srgb, var(--folder-color) 12%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--folder-color) 30%, transparent);
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Klasör modalı */
.folder-modal-form { display: flex; flex-direction: column; gap: 14px; }
.folder-modal-label { font-size: 0.8rem; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; display: block; }
.folder-emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.folder-emoji-btn, .folder-color-btn {
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
}
.folder-emoji-btn {
    width: 38px; height: 38px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 1.15rem;
}
.folder-color-btn { width: 28px; height: 28px; border-radius: 50%; }
.folder-emoji-btn:hover, .folder-color-btn:hover { transform: scale(1.08); }
.folder-emoji-btn.selected { border-color: var(--accent); background: var(--surface); }
.folder-color-btn.selected { border-color: #1f2937; box-shadow: 0 0 0 2px var(--border) inset; }
.folder-modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.folder-modal-delete {
    background: color-mix(in srgb, #ff0012 8%, var(--surface)); color: #e11d48; border: 1px solid color-mix(in srgb, #fa0523 32%, var(--surface));
    padding: 12px 14px; border-radius: var(--r-sm); font-weight: 800; cursor: pointer;
}

/* Not formlarında klasör seçici */
.folder-select {
    width: 100%;
    padding: 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.88rem;
}

/* 5. Atölye Sentezi Banner'ı */
.lib-synthesis-card {
    background: linear-gradient(135deg, color-mix(in srgb, #ffb100 8%, var(--surface)) 0%, color-mix(in srgb, #ffa600 13%, var(--surface)) 100%);
    border: 1px solid color-mix(in srgb, #fc8803 32%, var(--surface));
    border-radius: var(--r-lg);
    padding: 11px 14px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(249, 115, 22, 0.05);
}

.lib-synthesis-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.lib-synthesis-icon-box {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    background: color-mix(in srgb, #ff9200 20%, var(--surface));
    color: color-mix(in srgb, var(--warning) 62%, var(--text));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.90rem;
    flex-shrink: 0;
}

.lib-synthesis-meta {
    flex: 1;
    min-width: 0;
}

.lib-synthesis-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.lib-synthesis-badge {
    font-size: 0.75rem;
    font-weight: 800;
    color: color-mix(in srgb, var(--warning) 62%, var(--text));
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lib-synthesis-time {
    font-size: 0.75rem;
    color: color-mix(in srgb, #9a3412 62%, var(--text));
    font-weight: 600;
    opacity: 0.8;
}

.lib-synthesis-text {
    font-size: 0.74rem;
    color: color-mix(in srgb, #7c2d12 62%, var(--text));
    line-height: 1.4;
    margin: 0;
    font-weight: 500;
}

.lib-synthesis-text b,
.lib-synthesis-text strong {
    font-weight: 800;
    color: color-mix(in srgb, #431407 62%, var(--text));
}

/* 6. Akış Listesi */
.lib-items-stream {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================================================
   🌿 EDİTORYAL NOT KARTI (Görseldeki Birebir Şablon)
   ========================================================================== */

.lib-note-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px 18px;
    box-shadow: 0 2px 10px rgba(var(--accent-rgb), 0.025);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    position: relative;
    transition: all 0.18s ease;
}

.lib-note-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.07);
    transform: translateY(-1px);
}

.lib-card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.lib-card-badges-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lib-category-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--r-xs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cat-badge-teal   { background: var(--accent-soft); color: var(--accent-ink); }
.cat-badge-amber  { background: color-mix(in srgb, #ff8e00 13%, var(--surface)); color: color-mix(in srgb, var(--warning) 62%, var(--text)); }
.cat-badge-purple { background: color-mix(in srgb, #2b00ff 8%, var(--surface)); color: color-mix(in srgb, var(--ai) 62%, var(--text)); }
.cat-badge-blue   { background: color-mix(in srgb, var(--info) 8%, var(--surface)); color: color-mix(in srgb, var(--info) 62%, var(--text)); }
.cat-badge-gray   { background: var(--surface-2); color: var(--text-muted); }

.lib-relation-pill {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: color-mix(in srgb, var(--warning) 13%, var(--surface));
    color: color-mix(in srgb, var(--warning) 62%, var(--text));
    border: 1px solid rgba(var(--warning-rgb), 0.25);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Kart Sağ Aksiyonları (Sabitleme & 3 Nokta Menüsü) */
.lib-card-actions-right {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.lib-icon-action-btn {
    background: transparent;
    border: none;
    color: var(--text-faint);
    font-size: 0.90rem;
    width: 26px;
    height: 26px;
    border-radius: var(--r-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lib-icon-action-btn:hover {
    background: var(--accent-soft);
    color: var(--text);
}

.lib-icon-action-btn.pinned {
    color: color-mix(in srgb, var(--warning) 62%, var(--text));
    opacity: 1;
}

/* 3 Nokta Açılır Menüsü */
.lib-card-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    padding: 5px;
    min-width: 140px;
    z-index: 50;
    display: none;
    flex-direction: column;
    gap: 2px;
    animation: fadeIn 0.15s ease-out;
}

.lib-card-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--r-xs);
    background: transparent;
    border: none;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.12s ease;
}

.lib-card-dropdown-item:hover {
    background: var(--accent-soft);
    color: var(--text);
}

.lib-card-dropdown-item.danger-item:hover {
    background: color-mix(in srgb, var(--danger) 8%, var(--surface));
    color: var(--danger);
}

/* Başlık ve Alıntı */
.lib-card-title {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--accent-ink);
    margin: 2px 0 0 0;
    line-height: 1.3;
}

.lib-card-excerpt {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.lib-card-excerpt p {
    margin: 0 0 6px 0;
}

.lib-card-excerpt p:last-child {
    margin-bottom: 0;
}

.lib-card-excerpt strong,
.lib-card-excerpt b {
    font-weight: 800;
    color: var(--text);
}

.lib-card-excerpt em,
.lib-card-excerpt i {
    font-style: italic;
    color: var(--text);
}

.lib-card-excerpt ul,
.lib-card-excerpt ol {
    margin: 4px 0 6px 0;
    padding-left: 18px;
}

.lib-card-excerpt li {
    margin-bottom: 2px;
}

.lib-card-excerpt code {
    background: var(--surface-2);
    padding: 1px 4px;
    border-radius: var(--r-xs);
    font-size: 0.85em;
    color: var(--text);
}

/* 🌿 AI ÖZETİ & ANA FİKİR KUTUSU */
.lib-ai-summary-box {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 9px 12px;
    margin: 2px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lib-ai-summary-header {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--success);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lib-ai-summary-text {
    font-size: 0.73rem;
    color: var(--accent-ink);
    line-height: 1.45;
    font-style: italic;
    margin: 0;
}

.lib-ai-summary-text p {
    margin: 0 0 4px 0;
}

.lib-ai-summary-text p:last-child {
    margin-bottom: 0;
}

.lib-ai-summary-text strong,
.lib-ai-summary-text b {
    font-weight: 800;
    color: var(--accent-ink);
    font-style: normal;
}

/* Kart Alt Meta Satırı */
.lib-card-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
}

.lib-card-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.lib-tag-pill {
    background: var(--accent-soft);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--r-xs);
    white-space: nowrap;
}

.lib-card-bottom-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.lib-card-time {
    font-size: 0.75rem;
    color: var(--text-faint);
    font-weight: 600;
}

.lib-block-count {
    font-size: 0.75rem;
    color: var(--success);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ==========================================================================
   📚 SÖZLÜK VE GÖREV KARTLARI (Yeni Editoryal Tasarım)
   ========================================================================== */

.lib-word-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.025);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.lib-word-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.06);
    transform: translateY(-1px);
}

.lib-word-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lib-lang-pill {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: var(--r-xs);
    background: color-mix(in srgb, var(--info) 8%, var(--surface));
    color: color-mix(in srgb, var(--info) 62%, var(--text));
    text-transform: uppercase;
}

.lib-word-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

.lib-word-meaning {
    font-size: 0.82rem;
    color: var(--success);
    font-weight: 700;
    margin: 0;
}

.lib-word-example {
    font-size: 0.73rem;
    color: var(--text-muted);
    font-style: italic;
    background: var(--surface);
    border-left: 2.5px solid var(--border-strong);
    padding: 6px 10px;
    border-radius: var(--r-xs);
    margin: 0;
}

/* Görev Kartı */
.lib-task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.025);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.lib-task-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.06);
    transform: translateY(-1px);
}

.lib-task-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: var(--success);
    cursor: pointer;
    flex-shrink: 0;
}

.lib-task-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lib-task-badges-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lib-task-title {
    font-size: 0.90rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.35;
}

.lib-task-title.is-completed {
    text-decoration: line-through;
    opacity: 0.55;
}

/* 📱 Kütüphane Mobil Uyumu (<= 480px) */
@media (max-width: 480px) {
    .lib-header-title {
        font-size: 1.18rem;
    }
    .lib-note-card {
        padding: 13px 14px;
        border-radius: var(--r-lg);
    }
    .lib-card-title {
        font-size: 0.94rem;
    }
    .lib-ai-summary-box {
        padding: 8px 10px;
    }
    .lib-ai-summary-text {
        font-size: 0.70rem;
    }
    .lib-word-card {
        padding: 12px 13px;
        border-radius: var(--r-lg);
    }
    .lib-task-card {
        padding: 12px 13px;
        border-radius: var(--r-lg);
    }
}

