/*
低端影视 全局样式 - 清新天蓝主题
包含多个页面共享的基础样式
*/

:root {
    /* 低端影视 - 清新天蓝主题配色方案 */
    --primary-color: #0ea5e9;       /* 天蓝色主色调 */
    --primary-light: #38bdf8;       /* 浅天蓝色 */
    --primary-dark: #0284c7;        /* 深天蓝色 */
    --secondary-color: #f0f9ff;     /* 浅蓝白背景色 */
    --accent-color: #06b6d4;        /* 青色强调色 */
    --text-color: #1e293b;          /* 深灰文本 */
    --text-muted: #64748b;          /* 灰色次级文本 */
    --border-color: #e0f2fe;        /* 浅蓝边框色 */
    --card-bg: #ffffff;             /* 卡片背景 */
    --card-shadow: rgba(14, 165, 233, 0.1);
    --card-hover-shadow: rgba(14, 165, 233, 0.2);
}

/* 基础过渡效果 */
button, .card-hover {
    transition: all 0.3s ease;
}

/* 视频卡片样式 - 清新风格 */
.card-hover {
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: 0 2px 8px var(--card-shadow);
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.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.3rem;
    word-break: break-word;
    color: var(--text-color);
}

.card-hover:hover {
    border-color: var(--primary-light);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px var(--card-hover-shadow);
}

/* 设置面板样式 */
.settings-panel {
    scrollbar-width: thin;
    scrollbar-color: #bae6fd #f0f9ff;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.settings-panel.show {
    transform: translateX(0);
}

.settings-panel::-webkit-scrollbar {
    width: 6px;
}

.settings-panel::-webkit-scrollbar-track {
    background: #f0f9ff;
}

.settings-panel::-webkit-scrollbar-thumb {
    background-color: #bae6fd;
    border-radius: 4px;
}

/* 全局滚动条 - 浅色主题 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f9ff;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #7dd3fc;
    border-radius: 4px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #38bdf8;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #7dd3fc #f0f9ff;
}

/* 搜索标签 */
.search-tag {
    background: white;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--card-shadow);
}

.search-tag:hover {
    background: #f0f9ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

#modal.show {
    animation: fadeIn 0.3s forwards;
}

#modal.hide {
    animation: fadeOut 0.3s forwards;
}

/* 集数选择按钮 */
#episodesGrid button {
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    color: #0284c7;
    transition: all 0.2s ease;
    border-radius: 8px;
}

#episodesGrid button:hover {
    background: #e0f2fe;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px var(--card-shadow);
}

/* 开关样式 */
#yellowFilterToggle:checked + .toggle-bg,
#adFilterToggle:checked + .toggle-bg,
#doubanToggle:checked + .toggle-bg {
    background-color: var(--primary-color);
}

#yellowFilterToggle:checked ~ .toggle-dot,
#adFilterToggle:checked ~ .toggle-dot,
#doubanToggle:checked ~ .toggle-dot {
    transform: translateX(1.5rem);
}

.toggle-dot {
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-bg {
    transition: background-color 0.3s ease-in-out;
}

/* API复选框样式 - 浅色主题 */
.form-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 16px;
    width: 16px;
    background-color: white;
    border: 2px solid #bae6fd;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    outline: none;
    transition: all 0.2s ease;
}

.form-checkbox:hover {
    border-color: var(--primary-color);
}

.form-checkbox:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.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: #bae6fd #f0f9ff;
}

#apiCheckboxes::-webkit-scrollbar {
    width: 6px;
}

#apiCheckboxes::-webkit-scrollbar-track {
    background: #f0f9ff;
    border-radius: 4px;
}

#apiCheckboxes::-webkit-scrollbar-thumb {
    background-color: #bae6fd;
    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.5rem;
    margin-bottom: 0.25rem;
    background-color: #f0f9ff;
    border-radius: 8px;
    border: 1px solid #e0f2fe;
    transition: all 0.2s ease;
}

#customApisList .api-item:hover {
    background-color: #e0f2fe;
    border-color: #bae6fd;
}

/* 历史记录面板样式 - 浅色主题 */
.history-panel {
    box-shadow: -4px 0 20px rgba(14, 165, 233, 0.1);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;
}

.history-panel.show {
    transform: translateX(0);
}

/* 历史记录项样式 */
.history-item {
    background: white;
    border-radius: 12px;
    border: 1px solid #e0f2fe;
    overflow: hidden;
    transition: all 0.2s ease;
    padding: 12px;
    position: relative;
    margin-bottom: 10px;
    cursor: pointer;
}

.history-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px var(--card-shadow);
}

.history-item .delete-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-item:hover .delete-btn {
    opacity: 1;
}

.history-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
}

.history-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.history-episode {
    color: var(--primary-color);
}

.history-source {
    color: #10b981;
}

.history-time {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* 添加播放进度条样式 */
.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;
}

/* 搜索结果网格布局已移至 index.html 的 Tailwind 类中，与首页保持一致 */

/* 优化卡片内元素间距 */
.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, #f0f9ff, #e0f2fe);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.1);
}

#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;
    padding: 0.5rem 0;
    border-bottom: 1px dashed rgba(14, 165, 233, 0.15);
}

#modal .detail-item:last-child {
    border-bottom: none;
}

#modal .detail-label {
    color: #0ea5e9;
    font-weight: 600;
    min-width: 3rem;
    flex-shrink: 0;
}

#modal .detail-value {
    color: #374151;
    flex: 1;
    word-break: break-word;
}

#modal .detail-desc {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(14, 165, 233, 0.2);
}

#modal .detail-desc-label {
    color: #0ea5e9;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#modal .detail-desc-content {
    color: #4b5563;
    font-size: 0.875rem;
    line-height: 1.7;
    max-height: 8rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #bae6fd #f0f9ff;
}

#modal .detail-desc-content::-webkit-scrollbar {
    width: 6px;
}

#modal .detail-desc-content::-webkit-scrollbar-track {
    background: #f0f9ff;
    border-radius: 4px;
}

#modal .detail-desc-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #0ea5e9, #06b6d4);
    border-radius: 4px;
}

/* 集数区域样式 */
#modal .episodes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 0.75rem;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

#modal .episodes-header .episode-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#modal .episodes-header .episode-toggle-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

#modal .episodes-header .episode-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

#modal .episodes-header .episode-count {
    padding: 0.375rem 0.75rem;
    background: white;
    color: #0ea5e9;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

#modal .episodes-header .copy-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

#modal .episodes-header .copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

/* 集数按钮样式 */
#modal .episode-btn {
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    color: #0369a1;
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

#modal .episode-btn:hover {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* 移动端优化 */
@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;
    }

    #modal .episodes-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}
