/* ==================== 全局变量 ==================== */
:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --bg-dark: #0f0f1a;
    --bg-card: rgba(20, 20, 35, 0.8);
    --bg-overlay: rgba(0, 0, 0, 0.6);
    --primary-color: #667eea;
    --danger-color: #f56565;
    --success-color: #48bb78;
}

/* ==================== 重置样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-dark);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==================== 滚动条隐藏 ==================== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.scroll-hidden::-webkit-scrollbar {
    display: none;
}

.scroll-hidden {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ==================== 液态玻璃效果 ==================== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.glass-card:active {
    transform: scale(0.98);
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

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

.animate-fade {
    animation: fadeIn 0.3s ease-out forwards;
}

/* ==================== 加载动画 ==================== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

.spin {
    animation: spin 0.5s linear infinite;
    display: inline-block;
}

/* ==================== 按钮样式 ==================== */
.btn-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    color: white;
    padding: 8px 20px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-glass:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.2);
}

.btn-glass-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-glass-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
}

.btn-glass-danger {
    background: linear-gradient(135deg, #f56565, #ed64a6);
    border: none;
}

/* ==================== 底部菜单 ==================== */
.bottom-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 26, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
}

.bottom-menu .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -4px;
}

.bottom-menu .col-3 {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 0 4px;
}

.menu-item {
    text-align: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    cursor: pointer;
    border-radius: 12px;
}

.menu-item i {
    font-size: 22px;
}

.menu-item span {
    font-size: 11px;
    font-weight: 500;
}

.menu-item.active {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.menu-item:active {
    transform: scale(0.95);
}

/* ==================== 主内容区域 ==================== */
.main-content {
    padding-bottom: 70px;
    min-height: 100vh;
}

/* ==================== 下拉刷新 ==================== */
.pull-to-refresh {
    text-align: center;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    transition: all 0.2s ease;
}

.pull-to-refresh i {
    font-size: 14px;
    margin-right: 4px;
}

/* ==================== 置顶按钮 ==================== */
.go-top {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(102, 126, 234, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.go-top.show {
    opacity: 1;
    visibility: visible;
}

.go-top:active {
    transform: scale(0.9);
}

.go-top i {
    font-size: 20px;
}

/* ==================== 视频卡片 ==================== */
.vod-card {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
    display: block;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.vod-card:active {
    transform: scale(0.97);
}

.vod-card img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.vod-card:active img {
    transform: scale(1.05);
}

.vod-card .info {
    padding: 8px;
}

.vod-card .title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    line-height: 1.4;
}

.vod-card .remark {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ==================== 搜索框 ==================== */
.search-container {
    position: relative;
    flex: 1;
}

.search-box {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box i {
    font-size: 16px;
    color: var(--text-secondary);
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    font-size: 14px;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-hot {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 35, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    margin-top: 8px;
    padding: 12px;
    z-index: 100;
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.search-hot.show {
    display: block;
    animation: fadeInUp 0.2s ease;
}

.hot-tag {
    display: inline-block;
    background: rgba(102, 126, 234, 0.2);
    padding: 6px 14px;
    border-radius: 25px;
    margin: 4px;
    font-size: 12px;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hot-tag:active {
    transform: scale(0.95);
    background: rgba(102, 126, 234, 0.4);
}

/* ==================== 轮播图 ==================== */
.carousel-item img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.carousel-caption {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 16px;
    text-align: left;
}

.carousel-caption h5 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.carousel-caption p {
    font-size: 12px;
    margin-bottom: 0;
    opacity: 0.8;
}

.carousel-control-prev,
.carousel-control-next {
    width: 40px;
    opacity: 0.7;
}

/* ==================== 播放器容器 ==================== */
.player-container {
    position: relative;
    background: #000;
    width: 100%;
}

.player-container iframe,
.player-container video {
    width: 100%;
    height: 100%;
    border: none;
}

/* ==================== 播放器菜单 ==================== */
.player-menu {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 12px 16px;
    display: flex;
    justify-content: space-around;
    z-index: 10;
}

.player-menu .menu-btn {
    color: white;
    text-align: center;
    font-size: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.player-menu .menu-btn:active {
    transform: scale(0.9);
    opacity: 1;
}

.player-menu .menu-btn i {
    font-size: 20px;
    display: block;
    margin-bottom: 4px;
}

.player-menu .menu-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ==================== 集数区域 ==================== */
.episodes-container {
    max-height: 200px;
    overflow-y: auto;
}

.episode-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
    font-size: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    color: var(--text-primary);
    width: 100%;
}

.episode-btn:active {
    transform: scale(0.96);
}

.episode-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
}

/* ==================== 详情弹窗 ==================== */
.detail-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 26, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px 24px 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    z-index: 1001;
    max-height: 70vh;
    overflow-y: auto;
}

.detail-modal.show {
    transform: translateY(0);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    z-index: 1000;
    display: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* ==================== 筛选按钮 ==================== */
.filter-btn,
.sort-btn {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 25px;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:active,
.sort-btn:active {
    transform: scale(0.95);
}

.filter-btn.active,
.sort-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* ==================== 标签页样式 ==================== */
.nav-tabs {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    background: transparent;
    border: none;
    padding: 10px 0;
    margin-right: 24px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background: transparent;
    border-bottom: 2px solid var(--primary-color);
}

.nav-tabs .nav-link:active {
    transform: scale(0.96);
}

/* ==================== 表单样式 ==================== */
.form-control {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: white !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2) !important;
}

.form-label {
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

/* ==================== 分页样式 ==================== */
.page_info .btn-glass {
    padding: 5px 12px;
    font-size: 12px;
}

.page_info .btn-glass.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    pointer-events: none;
}

/* ==================== 用户中心卡片 ==================== */
.user-card {
    transition: all 0.2s ease;
}

.user-card:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.05);
}

/* ==================== 信息条目 ==================== */
.info-item {
    transition: all 0.2s ease;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.info-item:last-child {
    border-bottom: none;
}

.info-item:active {
    background: rgba(255, 255, 255, 0.03);
}

/* ==================== 删除按钮 ==================== */
.delete-selected {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    animation: slideInUp 0.3s ease;
}

.delete-selected button {
    width: 100%;
    padding: 12px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
}

/* ==================== 选择删除模式 ==================== */
.edit-mode .select-checkbox {
    display: flex !important;
}

.select-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.select-checkbox i {
    font-size: 14px;
    color: white;
    opacity: 0;
}

.select-checkbox.selected {
    background: var(--primary-color);
    border-color: transparent;
}

.select-checkbox.selected i {
    opacity: 1;
}

/* ==================== 二维码容器 ==================== */
#qrcode {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

#qrcode img {
    margin: 0 auto;
    border-radius: 12px;
    background: white;
    padding: 8px;
}

/* ==================== 工具类 ==================== */
.text-secondary {
    color: var(--text-secondary) !important;
}

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

.bg-transparent {
    background: transparent !important;
}

.cursor-pointer {
    cursor: pointer;
}

.overflow-hidden {
    overflow: hidden;
}

.position-relative {
    position: relative;
}

.position-absolute {
    position: absolute;
}

.position-sticky {
    position: sticky;
}

.top-0 {
    top: 0;
}

.bottom-0 {
    bottom: 0;
}

.start-0 {
    left: 0;
}

.end-0 {
    right: 0;
}

.z-index-10 {
    z-index: 10;
}

.z-index-100 {
    z-index: 100;
}

.rounded-circle {
    border-radius: 50%;
}

.rounded-3 {
    border-radius: 16px;
}

.rounded-4 {
    border-radius: 20px;
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .carousel-caption h5 {
        font-size: 14px;
    }
    
    .carousel-caption p {
        font-size: 11px;
    }
    
    .player-menu .menu-btn {
        font-size: 9px;
    }
    
    .player-menu .menu-btn i {
        font-size: 18px;
    }
    
    .episode-btn {
        font-size: 11px;
        padding: 6px 3px;
    }
    
    .vod-card .title {
        font-size: 12px;
    }
    
    .vod-card .remark {
        font-size: 10px;
    }
    
    .menu-item i {
        font-size: 20px;
    }
    
    .menu-item span {
        font-size: 10px;
    }
    
    .btn-glass {
        padding: 6px 16px;
        font-size: 13px;
    }
    
    .filter-btn,
    .sort-btn {
        padding: 5px 12px;
        font-size: 11px;
    }
}

/* ==================== 安全区域适配 ==================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-menu {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    
    .main-content {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
    
    .go-top {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

/* ==================== 黑暗模式优化 ==================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-dark: #0a0a12;
        --bg-card: rgba(15, 15, 25, 0.85);
    }
}

/* ==================== 动画优化 ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-up {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ==================== 卡片悬停效果 (仅支持触摸设备) ==================== */
@media (hover: hover) {
    .vod-card:hover {
        transform: translateY(-2px);
    }
    
    .vod-card:hover img {
        transform: scale(1.05);
    }
}

/* ==================== 加载骨架屏 ==================== */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 轮播图样式 */
.carousel {
    position: relative;
}

.carousel-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.carousel-item {
    position: relative;
    display: none;
    float: left;
    width: 100%;
    margin-right: -100%;
    backface-visibility: hidden;
    transition: transform .6s ease-in-out;
}

.carousel-item.active,
.carousel-item-next,
.carousel-item-prev {
    display: block;
}

.carousel-item img {
    width: 100%;
    height: auto;
    min-height: 200px;
}

.carousel-caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 20px 16px;
    color: #fff;
    text-align: left;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.carousel-control-prev,
.carousel-control-next {
    width: 10%;
    opacity: 0.5;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 0.8;
}