/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 基础样式 - 浅色主题为默认 */
body {
    background-color: #ffffff;
    color: #333333;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* 深色主题 */
body.dark-theme {
    background-color: #000000;
    color: #ffffff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: left;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

body.dark-theme header {
    border-bottom: 1px solid #222;
}

/* 头部顶部区域 */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* 确保标题大小完全稳定，防止任何抖动 */
header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    color: #333333;
    margin: 0;
    padding: 0;
    /* 完全固定尺寸，防止任何缩放问题 */
    min-height: 3rem;
    height: 3rem;
    line-height: 3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* 移除任何可能导致尺寸变化的过渡效果 */
    transition: none;
    transform: none;
}

body.dark-theme header h1 {
    color: #ffffff;
}

#subtitle {
    font-size: 1.1rem;
    color: #666666;
    transition: opacity 1s ease-in-out;
    margin-bottom: 15px;
}

body.dark-theme #subtitle {
    color: #999999;
}

/* 头部操作区域 */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* 链接计数样式 - 数字使用特殊颜色 */
#header-count, #stored-count {
    font-size: 1.1rem;
    white-space: nowrap;
}

/* 链接计数中的数字高亮样式 - 严格使用红色 */
.count-number {
    color: #ff0000;
    font-weight: bold;
    font-size: 1.2em;
    transition: color 0.3s ease;
}

/* 浅色主题下的数字颜色 - 保持红色 */
body.light-theme .count-number {
    color: #ff0000;
}

/* 链接输入区域样式 */
.link-input-section {
    background-color: #ffffff;
    border-radius: 4px;
    padding: 0;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

body.dark-theme .link-input-section {
    background-color: #111111;
    border-color: #222222;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 500;
    color: #fff;
}

body:not(.dark-theme) .section-header h2 {
    color: #000000;
    font-weight: 600;
}

.recommendation-count {
    font-size: 0.9rem;
    color: #999;
}

body.light-theme .recommendation-count {
    color: #666;
}

/* 输入区域样式已移除，直接使用textarea样式 */


#youtube-link {
    width: 100%;
    padding: 12px 16px;
    background-color: #ffffff;
    border: none;
    color: #333333;
    border-radius: 0;
    font-size: 1rem;
    transition: all 0.3s;
    resize: vertical;
    min-height: 80px;
    margin: 0;
}

#youtube-link:focus {
    outline: none;
    border-color: #ff0000;
    background-color: #ffffff;
}

body.dark-theme #youtube-link {
    background-color: #1a1a1a;
    border: 1px solid #333;
    color: #ffffff;
}

body.dark-theme #youtube-link:focus {
    background-color: #222222;
}

.input-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 16px;
    background-color: #f8f8f8;
    border-top: 1px solid #e0e0e0;
    /* 移除固定高度，让它自适应内容 */
    box-sizing: border-box;
}

body.dark-theme .input-actions {
    background-color: #111111;
    border-top-color: #222222;
}

/* 批量输入区域样式 */
.batch-input-section {
    background-color: #ffffff;
    border-radius: 4px;
    padding: 0;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

body.dark-theme .batch-input-section {
    background-color: #111111;
    border-color: #222222;
}

.batch-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
}

body.dark-theme .batch-input-header {
    background-color: #111111;
    border-bottom-color: #222222;
}

.batch-input-header h3 {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

#batch-links {
    width: 100%;
    padding: 12px 16px;
    background-color: #ffffff;
    border: none;
    color: #333333;
    border-radius: 0;
    font-size: 1rem;
    transition: all 0.3s;
    resize: vertical;
    min-height: 150px;
    margin: 0;
}

#batch-links:focus {
    outline: none;
    border-color: #ff0000;
    background-color: #ffffff;
}

body.dark-theme #batch-links {
    background-color: #1a1a1a;
    border: 1px solid #333;
    color: #ffffff;
}

body.dark-theme #batch-links:focus {
    background-color: #222222;
}

.batch-input-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 16px;
    background-color: #f8f8f8;
    border-top: 1px solid #e0e0e0;
}

body.dark-theme .batch-input-actions {
    background-color: #111111;
    border-top-color: #222222;
}

/* 统计信息样式 */
.stats-section {
    background-color: #ffffff;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-around;
}

body.dark-theme .stats-section {
    background-color: #111111;
    border-color: #222222;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 150px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 5px;
    color: #ff0000;
}

body.dark-theme .stat-value {
    color: #ff3333;
}

.stat-label {
    font-size: 0.9rem;
    color: #666666;
}

body.dark-theme .stat-label {
    color: #999999;
}

/* 随机推荐区域样式 */
.random-section {
    background-color: #ffffff;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
}

body.dark-theme .random-section {
    background-color: #111111;
    border-color: #222222;
}

.random-links-container {
    max-height: 400px;
    overflow-y: auto;
}

.random-link-item {
    padding: 0;
    margin-bottom: 4px;
}

body.dark-theme .random-link-item {
    background-color: #1a1a1a;
}

/* 移除hover效果，完全简化显示 */


.random-link-number {
    display: none;
}

.random-link-content {
    display: block;
}

.random-link-title {
    font-size: 1rem;
    font-weight: normal;
    margin-bottom: 0;
    color: #333333;
}

body.dark-theme .random-link-title {
    color: #ffffff;
}

.random-link-url {
    font-size: 1rem;
    color: #333333;
    word-break: break-all;
    display: inline-block;
}

body.dark-theme .random-link-url {
    color: #999999;
}

.random-link-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

/* 已存储链接区域样式 */
.stored-section {
    background-color: #ffffff;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
}

body.dark-theme .stored-section {
    background-color: #111111;
    border-color: #222222;
}

.stored-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.stored-links-container {
    max-height: 400px;
    overflow-y: auto;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: #f8f8f8;
    border-radius: 4px;
    margin-bottom: 8px;
    transition: all 0.3s;
    min-height: 50px;
}

body.dark-theme .link-item {
    background-color: #1a1a1a;
}

.link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body.dark-theme .link-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.checkbox-container {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    margin-top: 0;
}

.link-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-label {
    position: relative;
    display: inline-block;
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

body.dark-theme .checkbox-label {
    background-color: #222;
    border-color: #444;
}

.checkbox-container:hover .checkbox-label {
    border-color: #666;
}

body.dark-theme .checkbox-container:hover .checkbox-label {
    border-color: #888;
}

.link-checkbox:checked ~ .checkbox-label {
    background-color: #2563eb;
    border-color: #2563eb;
}

.checkbox-label:after {
    content: "";
    position: absolute;
    display: none;
}

.link-checkbox:checked ~ .checkbox-label:after {
    display: block;
}

.checkbox-label:after {
    left: 6px;
    top: 4px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.link-number {
    font-size: 0.9rem;
    color: #999999;
    min-width: 20px;
    text-align: center;
}

.link-content {
    flex: 1;
}

.link-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: #333333;
}

body.dark-theme .link-title {
    color: #ffffff;
}

.link-url {
    font-size: 0.9rem;
    color: #2563eb; /* 蓝色，更明显的链接颜色 */
    text-decoration: underline;
    word-break: break-all;
    cursor: pointer;
    display: inline-block;
    padding: 4px 0;
    transition: all 0.2s ease;
}

.link-url:hover {
    color: #1d4ed8; /* 更暗的蓝色作为悬停效果 */
    text-decoration: underline;
    background-color: #f3f4f6;
    padding: 4px 6px;
    border-radius: 4px;
}

.link-url:active {
    color: #1e40af;
}

body.dark-theme .link-url {
    color: #999999;
}

.link-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination-btn {
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    color: #333333;
}

body.dark-theme .pagination-btn {
    background-color: #222222;
    color: #ffffff;
}

.pagination-btn:hover {
    background-color: #e0e0e0;
}

body.dark-theme .pagination-btn:hover {
    background-color: #333333;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background-color: #ff0000;
    color: #ffffff;
}

body.dark-theme .pagination-btn.active {
    background-color: #ff3333;
}

/* 按钮样式 */
.btn {
    padding: 12px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 44px;
    box-sizing: border-box;
}

.btn-primary {
    background-color: #ff0000;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #cc0000;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 0, 0, 0.2);
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333333;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body.dark-theme .btn-secondary {
    background-color: #222222;
    color: #ffffff;
}

body.dark-theme .btn-secondary:hover {
    background-color: #333333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-danger {
    background-color: #dc3545;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.btn-success {
    background-color: #28a745;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

#clear-search-btn {
    margin-left: 8px;
    height: 40px;
    padding: 0 16px;
}

/* Search input field styling */
.search-input {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid #dddddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
    height: 40px;
    box-sizing: border-box;
}

/* 统一select高度与button一致 */
.filter-select {
    height: 44px;
    box-sizing: border-box;
    padding: 0 12px;
}

body.dark-theme .search-input {
    background-color: #222222;
    border-color: #444444;
    color: #ffffff;
}

/* Toast通知样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.toast {
    background-color: #333333;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background-color: #28a745;
}

.toast-error {
    background-color: #dc3545;
}

.toast-warning {
    background-color: #ffc107;
    color: #333333;
}

.toast-info {
    background-color: #17a2b8;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999999;
}

body.dark-theme .empty-state {
    color: #666666;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #dddddd;
}

body.dark-theme .empty-state-icon {
    color: #333333;
}

.empty-state-text {
    font-size: 1.1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stats-section {
        flex-direction: column;
        align-items: center;
    }
    
    .stat-item {
        width: 100%;
    }
    
    .input-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .batch-input-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .stored-actions {
        flex-direction: column;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .toast-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    #subtitle {
        font-size: 1rem;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

/* 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff0000;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

body.dark-theme .loading-spinner {
    border-color: #333333;
    border-top-color: #ff3333;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 选择文本样式 */
::selection {
    background-color: #ff0000;
    color: #ffffff;
}

body.dark-theme ::selection {
    background-color: #ff3333;
    color: #ffffff;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

body.dark-theme ::-webkit-scrollbar-track {
    background: #111111;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background: #333333;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: #444444;
}