/* ============================================
   Component Styles
   ============================================ */

/* Theme Switcher */
.theme-switcher {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 2px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
}

.theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: transparent;
    color: var(--text-secondary);
    position: relative;
}

.theme-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.theme-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.theme-btn .tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-default);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: var(--z-tooltip);
}

.theme-btn:hover .tooltip {
    opacity: 1;
}

/* Theme Dropdown */
.theme-select {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    margin-left: var(--space-2);
}

.theme-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* API Function Card */
.api-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin: var(--space-4) 0;
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.api-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.api-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
    gap: var(--space-3);
}

.api-card-title {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.api-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-function { background: #dbeafe; color: #1d4ed8; }
.badge-property { background: #dcfce7; color: #15803d; }
.badge-deprecated { background: #fef3c7; color: #92400e; }
.badge-readonly { background: #fce7f3; color: #9d174d; }

.api-card-body {
    padding: var(--space-5);
}

.api-card-section {
    margin-bottom: var(--space-4);
}

.api-card-section:last-child {
    margin-bottom: 0;
}

.api-card-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
}

/* Parameters Table */
.params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.params-table th {
    background: var(--bg-elevated);
    padding: var(--space-2) var(--space-3);
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    border-bottom: 2px solid var(--border-default);
}

.params-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.params-table td:first-child {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-weight: 500;
}

.params-table tr:hover td {
    background: var(--bg-hover);
}

/* Return Value */
.return-value {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-primary);
    font-weight: 500;
}

.return-value .arrow {
    color: var(--text-tertiary);
}

/* Property List */
.property-list {
    display: grid;
    gap: var(--space-1);
}

.property-item {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-xs);
    transition: background var(--transition-fast);
}

.property-item:hover {
    background: var(--bg-hover);
}

.property-type {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-primary);
    font-weight: 500;
    min-width: 80px;
    flex-shrink: 0;
}

.property-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.property-description {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-left: auto;
    text-align: right;
}

/* Code Block Copy Button */
.copy-btn {
    position: absolute;
    top: var(--space-2);
    right: var(--space-3);
    padding: var(--space-1) var(--space-2);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xs);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0;
    z-index: 10;
    font-family: var(--font-sans);
    backdrop-filter: blur(4px);
}

pre:hover .copy-btn,
.copy-btn:focus {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.copy-btn.copied {
    background: var(--color-success);
    border-color: var(--color-success);
}

/* API Section Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-8) 0 var(--space-4);
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-default);
}

.section-divider span {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
}

/* Warning/Info Boxes */
.info-box {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin: var(--space-4) 0;
    font-size: 0.85rem;
    line-height: 1.6;
    border-left: 4px solid;
}

/* 信息提示 - 蓝色 */
.info-box-info {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

/* 警告提示 - 黄色 */
.info-box-warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

/* 成功提示 - 绿色 */
.info-box-tip {
    background: #f0fdf4;
    border-color: #10b981;
    color: #065f46;
}

/* 深色主题下保持可读 */
[data-theme="dark"] .info-box-info {
    background: #1e3a5f;
    border-color: #60a5fa;
    color: #bfdbfe;
}

[data-theme="dark"] .info-box-warning {
    background: #451a03;
    border-color: #fbbf24;
    color: #fde68a;
}

[data-theme="dark"] .info-box-tip {
    background: #052e16;
    border-color: #34d399;
    color: #a7f3d0;
}

/* Ocean 主题 */
[data-theme="ocean"] .info-box-info {
    background: #0a2a3f;
    border-color: #64ffda;
    color: #ccd6f6;
}

[data-theme="ocean"] .info-box-warning {
    background: #3d1a00;
    border-color: #ffd740;
    color: #ffe0b2;
}

/* Forest 主题 */
[data-theme="forest"] .info-box-info {
    background: #0a2a0a;
    border-color: #4caf50;
    color: #c8e6c9;
}

[data-theme="forest"] .info-box-warning {
    background: #3d2a00;
    border-color: #ff9800;
    color: #ffe0b2;
}

/* High Contrast 主题 */
[data-theme="high-contrast"] .info-box-info {
    background: #000044;
    border-color: #40c4ff;
    color: #ffffff;
}

[data-theme="high-contrast"] .info-box-warning {
    background: #440000;
    border-color: #ffd740;
    color: #ffffff;
}

/* Sepia 主题 */
[data-theme="sepia"] .info-box-info {
    background: #f0e6d3;
    border-color: #8b4513;
    color: #3e2723;
}

[data-theme="sepia"] .info-box-warning {
    background: #f5e6d3;
    border-color: #d2691e;
    color: #5d4037;
}

/* Neon Purple 主题 */
[data-theme="neon-purple"] .info-box-info {
    background: #2d0050;
    border-color: #c044ff;
    color: #e0ccff;
}

[data-theme="neon-purple"] .info-box-warning {
    background: #3d1a00;
    border-color: #ffaa44;
    color: #ffe0b8;
}

/* ============================================
   Cyberpunk Theme - 赛博朋克特效
   ============================================ */

/* 霓虹边框闪烁 */
[data-theme="cyberpunk"] .api-card {
    border: 1px solid #333300;
    box-shadow: 0 0 5px rgba(255, 230, 0, 0.2);
    transition: all var(--transition-base);
}

[data-theme="cyberpunk"] .api-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--accent-glow);
}

/* 代码块霓虹效果 */
[data-theme="cyberpunk"] pre {
    border: 1px solid #333300;
    box-shadow: 0 0 10px rgba(255, 230, 0, 0.1), inset 0 0 10px rgba(255, 230, 0, 0.05);
}

[data-theme="cyberpunk"] pre:hover {
    border-color: #ffe600;
    box-shadow: 0 0 20px rgba(255, 230, 0, 0.2), inset 0 0 20px rgba(255, 230, 0, 0.1);
}

/* 侧边栏霓虹 */
[data-theme="cyberpunk"] .sidebar {
    border-right: 1px solid #333300;
}

/* 选中导航项 */
[data-theme="cyberpunk"] .sidebar-nav a.active {
    background: rgba(255, 230, 0, 0.1);
    border-left-color: #ffe600;
    box-shadow: inset 0 0 10px rgba(255, 230, 0, 0.2);
    color: #ffe600;
    text-shadow: 0 0 5px rgba(255, 230, 0, 0.5);
}

/* 搜索框霓虹 */
[data-theme="cyberpunk"] .search-input:focus {
    border-color: #ffe600;
    box-shadow: 0 0 10px rgba(255, 230, 0, 0.3), 0 0 20px rgba(0, 255, 255, 0.1);
}

/* 标题霓虹效果 */
[data-theme="cyberpunk"] .content h1 {
    text-shadow: 0 0 10px rgba(255, 230, 0, 0.5), 0 0 20px rgba(255, 102, 0, 0.3);
}

[data-theme="cyberpunk"] .content h4 {
    color: #00ffff;
    border-bottom-color: #00ffff44;
}

/* Info Box */
[data-theme="cyberpunk"] .info-box-info {
    background: rgba(0, 255, 255, 0.1);
    border-color: #00ffff;
    color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

[data-theme="cyberpunk"] .info-box-warning {
    background: rgba(255, 102, 0, 0.1);
    border-color: #ff6600;
    color: #ff6600;
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.2);
}

/* 属性类型标签 */
[data-theme="cyberpunk"] .property-type {
    color: #00ffff;
    text-shadow: 0 0 3px rgba(0, 255, 255, 0.5);
}

/* 复制按钮 */
[data-theme="cyberpunk"] .copy-btn:hover {
    background: #ffe600;
    color: #000000;
    box-shadow: 0 0 10px rgba(255, 230, 0, 0.5);
}

/* 滚动条 */
[data-theme="cyberpunk"] ::-webkit-scrollbar-thumb {
    background: #333300;
}

[data-theme="cyberpunk"] ::-webkit-scrollbar-thumb:hover {
    background: #ffe600;
}

/* TOC 激活项 */
[data-theme="cyberpunk"] .toc-list a.active {
    color: #ffe600;
    border-left-color: #ffe600;
    text-shadow: 0 0 5px rgba(255, 230, 0, 0.5);
}

/* 统计数字 */
[data-theme="cyberpunk"] .hero-stat-number {
    text-shadow: 0 0 10px rgba(255, 230, 0, 0.7);
}

/* 链接悬停 */
[data-theme="cyberpunk"] .content a:hover {
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

/* 搜索结果选中状态 */
.search-result-item[aria-selected="true"] {
    background: var(--accent-light);
    border-left: 3px solid var(--accent-primary);
    padding-left: calc(var(--space-4) - 3px);
}

/* 深色主题下更明显的选中效果 */
[data-theme="dark"] .search-result-item[aria-selected="true"],
[data-theme="ocean"] .search-result-item[aria-selected="true"],
[data-theme="forest"] .search-result-item[aria-selected="true"] {
    background: var(--accent-light);
    border-left: 3px solid var(--accent-primary);
    box-shadow: inset 0 0 0 1px var(--accent-primary);
}

/* 高对比度主题 */
[data-theme="high-contrast"] .search-result-item[aria-selected="true"] {
    background: #004080;
    border-left: 3px solid #ffffff;
    color: #ffffff;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

.breadcrumbs .separator {
    color: var(--text-tertiary);
    font-size: 0.7rem;
}

.breadcrumbs .current {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.tag-lua { background: #dbeafe; color: #1d4ed8; }
.tag-math { background: #fce7f3; color: #9d174d; }
.tag-library { background: #dcfce7; color: #15803d; }
.tag-object { background: #fef3c7; color: #92400e; }
.tag-module { background: #ede9fe; color: #6d28d9; }

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background: var(--bg-hover);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: calc(var(--z-sidebar) - 1);
}

.sidebar-overlay.active {
    display: block;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.empty-state-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

/* Animation for content */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 属性列表中的链接 */
.property-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-bottom: 1px solid transparent;
}

.property-link:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-primary);
    text-decoration: none;
}

.link-icon {
    font-size: 0.7rem;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.property-link:hover .link-icon {
    opacity: 1;
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
}

.sidebar-collapse-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-collapse-content.collapsed {
    max-height: 0 !important;
}

.fade-in-up:nth-child(1) { animation-delay: 0s; }
.fade-in-up:nth-child(2) { animation-delay: 0.05s; }
.fade-in-up:nth-child(3) { animation-delay: 0.1s; }
.fade-in-up:nth-child(4) { animation-delay: 0.15s; }
.fade-in-up:nth-child(5) { animation-delay: 0.2s; }