/* Modern UI Override for EpubDigest Reader */
/* 使用现代设计语言更新整体样式 */

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #6366f1;
  --success-color: #10b981;
  --success-hover: #059669;
  --warning-color: #f59e0b;
  --error-color: #ef4444;

  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-hover: #f3f4f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --radius: 8px;
  --radius-lg: 12px;
}

/* 深色模式变量 */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-hover: #475569;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-color: #334155;
  --border-hover: #475569;
}

/* 更新整体应用样式 */
.app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

/* 更新主容器 */
.main-container {
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

/* 更新顶部和底部工具栏 */
.app .bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  height: 52px;
  line-height: 52px;
  padding: 0 16px;
}

.app .bar:last-child {
  border-bottom: none;
  border-top: 1px solid var(--border-color);
}

/* 更新按钮样式 */
.app button {
  border-radius: var(--radius);
  transition: all 0.15s ease;
  font-weight: 500;
}

.app button:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.app button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* 更新图标按钮 */
.app button .icon {
  font-size: 20px;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.app button:hover .icon {
  color: var(--primary-color);
}

/* 更新侧边栏 */
.sidebar-wrapper {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.sidebar .tab-list {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.sidebar .tab-list .item {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 4px;
}

.sidebar .tab-list .item.active {
  background: var(--primary-color);
  color: white;
}

.sidebar .tab-list .item.active .icon {
  color: white;
}

/* 更新标签页内容 */
.sidebar .tab {
  padding: 16px;
}

/* 更新搜索框 */
.search-bar {
  margin-bottom: 16px;
}

.search-box {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.15s ease;
}

.search-box:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.search-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px;
  border-radius: var(--radius);
}

/* 更新设置面板 */
.setting {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.setting:last-child {
  border-bottom: none;
}

.setting-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-size: 14px;
}

.setting-content {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 更新chips样式 */
.chip {
  padding: 8px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-primary);
  color: var(--text-secondary);
}

.chip:hover {
  border-color: var(--primary-color);
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.chip.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* 更新AI总结区域 */
.ai-summary-container {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  border-radius: 0;
  padding: 20px;
}

.ai-summary-header {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.ai-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.current-provider-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.current-provider-name {
  color: var(--primary-color);
}

.ai-buttons-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* 更新AI按钮样式 */
.ai-summary-button,
.ai-config-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--success-color) 0%, var(--primary-color) 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.ai-summary-button:hover,
.ai-config-button:hover {
  background: linear-gradient(135deg, var(--success-hover) 0%, var(--primary-hover) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ai-config-button {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.ai-config-button:hover {
  background: var(--bg-hover);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.ai-summary-button:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

/* 更新AI内容区域 */
.ai-summary-content {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-color);
  min-height: 200px;
}

.summary-placeholder {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 2px dashed var(--border-color);
}

.privacy-note {
  margin-top: 16px;
  padding: 12px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  border-radius: var(--radius);
  border-left: 4px solid var(--warning-color);
}

/* 更新滚动条样式 */
.ai-summary-content::-webkit-scrollbar {
  width: 8px;
}

.ai-summary-content::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.ai-summary-content::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.ai-summary-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 更新模态框样式 */
.ai-config-modal .modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  max-width: 600px;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 8px;
  background: var(--bg-hover);
  border-radius: var(--radius);
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 20px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 更新表单元素 */
input[type="url"],
input[type="password"],
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.15s ease;
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

/* 更新拖拽句柄 */
.resize-handle {
  background: var(--border-color);
  width: 2px;
  cursor: col-resize;
  transition: background 0.2s ease;
  position: relative;
}

.resize-handle:hover,
.resize-handle:active {
  background: var(--primary-color);
}

.resize-handle::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 40px;
  background: transparent;
  border-radius: 3px;
}

.resize-handle:hover::before {
  background: rgba(59, 130, 246, 0.1);
}

/* 更新导航按钮 */
.prev,
.next {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.prev:hover,
.next:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.prev:hover .icon,
.next:hover .icon {
  color: white;
}

/* 更新书本信息显示 */
.app .bar .title {
  font-weight: 600;
  color: var(--text-primary);
}

.divider {
  color: var(--text-muted);
}

/* 添加加载动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-summary-content .summary-text {
  animation: fadeInUp 0.5s ease;
}

/* 响应式调整 */
/* 响应式调整 */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }

  .ai-summary-container {
    width: 100% !important;
    min-width: unset;
    border-left: none;
    border-top: 1px solid var(--border-color);
    max-height: 40vh;
  }

  .resize-handle {
    display: none;
  }

  .ai-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .ai-buttons-group {
    flex-direction: column;
  }

  .ai-summary-button,
  .ai-config-button {
    width: 100%;
    justify-content: center;
  }

  .current-provider-label {
    text-align: center;
  }

  .sidebar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar-wrapper.show {
    transform: translateX(0);
  }

  .modal-content {
    width: 95vw;
    max-width: none;
    margin: 20px auto;
  }
}

@media (max-width: 480px) {
  .app .bar {
    padding: 0 12px;
    height: 48px;
    line-height: 48px;
  }

  .ai-summary-header {
    padding: 12px;
  }

  .ai-summary-content {
    padding: 16px;
  }

  .modal-header,
  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 16px;
  }
}

/* 更新空状态页面样式 */
.modern-empty {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  max-width: 500px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg {
  width: 40px;
  height: 40px;
  color: white;
}

.modern-empty .app-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-tagline {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-weight: 500;
}

.modern-empty .message {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.features-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-hover);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
}

.feature:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.feature .icon {
  color: var(--primary-color);
  font-size: 20px;
}

@media (max-width: 768px) {
  .modern-empty {
    padding: 32px 24px;
    margin: 20px;
  }

  .empty-icon {
    width: 64px;
    height: 64px;
    padding: 16px;
  }

  .empty-icon svg {
    width: 32px;
    height: 32px;
  }

  .modern-empty .app-name {
    font-size: 24px;
  }

  .app-tagline {
    font-size: 14px;
  }
}

/* 添加焦点环 */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}