/* 主题配色（蓝白·科技·扁平） */
:root {
    --pp-primary-50: #eff6ff;
    --pp-primary-100: #dbeafe;
    --pp-primary-200: #bfdbfe;
    --pp-primary-300: #93c5fd;
    --pp-primary-400: #60a5fa;
    --pp-primary-500: #3b82f6;
    --pp-primary-600: #2563eb;
    --pp-primary-700: #1d4ed8;
    --pp-primary-800: #1e40af;
    --pp-primary-900: #1e3a8a;

    --pp-cyan-500: #06b6d4;
    --pp-cyan-600: #0891b2;

    --pp-bg-soft: #f7fafc;
    --pp-surface: #ffffff;
    --pp-border: #e5e7eb;
    --pp-text-strong: #1f2937;
    --pp-text-muted: #6b7280;
    --pp-shadow: 0 4px 12px rgba(2, 54, 132, 0.06);
}

/* 顶部导航栏（桌面端） */
.topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--pp-surface);
    border-bottom: none;
    z-index: 1002;
    box-shadow: var(--pp-shadow);
}
.topnav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0; /* 使用 Tailwind container 的左右内边距 */
}
.topnav-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--pp-text-strong);
    font-weight: 700;
    font-size: 1rem; /* 与 .topnav-link 保持一致 */
    min-width: 0; /* 允许子元素在 flex 中收缩，便于省略显示 */
}
.topnav-brand .brand-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40vw; /* 长标题不挤压导航链接 */
}
.topnav-links {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.topnav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--pp-text-muted);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}
.topnav-link:hover { background: var(--pp-primary-50); color: var(--pp-primary-700); }
.topnav-link.active { color: var(--pp-primary-700); background: var(--pp-primary-100); }

/* 侧边导航栏样式 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: var(--pp-surface);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    border-right: 1px solid var(--pp-border);
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: none;
}

.sidebar-title {
    color: var(--pp-text-strong);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-item {
    margin: 0.25rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--pp-text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: var(--pp-primary-700);
    background: var(--pp-primary-50);
    border-left-color: var(--pp-primary-500);
}

.nav-link.active {
    color: var(--pp-primary-700);
    background: var(--pp-primary-100);
    border-left-color: var(--pp-primary-600);
}

.nav-icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

/* 汉堡菜单按钮 */
.hamburger {
    position: fixed;
    /* 顶部导航高度为 64px，使按钮在其中垂直居中 */
    top: calc(64px / 2);
    right: 1rem;
    z-index: 1003;
    background: var(--pp-surface);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: var(--pp-primary-700);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--pp-shadow);
    border: 1px solid var(--pp-border);
    transform: translateY(-50%);
}

.hamburger:hover {
    background: var(--pp-primary-50);
    transform: translateY(-50%) scale(1.05);
}

.hamburger.active {
    right: 1rem;
    transform: translateY(-50%);
}

/* 主内容区域 */
.main-content {
    margin-left: 0;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    padding-top: 0;
}

.main-content.sidebar-open {
    margin-left: 280px;
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 功能卡片样式 */
.feature-card {
    background: var(--pp-surface);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: #e2e8f0;
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    background: var(--pp-primary-600);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--pp-text-strong);
    margin-bottom: 0.5rem;
}

.feature-description {
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    flex-grow: 1;
}

.feature-button {
    background: transparent;
    color: #3b82f6;
    padding: 0.625rem 1rem;
    border: 1px solid #3b82f6;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: auto;
}

.feature-button:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.25);
}

/* 按钮与图标颜色统一（按钮文本色与图标一致） */
.feature-button i,
.process-btn i,
.topnav-link i,
.nav-link i,
.tab-btn i,
button i,
a.button i,
.btn i {
    color: currentColor;
    font-size: 1em;
    line-height: 1;
}

/* 统一 SVG 图标颜色（与文字一致） */
.feature-button svg,
.process-btn svg,
.topnav-link svg,
.nav-link svg,
.tab-btn svg,
button svg,
a.button svg,
.btn svg {
    fill: currentColor;
    stroke: currentColor;
}

/* 常见按钮型元素的图标间距（保守设置，避免破坏已有 ml-2 类） */
.feature-button i:first-child,
.process-btn i:first-child { margin-right: 0.375rem; }
.feature-button i:last-child,
.process-btn i:last-child { margin-left: 0.375rem; }

/* 页面头部样式 */
.page-header {
    background: var(--pp-surface);
    color: var(--pp-text-strong);
    padding: 0.5rem 0 0.75rem; /* 收紧上下间距，标题区域更窄 */
    margin-bottom: 1.25rem;   /* 下方留白略缩短 */
    border-bottom: none;      /* 使用阴影替代分割线 */
    box-shadow: 0 12px 24px -18px rgba(2, 54, 132, 0.18); /* 柔和下阴影分隔 */
    margin-top: 64px; /* 为顶部导航栏留出空间 */
    transition: opacity 180ms ease, transform 180ms ease; /* 滚动淡出与上移过渡 */
}

/* 收起状态：与 JS 同步（opacity/transform），并减少底部间距，避免空白占位 */
.page-header.collapsed {
    opacity: 0;
    transform: translateY(-16px);
    margin-bottom: 0.5rem;
    pointer-events: none;
}

.page-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.25rem; /* 标题与副标题更紧凑 */
    color: var(--pp-text-strong);
}

.page-title i {
    font-size: 3.25rem; /* 略微减小图标尺寸以降低整体高度 */
    margin-right: 1rem;
}

.page-subtitle {
    font-size: 1.125rem;
    color: var(--pp-text-muted);
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }
    /* 顶部导航在移动端仅显示品牌与汉堡按钮，隐藏链接 */
    .topnav-links { display: none; }
    /* 为避免右上角汉堡覆盖品牌，预留右侧空间；并在左侧增加安全间距 */
    .topnav-inner { 
        padding-right: 3.5rem; 
        padding-left: calc(1.25rem + env(safe-area-inset-left)); /* 比 px-4 更宽一些并适配刘海屏 */
    }

    /* 移动端细节优化 */
    .hamburger.active { right: 1rem; }
    .main-content.sidebar-open { margin-left: 0; }
    .feature-card { padding: 1.5rem; }
    .page-header { padding: 0.5rem 0 0.75rem; margin-bottom: 0.75rem; }
    .page-title { font-size: 2.5rem; margin-bottom: 0.2rem; }
    .topnav-brand .brand-text { max-width: 60vw; }
    .page-title i {
        font-size: 2.75rem;
        margin-right: 0.75rem;
    }
    
    /* 移动端页面头部已在上方统一设置，更紧凑的间距 */
}

@media (min-width: 769px) {
    .sidebar { display: none; }
    .overlay { display: none; }
    .hamburger { display: none; }
    .topnav { display: block; }
    .topnav-links { display: flex; }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 文件上传区域样式 */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.upload-zone:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-zone.dragover {
    border-color: #3b82f6;
    background: #dbeafe;
}

/* MD 转 Word 页面：上传区域类名为 upload-area，这里补充一致的样式与拖入高亮 */
.upload-area {
    transition: all 0.25s ease;
}
.upload-area.dragover {
    border-color: var(--pp-primary-600) !important;
    background: var(--pp-primary-100) !important;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.15);
    transform: scale(1.01);
}

/* 进度条样式 */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 0.25rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--pp-primary-600);
    border-radius: 0.25rem;
    transition: width 0.3s ease;
}

/* 状态指示器 */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-error {
    background: #fef2f2;
    color: #dc2626;
}

.status-warning {
    background: #fef3c7;
    color: #d97706;
}

.status-info {
    background: var(--pp-primary-100);
    color: var(--pp-primary-700);
}

/* 扩展：主题化按钮与标签页（用于演示页的统一风格） */
.process-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--pp-primary-600);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(37, 99, 235, 0.25);
    box-shadow: var(--pp-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.process-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(2, 54, 132, 0.12); }
.process-btn:active { transform: translateY(0); }

.tab-btn {
    position: relative;
    padding: 0.75rem 1rem;
    color: var(--pp-text-muted);
    font-weight: 500;
    transition: color 0.2s ease;
}
.tab-btn.active { color: var(--pp-primary-700); }
.tab-btn::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    background: var(--pp-primary-600);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}
.tab-btn.active::after { transform: scaleX(1); }

/* 上传区域的科技感微调（保持蓝白体系） */
.upload-zone {
    background: var(--pp-bg-soft);
    border-color: var(--pp-primary-200);
}
.upload-zone:hover {
    border-color: var(--pp-primary-500);
    background: var(--pp-primary-50);
}
.upload-zone.dragover {
    border-color: var(--pp-primary-600);
    background: var(--pp-primary-100);
}

/* 统一按钮尺寸与状态规范 */
/* 基类：布局、圆角、过渡、默认尺寸为 md */
.btn,
.feature-button,
.process-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 0.5rem;
    padding: 0.625rem 1rem; /* md 默认尺寸 */
    border: 1px solid transparent;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

/* 尺寸修饰 */
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.875rem; border-radius: 0.375rem; }
.btn-md { padding: 0.625rem 1rem; font-size: 1rem; border-radius: 0.5rem; }
.btn-lg { padding: 0.875rem 1.25rem; font-size: 1.125rem; border-radius: 0.75rem; }

/* 颜色变体：Primary | Secondary | Ghost */
.btn-primary,
.feature-button,
.process-btn {
    background: var(--pp-primary-600);
    color: #fff;
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: var(--pp-shadow);
}
.btn-primary:hover,
.feature-button:hover,
.process-btn:hover { background: var(--pp-primary-700); }
.btn-primary:active,
.feature-button:active,
.process-btn:active { transform: translateY(0); box-shadow: none; }

.btn-secondary { 
    background: var(--pp-primary-50);
    color: var(--pp-primary-700);
    border-color: var(--pp-primary-200);
}
.btn-secondary:hover { background: var(--pp-primary-100); }
.btn-secondary:active { transform: translateY(0); }

.btn-ghost {
    background: transparent;
    color: var(--pp-primary-700);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--pp-primary-50); }
.btn-ghost:active { transform: translateY(0); }

/* 禁用态 */
.btn:disabled,
.btn[disabled],
button:disabled,
.feature-button:disabled,
.process-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

/* 聚焦可见态（无强调色块，轻量化描边） */
.btn:focus-visible,
.feature-button:focus-visible,
.process-btn:focus-visible {
    outline: 2px solid var(--pp-primary-300);
    outline-offset: 2px;
}

/* PDF Viewer Fullscreen Mode Styles */
#preview-area:-webkit-full-screen {
  background-color: #2d3748; /* dark gray */
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#preview-area:fullscreen {
  background-color: #2d3748; /* dark gray */
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#preview-area:-webkit-full-screen #document-preview,
#preview-area:fullscreen #document-preview {
  max-height: 100% !important; /* Override inline style */
  height: 100% !important; /* Ensure it takes full height */
  flex-grow: 1;
  width: 100%;
  border: none;
  border-radius: 0;
  background-color: #2d3748; /* Match parent background */
  min-height: 0; /* Fix flexbox overflow issue */
}

#preview-area:-webkit-full-screen #pdf-pages-container,
#preview-area:fullscreen #pdf-pages-container {
    padding: 1rem; /* Add some padding inside the scroll container */
}
