/* 
LibreTV 全局样式
包含多个页面共享的基础样式
对于特定页面的样式，请参考:
- index.css: 首页特定样式
- player.css: 播放器页面特定样式
- watch.css: 重定向页面特定样式
- modals.css: 模态框和提示框样式
*/

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 6px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.close-btn:hover {
    background: #333;
    border-color: #555;
}

.close-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

:root {
    /* YuTV 现代化深色主题配色方案 */
    --primary-color: #3b82f6;       /* 电光蓝主色调 */
    --primary-light: #60a5fa;       /* 浅电光蓝变体 */
    --primary-dark: #1d4ed8;        /* 深电光蓝 */
    --secondary-color: #1e293b;     /* 深炭灰背景色 */
    --accent-color: #10b981;        /* 翠绿强调色 */
    --warning-color: #f59e0b;       /* 琥珀警告色 */
    --text-color: #f8fafc;          /* 纯白文本 */
    --text-muted: #94a3b8;          /* 石板灰次级文本 */
    --text-secondary: #64748b;      /* 次要文本颜色 */
    --border-color: rgba(59, 130, 246, 0.2);

    /* 主题相关变量 - 深色模式 */
    --bg-primary: #0f172a;          /* 主背景色 */
    --bg-secondary: #1e293b;        /* 次要背景色 */
    --bg-card: rgba(30, 41, 59, 0.8); /* 卡片背景 */
    --bg-card-hover: rgba(51, 65, 85, 0.9); /* 卡片悬停背景 */
    --text-primary: #f8fafc;        /* 主文本色 */
    --text-secondary: #94a3b8;      /* 次要文本色 */
    --text-muted: #64748b;          /* 静音文本色 */
    --border-primary: rgba(59, 130, 246, 0.2); /* 主边框色 */
    --border-secondary: rgba(255, 255, 255, 0.1); /* 次要边框色 */
}

/* 淺色模式主题变量 */
[data-theme="light"] {
    --primary-color: #2563eb;       /* 深蓝主色调 */
    --primary-light: #3b82f6;       /* 蓝色变体 */
    --primary-dark: #1d4ed8;        /* 深蓝 */
    --secondary-color: #f1f5f9;     /* 浅灰背景色 */
    --accent-color: #059669;        /* 绿色强调色 */
    --warning-color: #d97706;       /* 橙色警告色 */

    /* 主题相关变量 - 淺色模式 */
    --bg-primary: #f8fafc;          /* 主背景色 - 柔和淺灰 */
    --bg-secondary: #f1f5f9;        /* 次要背景色 - 更淺的灰 */
    --bg-card: rgba(255, 255, 255, 0.8); /* 卡片背景 */
    --bg-card-hover: rgba(255, 255, 255, 0.95); /* 卡片悬停背景 */
    --text-primary: #0f172a;        /* 主文本色 */
    --text-secondary: #475569;      /* 次要文本色 */
    --text-muted: #64748b;          /* 静音文本色 */
    --border-primary: rgba(37, 99, 235, 0.2); /* 主边框色 */
    --border-secondary: rgba(0, 0, 0, 0.08); /* 次要边框色 */
}
    --border-subtle: rgba(148, 163, 184, 0.1);
    --page-gradient-start: #0f172a; /* 深石板起始色 */
    --page-gradient-end: #1e293b;   /* 石板结束色 */
    --card-bg: #1e293b;             /* 卡片背景色 */
    --card-bg-hover: #334155;       /* 卡片悬停背景色 */
    --card-border: rgba(148, 163, 184, 0.1);
    --card-hover-border: rgba(59, 130, 246, 0.4);
    --surface-1: #334155;           /* 表面层级1 */
    --surface-2: #475569;           /* 表面层级2 */
}

/* 主體背景 - 支持主題切換 */
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.page-bg {
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease;
    /* 现代化微妙纹理背景 */
    background-image:
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(59, 130, 246, 0.01) 0%, transparent 50%);
    background-attachment: fixed;
    background-size: 800px 800px, 600px 600px, 400px 400px;
}

button, .card-hover {
    transition: all 0.3s ease;
}

/* 现代化卡片设计 - 支持主題切換 */
.card-hover {
    border: 1px solid var(--border-secondary);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.12),
        0 1px 2px rgba(0, 0, 0, 0.24);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 确保卡片内容区域高度一致性 */
.card-hover .flex-grow {
    min-height: unset; /* 移除最小高度限制，让内容自然流动 */
    display: flex;
    flex-direction: column;
}

/* 针对不同长度的标题优化显示 */
.card-hover h3 {
    min-height: unset;
    max-height: unset;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    line-height: 1.2rem;
    word-break: break-word; /* 允许在任何字符间断行 */
    hyphens: auto; /* 允许断词 */
}

.card-hover::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(16, 185, 129, 0.05));
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.card-hover:hover {
    border-color: var(--border-primary);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 10px 15px rgba(0, 0, 0, 0.1),
        0 0 0 1px var(--border-primary);
}

.card-hover:hover::before {
    opacity: 1;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 现代化设置面板样式 */
.settings-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-1) var(--secondary-color);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}

.settings-panel.show {
    transform: translateX(0);
}

.settings-panel::-webkit-scrollbar {
    width: 6px;
}

.settings-panel::-webkit-scrollbar-track {
    background: transparent;
}

.settings-panel::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 4px;
}

.search-button {
    background: var(--primary-color);
    color: var(--text-color);
}

.search-button:hover {
    background: var(--primary-light);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
    transition: all 0.3s ease;
}

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

* {
    scrollbar-width: thin;
    scrollbar-color: #333 #111;
}

.search-tag {
    background: var(--card-bg);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.search-tag:hover {
    background: var(--surface-1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.footer {
    width: 100%;
    transition: all 0.3s ease;
    margin-top: auto;
    background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.8));
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-subtle);
}

.footer a:hover {
    text-decoration: underline;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    flex: 1;
}

@media screen and (min-height: 800px) {
    body {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }
    
    .container {
        flex: 1;
    }
    
    .footer {
        margin-top: auto;
    }
}

@media screen and (max-width: 640px) {
    .footer {
        padding-bottom: 2rem;
    }
}

/* 移动端布局优化 */
@media screen and (max-width: 768px) {
    .card-hover h3 {
        min-height: 2.5rem;
    }
    
    .card-hover .flex-grow {
        min-height: 80px;
    }
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

#modal.show {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#modal.hide {
    animation: fadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#modal > div {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(59, 130, 246, 0.1);
    border-radius: 16px;
}

#episodesGrid button {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    font-weight: 500;
}

#episodesGrid button:hover {
    background: var(--surface-1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 0 0 1px rgba(59, 130, 246, 0.1);
}

#yellowFilterToggle:checked + .toggle-bg {
    background-color: var(--primary-color);
}

#yellowFilterToggle:checked ~ .toggle-dot {
    transform: translateX(1.5rem);
}

#yellowFilterToggle:focus + .toggle-bg,
#yellowFilterToggle:hover + .toggle-bg {
    box-shadow: 0 0 0 2px rgba(0, 204, 255, 0.3);
}

/* 添加广告过滤开关的CSS */
#adFilterToggle:checked + .toggle-bg {
    background-color: var(--primary-color);
}

#adFilterToggle:checked ~ .toggle-dot {
    transform: translateX(1.5rem);
}

#adFilterToggle:focus + .toggle-bg,
#adFilterToggle:hover + .toggle-bg {
    box-shadow: 0 0 0 2px rgba(0, 204, 255, 0.3);
}

.toggle-dot {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.06);
}

.toggle-bg {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--surface-1);
}

#yellowFilterToggle:checked ~ .toggle-dot {
    box-shadow: 0 2px 4px rgba(0, 204, 255, 0.3);
}

#adFilterToggle:checked ~ .toggle-dot {
    box-shadow: 0 2px 4px rgba(0, 204, 255, 0.3);
}

/* 现代化复选框样式 */
.form-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 16px;
    width: 16px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-subtle);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-checkbox:hover {
    border-color: var(--primary-color);
    background-color: var(--surface-1);
}

.form-checkbox:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.form-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* API滚动区域美化 */
#apiCheckboxes {
    scrollbar-width: thin;
    scrollbar-color: #444 #222;
}

#apiCheckboxes::-webkit-scrollbar {
    width: 6px;
}

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

#apiCheckboxes::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 4px;
}

/* 自定义API列表样式 */
#customApisList {
    scrollbar-width: thin;
    scrollbar-color: #444 #222;
}

#customApisList::-webkit-scrollbar {
    width: 6px;
}

#customApisList::-webkit-scrollbar-track {
    background: transparent;
}

#customApisList::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 4px;
}

/* 设置面板滚动样式 */
.settings-panel {
    scrollbar-width: thin;
    scrollbar-color: #444 #222;
}

.settings-panel::-webkit-scrollbar {
    width: 6px;
}

.settings-panel::-webkit-scrollbar-track {
    background: transparent;
}

.settings-panel::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 4px;
}

/* 添加自定义API表单动画 */
#addCustomApiForm {
    transition: all 0.3s ease;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

#addCustomApiForm.hidden {
    max-height: 0;
    padding: 0;
    opacity: 0;
}

#addCustomApiForm:not(.hidden) {
    max-height: 230px;
    opacity: 1;
}

/* 成人内容API标记样式 */
.api-adult + label {
    color: #ff6b8b !important;
}

/* 添加警告图标和标签样式 */
.adult-warning {
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
    color: #ff6b8b;
}

.adult-warning svg {
    width: 12px;
    height: 12px;
    margin-right: 4px;
}

/* 过滤器禁用样式 */
.filter-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* API组标题样式 */
.api-group-title {
    grid-column: span 2;
    padding: 0.25rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid #333;
    color: #8599b2;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.api-group-title.adult {
    color: #ff6b8b;
}

/* 过滤器禁用样式 - 改进版本 */
.filter-disabled {
    position: relative;
}

.filter-disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    border-radius: 0.5rem;
    z-index: 5;
}

.filter-disabled > * {
    opacity: 0.7;
}

.filter-disabled .toggle-bg {
    background-color: #333 !important;
}

.filter-disabled .toggle-dot {
    transform: translateX(0) !important;
    background-color: #666 !important;
}

/* 改进过滤器禁用样式 */
.filter-disabled .filter-description {
    color: #ff6b8b !important;
    font-style: italic;
    font-weight: 500;
}

/* 修改过滤器禁用样式，确保文字清晰可见 */
.filter-disabled {
    position: relative;
}

.filter-disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.3);
    border-radius: 0.5rem;
    z-index: 5;
}

.filter-disabled > * {
    opacity: 1; /* 提高子元素不透明度，保证可见性 */
    z-index: 6; /* 确保内容在遮罩上方 */
}

/* 改进过滤器禁用状态下的描述样式 */
.filter-disabled .filter-description {
    color: #ff7b9d !important; /* 更亮的粉色 */
    font-style: italic;
    font-weight: 500;
    text-shadow: 0 0 2px rgba(0,0,0,0.8); /* 添加文字阴影提高对比度 */
}

/* 开关的禁用样式 */
.filter-disabled .toggle-bg {
    background-color: #444 !important;
    opacity: 0.8;
}

.filter-disabled .toggle-dot {
    transform: translateX(0) ;
    background-color: #777 ;
    opacity: 0.9;
}

/* 警告提示样式改进 */
.filter-tooltip {
    background-color: rgba(255, 61, 87, 0.1);
    border: 1px solid rgba(255, 61, 87, 0.2);
    border-radius: 0.25rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    line-height: 1.25;
    position: relative;
    z-index: 10;
}

.filter-tooltip svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-right: 0.35rem;
}

/* 编辑按钮样式 */
.custom-api-edit {
    color: #3b82f6;
    transition: color 0.2s ease;
}

.custom-api-edit:hover {
    color: #2563eb;
}

/* 自定义API条目样式改进 */
#customApisList .api-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    background-color: #222;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

#customApisList .api-item:hover {
    background-color: #2a2a2a;
}

/* 成人内容标签样式 */
.adult-tag {
    display: inline-flex;
    align-items: center;
    color: #ff6b8b;
    font-size: 0.7rem;
    font-weight: 500;
    margin-right: 0.35rem;
}

/* 现代化历史记录面板样式 */
.history-panel {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: scroll;
    overflow-x: hidden;
    width: 360px;
    box-sizing: border-box;
    scrollbar-gutter: stable;
}

.history-panel.show {
    transform: translateX(0);
}

#historyList {
    padding-right: 6px; /* 为滚动条预留空间，确保内容不被挤压 */
}

/* 现代化历史记录项样式 */
.history-item {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 12px 16px;
    position: relative;
    margin-bottom: 12px;
    width: 100%;
    backdrop-filter: blur(10px);
}

.history-item:hover {
    transform: translateY(-2px);
    background: var(--card-bg-hover);
    border-color: var(--card-hover-border);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 10px 15px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(59, 130, 246, 0.1);
}

/* 添加组悬停效果，使删除按钮在悬停时显示 */
.history-item .delete-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-item:hover .delete-btn {
    opacity: 1;
}

.history-info {
    padding: 0; /* 移除额外的内边距 */
    min-height: 70px;
}

.history-title {
    font-weight: 500;
    font-size: 0.95rem; /* 减小字体大小 */
    margin-bottom: 2px; /* 减小底部边距 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-meta {
    color: #bbb;
    font-size: 0.75rem; /* 减小字体大小 */
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1px; /* 减小边距 */
}

.history-episode {
    color: #3b82f6;
}

.history-source {
    color: #10b981;
}

.history-time {
    color: #888;
    font-size: 0.7rem; /* 减小字体大小 */
    margin-top: 1px; /* 减小顶部边距 */
}

.history-separator {
    color: #666;
}

.history-thumbnail {
    width: 100%;
    height: 90px;
    background-color: #222;
    overflow: hidden;
}

.history-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-info {
    padding: 10px;
}

.history-time {
    color: #888;
    font-size: 0.8rem;
    margin-top: 4px;
}

.history-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 添加播放进度条样式 */
.history-progress {
    margin: 5px 0;
}

.progress-bar {
    height: 3px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 2px;
}

.progress-filled {
    height: 100%;
    background: linear-gradient(to right, #00ccff, #3b82f6);
    border-radius: 2px;
}

.progress-text {
    font-size: 10px;
    color: #888;
    text-align: right;
}

/* 添加恢复播放提示样式 */
.position-restore-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 100;
    opacity: 0;
    transition: all 0.3s ease;
}

.position-restore-hint.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 锁定控制时屏蔽交互 */
.player-container.controls-locked .dplayer-controller,
.player-container.controls-locked .dplayer-mask,
.player-container.controls-locked .dplayer-bar-wrap,
.player-container.controls-locked .dplayer-statusbar,
.player-container.controls-locked .shortcut-hint {
    opacity: 0 !important;
    pointer-events: none !important;
}
/* 保留锁按钮可见可点 */
.player-container.controls-locked #lockToggle {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* 播放器顶部header移动端优化 */
.player-header {
    gap: 0.5rem;
}
.custom-title-scroll {
    overflow-x: auto;
    white-space: nowrap;
    text-overflow: ellipsis;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.custom-title-scroll::-webkit-scrollbar {
    display: none;
}
.logo-text {
    display: inline;
}
.home-btn-text {
    display: inline;
}
@media (max-width: 640px) {
    .logo-text {
        display: none;
    }
    .home-btn-text {
        display: none;
    }
    .logo-icon {
        margin-right: 0;
    }
    .home-btn svg {
        margin-right: 0;
    }
    .player-header {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }
    .custom-title-scroll {
        font-size: 1rem;
    }
}

/* 搜索结果卡片优化：横向布局 */
.search-card-img-container {
    width: 100px;  /* 增加宽度，从80px到100px */
    height: 150px; /* 增加高度，从120px到150px */
    overflow: hidden;
    background-color: #191919;
}

/* 确保图片不会被拉伸，并且能够正确显示 */
.search-card-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 针对搜索结果卡片修改网格布局以适应横向卡片 */
@media (max-width: 640px) {
    #results {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
}

/* 响应式调整：在小屏幕上依然保持较好的视觉效果 */
@media (min-width: 641px) and (max-width: 768px) {
    #results {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* 调整网格布局，减少每行卡片数量以适应更大尺寸的卡片 */
@media (min-width: 769px) and (max-width: 1024px) {
    #results {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1025px) {
    #results {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

/* 优化卡片内元素间距 */
.card-hover .p-2 {
    padding: 0.75rem; /* 增加内边距 */
}

/* 增加卡片内字体大小 */
.card-hover h3 {
    font-size: 0.95rem; /* 增加标题字体大小 */
    line-height: 1.3rem;
    margin-bottom: 0.5rem;
}

.card-hover p {
    font-size: 0.8rem; /* 增加描述字体大小 */
}

/* 优化卡片内元素间距 */
.card-hover .p-2 {
    padding: 0.5rem;
}

/* 确保Toast显示在顶层并有适当的转换效果 */
#toast {
    z-index: 9999; /* 确保显示在最上层 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    text-align: center;
    pointer-events: none; /* 防止toast阻挡点击事件 */
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-100%);
}

/* 详情模态框样式优化 */
#modal .modal-detail-info {
    background: linear-gradient(135deg, #0a0a0a, #111);
    border: 1px solid #222;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

#modal .detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    #modal .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

#modal .detail-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#modal .detail-label {
    color: #9ca3af;
    font-weight: 500;
    min-width: 3rem;
    flex-shrink: 0;
}

#modal .detail-value {
    color: white;
    flex: 1;
    word-break: break-word;
}

#modal .detail-desc {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

#modal .detail-desc-content {
    color: #d1d5db;
    font-size: 0.875rem;
    line-height: 1.6;
    max-height: 8rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #444 #222;
}

#modal .detail-desc-content::-webkit-scrollbar {
    width: 6px;
}

#modal .detail-desc-content::-webkit-scrollbar-track {
    background: #222;
    border-radius: 4px;
}

#modal .detail-desc-content::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 4px;
}

/* 集数统计信息样式 */
#modal .episode-stats {
    color: #9ca3af;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 移动端优化 */
@media (max-width: 640px) {
    #modal .detail-grid {
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    #modal .detail-label {
        min-width: 2.5rem;
    }
    
    #modal .detail-desc-content {
        max-height: 6rem;
        font-size: 0.8rem;
    }
}

/* 美化搜索結果排序下拉選單 */
.sort-dropdown {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sort-dropdown:hover {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2360a5fa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.sort-dropdown:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 8px rgba(59, 130, 246, 0.2);
}

/* 下拉選項樣式 */
.sort-dropdown option {
    background-color: #1e293b;
    color: #f8fafc;
    padding: 10px 12px;
    border: none;
    font-size: 14px;
    font-weight: 500;
}

.sort-dropdown option:hover,
.sort-dropdown option:focus,
.sort-dropdown option:checked {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

/* Firefox 特殊處理 */
@-moz-document url-prefix() {
    .sort-dropdown {
        background-image: none;
        padding-right: 1rem;
    }

    .sort-dropdown option {
        background-color: #334155;
    }

    .sort-dropdown option:checked {
        background-color: #3b82f6;
    }
}

/* 隱藏最近搜索區域的滾動條 */
#recentSearches {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#recentSearches::-webkit-scrollbar {
    display: none;
}

/* ===== 主題切換相關樣式 ===== */

/* 主題相關文本樣式 */
.text-theme-primary {
    color: var(--text-primary) !important;
}

.text-theme-secondary {
    color: var(--text-secondary) !important;
}

.text-theme-muted {
    color: var(--text-muted) !important;
}

/* 主題相關背景樣式 */
.bg-theme-primary {
    background-color: var(--bg-primary) !important;
}

.bg-theme-secondary {
    background-color: var(--bg-secondary) !important;
}

.bg-theme-card {
    background-color: var(--bg-card) !important;
}

/* 主題相關邊框樣式 */
.border-theme-primary {
    border-color: var(--border-primary) !important;
}

.border-theme-secondary {
    border-color: var(--border-secondary) !important;
}

/* 淺色模式特定樣式調整 */
[data-theme="light"] .page-bg {
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(5, 150, 105, 0.015) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(37, 99, 235, 0.008) 0%, transparent 50%);
}

[data-theme="light"] .history-panel {
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid var(--border-secondary);
}

[data-theme="light"] .history-item {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
}

[data-theme="light"] .history-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-primary);
}

/* 淺色模式下的搜索框樣式 */
[data-theme="light"] .search-box {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
}

/* 淺色模式下的按鈕樣式 */
[data-theme="light"] .close-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
}

[data-theme="light"] .close-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-primary);
}

/* 淺色模式下的文字顏色覆蓋 */
[data-theme="light"] .text-white {
    color: var(--text-primary) !important;
}

[data-theme="light"] .text-gray-500,
[data-theme="light"] .text-gray-400 {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .text-slate-300,
[data-theme="light"] .text-slate-400 {
    color: var(--text-muted) !important;
}

/* 淺色模式下的搜索框樣式 */
[data-theme="light"] #searchInput {
    color: var(--text-primary) !important;
}

[data-theme="light"] #searchInput::placeholder {
    color: var(--text-muted) !important;
}

/* 淺色模式下的背景樣式覆蓋 */
[data-theme="light"] .bg-slate-800\/50,
[data-theme="light"] .bg-slate-800\/30 {
    background: var(--bg-card) !important;
}

[data-theme="light"] .bg-white\/5,
[data-theme="light"] .bg-white\/10 {
    background: var(--bg-card) !important;
}

/* 淺色模式下的邊框樣式 */
[data-theme="light"] .border-white\/10,
[data-theme="light"] .border-white\/20 {
    border-color: var(--border-secondary) !important;
}

/* 淺色模式下的模態框樣式 */
[data-theme="light"] #modal > div,
[data-theme="light"] #passwordModal > div,
[data-theme="light"] #disclaimerModal > div {
    background: var(--bg-card) !important;
    border-color: var(--border-secondary) !important;
}

/* 淺色模式下的設置面板樣式 */
[data-theme="light"] #settingsPanel {
    background: var(--bg-card) !important;
    border-color: var(--border-secondary) !important;
}

/* 淺色模式下的輸入框樣式 */
[data-theme="light"] .bg-slate-700\/50 {
    background: var(--bg-secondary) !important;
    border-color: var(--border-secondary) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .border-slate-600\/50,
[data-theme="light"] .border-slate-600\/30 {
    border-color: var(--border-secondary) !important;
}

/* 淺色模式下的切換按鈕樣式 */
[data-theme="light"] .bg-slate-600\/80,
[data-theme="light"] .bg-slate-600 {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .hover\:bg-slate-500\/80:hover,
[data-theme="light"] .hover\:bg-slate-500:hover {
    background: var(--bg-card-hover) !important;
}

/* 淺色模式下的邊框線樣式 */
[data-theme="light"] .border-\[\#333\],
[data-theme="light"] .border-\[\#222\] {
    border-color: var(--border-secondary) !important;
}

/* 淺色模式下的背景色覆蓋 */
[data-theme="light"] .bg-\[\#333\],
[data-theme="light"] .bg-\[\#222\] {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .hover\:bg-\[\#444\]:hover {
    background: var(--bg-card-hover) !important;
}

/* 淺色模式下的Toast提示樣式 */
[data-theme="light"] #toast {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-secondary);
}

/* 淺色模式下的Loading樣式 */
[data-theme="light"] #loading > div {
    background: var(--bg-card) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="light"] #loading .text-white {
    color: var(--text-primary) !important;
}

/* 淺色模式下的搜索歷史樣式 */
[data-theme="light"] #recentSearches .text-gray-500 {
    color: var(--text-secondary) !important;
}

[data-theme="light"] #recentSearches .hover\:text-white:hover {
    color: var(--text-primary) !important;
}

[data-theme="light"] #searchHistoryContainer {
    background: var(--bg-card) !important;
    border-color: var(--border-secondary) !important;
}

/* 淺色模式下的觀看歷史樣式 */
[data-theme="light"] #historyList .text-gray-500,
[data-theme="light"] #historyList .text-gray-400 {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .history-item .text-gray-400 {
    color: var(--text-muted) !important;
}

[data-theme="light"] .history-item .hover\:text-red-400:hover {
    color: #dc2626 !important;
}

[data-theme="light"] .history-item .hover\:bg-gray-800:hover {
    background: var(--bg-card-hover) !important;
}

/* 淺色模式下的搜索歷史容器背景 */
[data-theme="light"] #searchHistoryContainer {
    background: var(--bg-card) !important;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-secondary) !important;
}

/* 淺色模式下的搜索標籤樣式 */
[data-theme="light"] .search-tag {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="light"] .search-tag:hover {
    background: var(--bg-card-hover) !important;
}

/* 淺色模式下的搜索標籤刪除按鈕 */
[data-theme="light"] .search-tag .text-gray-500 {
    color: var(--text-muted) !important;
}

[data-theme="light"] .search-tag .hover\:text-red-500:hover {
    color: #dc2626 !important;
}

/* 淺色模式下的搜索歷史清除按鈕 */
[data-theme="light"] #clearHistoryBtn {
    color: var(--text-secondary) !important;
}

[data-theme="light"] #clearHistoryBtn:hover {
    color: var(--text-primary) !important;
}

/* 淺色模式下的電影卡片樣式 */
[data-theme="light"] .card-hover h3 {
    color: var(--text-primary) !important;
}

[data-theme="light"] .card-hover p {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .card-hover .text-gray-400 {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .card-hover .text-gray-500 {
    color: var(--text-muted) !important;
}

/* 淺色模式下的豆瓣卡片樣式 */
[data-theme="light"] .text-white {
    color: var(--text-primary) !important;
}

[data-theme="light"] .bg-\[\#111\] {
    background: var(--bg-card) !important;
}

/* 淺色模式下的卡片邊框 */
[data-theme="light"] .border-gray-800 {
    border-color: var(--border-secondary) !important;
}

/* 淺色模式下的標籤顏色 */
[data-theme="light"] .text-blue-300 {
    color: #2563eb !important;
}

[data-theme="light"] .text-purple-300 {
    color: #7c3aed !important;
}

[data-theme="light"] .text-yellow-400 {
    color: #d97706 !important;
}

/* 淺色模式下的懸停效果 */
[data-theme="light"] .hover\:text-pink-400:hover {
    color: #ec4899 !important;
}

[data-theme="light"] .hover\:text-blue-400:hover {
    color: #3b82f6 !important;
}

/* 淺色模式下的豆瓣標籤樣式 */
[data-theme="light"] .bg-\[\#1a1a1a\] {
    background: #dbeafe !important; /* 淺藍色背景 */
    color: #1e40af !important; /* 深藍色文字 */
    border-color: #93c5fd !important; /* 淺藍色邊框 */
}

[data-theme="light"] .hover\:bg-pink-700:hover {
    background: #3b82f6 !important; /* 懸停時藍色背景 */
    color: white !important;
    border-color: #1d4ed8 !important;
}

[data-theme="light"] .bg-pink-600 {
    background: #2563eb !important; /* 選中狀態藍色背景 */
    color: white !important;
    border-color: #1d4ed8 !important;
}

/* 淺色模式下的標籤管理按鈕 */
[data-theme="light"] .border-\[\#333\] {
    border-color: #93c5fd !important;
}

[data-theme="light"] .hover\:border-white:hover {
    border-color: #1d4ed8 !important;
}

/* 淺色模式下的電影詳情模態框樣式 */
[data-theme="light"] #modal .modal-detail-info {
    background: var(--bg-card) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="light"] #modal .detail-grid {
    color: var(--text-primary) !important;
}

[data-theme="light"] #modal .detail-label {
    color: var(--text-secondary) !important;
}

[data-theme="light"] #modal .detail-value {
    color: var(--text-primary) !important;
}

[data-theme="light"] #modal .detail-desc {
    border-color: var(--border-secondary) !important;
}

[data-theme="light"] #modal .detail-desc-content {
    color: var(--text-secondary) !important;
    background: var(--bg-secondary) !important;
    scrollbar-color: var(--border-secondary) var(--bg-secondary) !important;
}

[data-theme="light"] #modal .detail-desc-content::-webkit-scrollbar-track {
    background: var(--bg-secondary) !important;
}

[data-theme="light"] #modal .detail-desc-content::-webkit-scrollbar-thumb {
    background-color: var(--border-secondary) !important;
}

/* ===== 友情鏈結樣式 ===== */

/* 友情鏈結容器樣式 - 始終保持深色風格 */
.friend-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 0.5rem;
    color: #94a3b8 !important;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.friend-link:hover {
    background: #334155 !important;
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
    transform: translateY(-2px);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 0 0 1px #3b82f6;
}

/* 友情鏈結標題樣式 */
.friend-link + .friend-link {
    margin-left: 0; /* 重置間距，由父容器的gap控制 */
}

/* 響應式調整 */
@media (max-width: 640px) {
    .friend-link {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* 淺色模式下的友情鏈結分隔線 */
[data-theme="light"] .border-\[\#333\] {
    border-color: var(--border-secondary) !important;
}
