/*
 * The Analects SDK - Embed Version CSS (v1.3.7)
 * Final UI fixes for widgets and card styling.
*/

/* ================================ */
/* 基础变量 */
/* ================================ */
:root {
  --primary: #2d3748; --blue: #3182ce; --gray: #718096; --light-gray: #a0aec0; --green: #38a169;
  --orange: #dd6b20; --purple: #805ad5; --red: #e53e3e; --bg: #ffffff; --card-bg: #fafafa;
  --border: #e2e8f0; --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 8px; --radius-lg: 12px;
}

/* ================================ */
/* 基础重置 */
/* ================================ */
.analects-search *, .analects-daily * { box-sizing: border-box; margin: 0; padding: 0; }

/* ================================ */
/* 每日论语样式 */
/* ================================ */
.analects-daily { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', serif; max-width: 800px; margin: 0 auto; }
.analects-daily-header { text-align: center; margin-bottom: 16px; padding-bottom: 24px; }
.analects-daily-title { font-size: 28px; font-weight: 300; color: var(--primary); margin-bottom: 8px; }
.analects-daily-subtitle { font-size: 16px; color: var(--gray); margin-bottom: 16px; }
.analects-daily-date { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 14px; color: var(--light-gray); }
.analects-daily-date::before, .analects-daily-date::after { content: ''; width: 40px; height: 1px; background: var(--border); }
.analects-daily-card { background: var(--bg); border-radius: var(--radius-lg); padding: 48px 32px; text-align: center; box-shadow: var(--shadow); margin-bottom: 32px; transition: all 0.3s ease; }
.analects-daily-card:hover { box-shadow: var(--shadow-lg); }
.analects-daily-original { font-size: 24px; line-height: 1.6; color: var(--primary); margin-bottom: 32px; position: relative; font-family: Georgia, 'Times New Roman', serif; max-width: 600px; margin-left: auto; margin-right: auto; }
.analects-daily-original::before, .analects-daily-original::after { content: '"'; font-size: 60px; color: var(--border); position: absolute; font-family: Georgia, serif; line-height: 1; }
.analects-daily-original::before { top: -20px; left: -30px; }
.analects-daily-original::after { bottom: -40px; right: -30px; }
.analects-daily-translation { font-size: 18px; line-height: 1.5; color: var(--gray); margin-bottom: 24px; font-style: italic; max-width: 550px; margin-left: auto; margin-right: auto; }
.analects-daily-reference-wrapper { display: flex; justify-content: center; align-items: center; gap: 16px; }
.analects-daily-reference { font-size: 14px; color: var(--light-gray); }
.analects-daily-share { display: flex; justify-content: center; align-items: center; gap: 16px; padding-top: 24px; border-top: 1px solid var(--border); }
.analects-daily-share-label { font-size: 14px; color: var(--gray); }
.analects-share-buttons { display: flex; gap: 12px; }
.analects-share-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--card-bg); border: 1px solid var(--border); color: var(--gray); transition: all 0.2s ease; cursor: pointer; }
.analects-share-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.analects-daily-empty, .analects-daily-error { text-align: center; padding: 24px; color: var(--gray); }
.analects-daily-error { color: var(--red); background: rgba(229, 62, 62, 0.05); border: 1px solid rgba(229, 62, 62, 0.2); }

/* **FIXED**: Widget compatibility styles */
.analects-widget-content-wrapper { border: 1px solid var(--border); padding: 20px; border-radius: var(--radius-lg); background-color: var(--card-bg); }
.widget .analects-daily { margin: 0; max-width: 100%; }
.widget .analects-daily-card { padding: 0; margin-bottom: 0; border: none; box-shadow: none; background-color: transparent; }
.widget .analects-daily-original { font-size: 1rem; line-height: 1.7; }
.widget .analects-daily-translation { font-size: 0.9rem; }
.widget .analects-daily-original::before, .widget .analects-daily-original::after { display: none; }
/* **FIXED**: Use a more specific selector to override theme styles */
.widget_analects_daily_widget h2.analects-daily-title { font-size: 28px !important; font-weight: 300 !important; }
.widget_analects_daily_widget h2.analects-daily-title::after { display: none !important; content: none !important; }
.widget .analects-daily-date { font-size: 0.8rem; }
.widget .analects-daily-date::before, .widget .analects-daily-date::after { width: 30px; }
.widget .analects-daily-share { padding-top: 16px; margin-top: 16px; flex-wrap: wrap; }
.widget .analects-share-btn { width: 32px; height: 32px; }

/* ================================ */
/* 搜索界面样式 */
/* ================================ */
.analects-search { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif; max-width: 1000px; margin: 0 auto; }
.analects-search-header { text-align: center; margin-bottom: 32px; padding: 24px 0; }
.analects-search-title { font-size: 28px; font-weight: 300; color: var(--primary); margin-bottom: 8px; }
.analects-search-subtitle { font-size: 16px; color: var(--gray); }
.analects-search-form { background: var(--bg); border-radius: var(--radius-lg); padding: 32px; margin-bottom: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.analects-keyword-section { margin-bottom: 32px; }
.analects-keyword-label { display: block; font-size: 16px; font-weight: 500; color: var(--primary); margin-bottom: 12px; }
.analects-input { width: 100%; padding: 16px 20px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 16px; transition: all 0.2s ease; }
.analects-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.1); }
.analects-selected-items { margin-top: 16px; padding: 16px; background: rgba(49, 130, 206, 0.05); border-radius: var(--radius); border: 1px dashed rgba(49, 130, 206, 0.3); }
.analects-selected-items h4 { margin: 0 0 12px 0; font-size: 14px; font-weight: 600; color: var(--blue); }
.analects-selected-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.analects-selected-tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 16px; font-size: 13px; }
.analects-selected-tag .remove-tag { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; background: rgba(0, 0, 0, 0.1); border-radius: 50%; cursor: pointer; color: white; }
.analects-selected-tag.character { background-color: #ecfdf5; color: #065f46; border: 1px solid #d1fae5; }
.analects-selected-tag.argument { background-color: #eff6ff; color: #1e40af; border: 1px solid #dbeafe; }
.analects-selected-tag.proverb { background-color: #fefce8; color: #854d0e; border: 1px solid #fef9c3; }
.analects-selected-tag.chapter { background-color: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.analects-advanced-filters { border-top: 1px solid var(--border); padding-top: 32px; margin-top: 32px; }
.analects-advanced-title { font-size: 18px; font-weight: 500; color: var(--primary); margin-bottom: 20px; }
.analects-advanced-title::before { content: '🔧'; font-size: 16px; display: inline-block; margin-right: 8px; }
.analects-filters-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.analects-filters-grid.single-column { grid-template-columns: 1fr; }
.analects-filters-grid + .analects-filters-grid { margin-top: 24px; }
.analects-filter-section { background: var(--card-bg); border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); }
.analects-filter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.analects-filter-title { font-size: 16px; font-weight: 600; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.analects-filter-count { font-size: 12px; color: var(--light-gray); background: var(--bg); padding: 4px 8px; border-radius: 12px; }
.analects-filter-search input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.analects-filter-options { max-height: 200px; overflow-y: auto; }
.analects-filter-options::-webkit-scrollbar { width: 6px; }
.analects-filter-options::-webkit-scrollbar-track { background: var(--card-bg); border-radius: 3px; }
.analects-filter-options::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.analects-filter-options::-webkit-scrollbar-thumb:hover { background: var(--light-gray); }
.analects-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
.analects-option-tag { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px; cursor: pointer; transition: all 0.2s ease; font-size: 13px; user-select: none; }
.analects-option-tag:hover { background: rgba(49, 130, 206, 0.05); border-color: var(--blue); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.analects-option-tag.selected { background: var(--blue); color: white; border-color: var(--blue); }
.analects-option-tag input[type="checkbox"] { display: none; }
.analects-search-actions { display: flex; justify-content: center; gap: 16px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.analects-btn { padding: 14px 28px; border: none; border-radius: var(--radius); background: var(--blue); color: white; font-size: 15px; cursor: pointer; transition: background-color 0.2s ease; }
.analects-btn:hover { background: #2c5aa0; }
.analects-btn-clear { background: var(--red); }
.analects-btn-clear:hover { background: #c53030; }

/* ================================ */
/* 搜索结果 & 卡片样式 */
/* ================================ */
.analects-results-container { display: flex; flex-direction: column; gap: 20px; overflow: visible; }
.verse-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); transition: all 0.3s ease; opacity: 0; transform: translateY(20px); }
.verse-card.animate-in { opacity: 1; transform: translateY(0); }
.verse-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.verse-card:has(.card-actions-dropdown.active) { position: relative; z-index: 20; overflow: visible; }
.verse-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid #f1f5f9; }
.verse-header-left span::before { display: none !important; content: none !important; border: none !important; }
.verse-header-left, .verse-header-right { display: flex; align-items: center; gap: 0.75rem; }
.verse-chapter { font-size: 0.875rem; font-weight: 600; color: var(--blue); }
.verse-section { font-size: 0.8125rem; color: var(--gray); }
.analects-results-container .verse-original { border-left: none !important; padding-left: 0 !important; }
.verse-original { font-size: 1.6rem; line-height: 1.9; color: var(--primary); margin-bottom: 1.5rem; font-family: 'Noto Serif SC', serif; }
.verse-translation { font-size: 1rem; color: #475569; line-height: 1.8; padding-left: 1.25rem; border-left: 3px solid #60a5fa; font-style: italic; }
.verse-annotation-wrapper { margin-top: 1.5rem; padding-left: 1.25rem; font-size: 0.875rem; line-height: 1.7; color: #64748b; }
.verse-annotation-title { font-weight: 600; margin-bottom: 0.25rem; }
.card-tags-section { padding: 1rem 0; margin-top: 1rem; border-top: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: 0.75rem; }
.card-tag-group { display: flex; align-items: flex-start; gap: 0.75rem; }
.card-tag-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; font-weight: 600; color: #475569; flex-shrink: 0; width: 50px; }
.card-tag-items { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.card-tag { font-size: 0.75rem; font-weight: 500; padding: 2px 8px; border-radius: 4px; }
.card-tag.character { background-color: #ecfdf5; color: #065f46; }
.card-tag.argument { background-color: #eff6ff; color: #1e40af; }
.card-tag.proverb { background-color: #fefce8; color: #854d0e; }
.analects-card-footer { border-top: none; margin-top: 24px; padding: 0; }
.footer-actions { display: flex; justify-content: flex-end; align-items: center; }
.more-options-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: none; border: none; color: var(--light-gray); cursor: pointer; }
.more-options-btn:hover { background-color: #f1f5f9; }
.card-actions-container { position: relative; }
.card-actions-dropdown { position: absolute; bottom: calc(100% + 4px); right: 0; width: 180px; background-color: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); padding: 6px; z-index: 50; opacity: 0; transform: translateY(10px); pointer-events: none; transition: all 0.2s ease-out; }
.card-actions-dropdown.active { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dropdown-share-item, .dropdown-share-item:hover, .dropdown-share-item a, .dropdown-share-item a:hover { text-decoration: none !important; border-bottom: none !important; box-shadow: none !important; }
.dropdown-share-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 6px; font-size: 14px; color: var(--primary); cursor: pointer; text-align: left; }
.dropdown-share-item:hover { background-color: var(--card-bg); }
.dropdown-share-item svg { width: 16px; height: 16px; }

/* ================================ */
/* 状态 & 加载样式 */
/* ================================ */
.keyword-highlight { background-color: #fff3cd; color: #856404; padding: 1px 4px; border-radius: 3px; }
.analects-search-status { text-align: center; margin-bottom: 16px; }
.analects-success, .analects-info, .analects-error, .analects-warning { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.analects-success { color: var(--green); background: rgba(56, 161, 105, 0.05); border-color: rgba(56, 161, 105, 0.2); }
.analects-info { color: var(--blue); background: rgba(49, 130, 206, 0.05); border-color: rgba(49, 130, 206, 0.2); }
.analects-error { color: var(--red); background: rgba(229, 62, 62, 0.05); border-color: rgba(229, 62, 62, 0.2); }
.analects-warning { color: var(--orange); background: rgba(221, 107, 32, 0.05); border-color: rgba(221, 107, 32, 0.2); }
.analects-load-complete { text-align: center; margin: 32px 0; }
.analects-load-complete-text { font-size: 14px; color: #a0aec0; }
.analects-scroll-indicator { position: fixed; bottom: 24px; right: 24px; background: var(--card-bg); color: var(--primary); width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(20px); transition: all 0.3s ease; z-index: 999; cursor: pointer; border: 1px solid var(--border); }
.analects-scroll-indicator.visible { opacity: 1; transform: translateY(0); }
.favorite-card-skeleton { background: var(--bg); border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--border); margin-bottom: 20px; }
.skeleton-block { background-color: #f0f2f5; border-radius: 4px; animation: pulse-bg 1.5s infinite ease-in-out; }
@keyframes pulse-bg { 0%, 100% { background-color: #f0f2f5; } 50% { background-color: #e2e8f0; } }

/* ================================ */
/* 响应式设计 */
/* ================================ */
@media (max-width: 768px) {
    .analects-search-form, .verse-card { padding: 20px; }
    .verse-original { font-size: 1.25rem; }
    .verse-translation { font-size: 0.95rem; }
    .analects-search-title, .analects-daily-title { font-size: 24px; }
    .analects-filters-grid { grid-template-columns: 1fr; gap: 20px; }
    .analects-search-actions { flex-direction: column; }
    .analects-btn { width: 100%; }
    .analects-daily-card { padding: 32px 20px; }
    .analects-daily-original { font-size: 20px; }
    .analects-daily-original::before, .analects-daily-original::after { display: none; }
}