/**
 * VideoModeSwitcher.css
 * 视频浏览模式切换器样式
 * 支持浅色/深色模式自动切换
 * 通过 html[dark="true"] 属性判断主题
 */

/* ==================== CSS 变量定义 ==================== */

:root {
    /* 浅色模式变量 (默认) */
    --vms-overlay-bg: rgba(0, 0, 0, 0.4);
    --vms-card-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.98));
    --vms-card-border: rgba(0, 0, 0, 0.08);
    --vms-card-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    
    --vms-text-primary: #1a1a2e;
    --vms-text-secondary: rgba(0, 0, 0, 0.6);
    --vms-text-muted: rgba(0, 0, 0, 0.45);
    
    --vms-mode-card-bg: rgba(0, 0, 0, 0.03);
    --vms-mode-card-border: rgba(0, 0, 0, 0.08);
    --vms-mode-card-hover-bg: rgba(0, 0, 0, 0.06);
    --vms-mode-card-hover-border: rgba(0, 0, 0, 0.12);
    --vms-mode-card-selected-bg: rgba(102, 126, 234, 0.1);
    --vms-mode-card-selected-border: #667eea;
    --vms-mode-card-selected-shadow: 0 0 30px rgba(102, 126, 234, 0.2);
    
    --vms-canvas-bg: rgba(0, 0, 0, 0.05);
    --vms-feature-tag-bg: rgba(0, 0, 0, 0.06);
    --vms-feature-tag-text: rgba(0, 0, 0, 0.7);
    
    --vms-close-btn-bg: rgba(0, 0, 0, 0.05);
    --vms-close-btn-hover-bg: rgba(0, 0, 0, 0.1);
    --vms-close-btn-color: #333;
    
    --vms-indicator-border: rgba(0, 0, 0, 0.2);
    
    --vms-scrollbar-track: rgba(0, 0, 0, 0.05);
    --vms-scrollbar-thumb: rgba(0, 0, 0, 0.15);
    --vms-scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);
    
    --vms-toast-bg: rgba(30, 30, 30, 0.95);
    --vms-toast-text: #fff;
    
    /* 通用渐变色 */
    --vms-primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --vms-recommend-gradient: linear-gradient(135deg, #f093fb, #f5576c);
    --vms-normal-icon-gradient: linear-gradient(135deg, #4facfe, #00f2fe);
    --vms-immersive-icon-gradient: linear-gradient(135deg, #f093fb, #f5576c);
}

/* 深色模式变量 */
html[dark="true"] {
    --vms-overlay-bg: rgba(0, 0, 0, 0.7);
    --vms-card-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    --vms-card-border: rgba(255, 255, 255, 0.15);
    --vms-card-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    
    --vms-text-primary: #ffffff;
    --vms-text-secondary: rgba(255, 255, 255, 0.7);
    --vms-text-muted: rgba(255, 255, 255, 0.5);
    
    --vms-mode-card-bg: rgba(255, 255, 255, 0.05);
    --vms-mode-card-border: rgba(255, 255, 255, 0.1);
    --vms-mode-card-hover-bg: rgba(255, 255, 255, 0.08);
    --vms-mode-card-hover-border: rgba(255, 255, 255, 0.2);
    --vms-mode-card-selected-bg: rgba(102, 126, 234, 0.15);
    --vms-mode-card-selected-border: #667eea;
    --vms-mode-card-selected-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
    
    --vms-canvas-bg: rgba(0, 0, 0, 0.3);
    --vms-feature-tag-bg: rgba(255, 255, 255, 0.1);
    --vms-feature-tag-text: rgba(255, 255, 255, 0.8);
    
    --vms-close-btn-bg: rgba(255, 255, 255, 0.1);
    --vms-close-btn-hover-bg: rgba(255, 255, 255, 0.2);
    --vms-close-btn-color: #fff;
    
    --vms-indicator-border: rgba(255, 255, 255, 0.3);
    
    --vms-scrollbar-track: rgba(255, 255, 255, 0.05);
    --vms-scrollbar-thumb: rgba(255, 255, 255, 0.2);
    --vms-scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
    
    --vms-toast-bg: rgba(0, 0, 0, 0.9);
    --vms-toast-text: #fff;
}

/* ==================== 模态层遮罩 ==================== */

.vms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--vms-overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.vms-modal-overlay.vms-active {
    opacity: 1;
    visibility: visible;
}

/* ==================== 模态层卡片 ==================== */

.vms-modal-card {
    background: var(--vms-card-bg);
    border: 1px solid var(--vms-card-border);
    border-radius: 24px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--vms-card-shadow);
    position: relative;
    box-sizing: border-box;
}

.vms-modal-overlay.vms-active .vms-modal-card {
    transform: scale(1) translateY(0);
}

/* ==================== 模态层头部 ==================== */

.vms-modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.vms-modal-header h2 {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    margin: 0 0 10px 0;
    color: var(--vms-text-primary);
    font-weight: 700;
}

.vms-modal-header p {
    color: var(--vms-text-secondary);
    font-size: 14px;
    margin: 0;
}

/* ==================== 关闭按钮 ==================== */

.vms-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--vms-close-btn-bg);
    border: none;
    color: var(--vms-close-btn-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.vms-close-btn:hover {
    background: var(--vms-close-btn-hover-bg);
    transform: rotate(90deg);
}

.vms-close-btn svg {
    width: 20px;
    height: 20px;
}

/* ==================== 模式选择容器 ==================== */

.vms-modes-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

/* ==================== 模式卡片 ==================== */

.vms-mode-card {
    background: var(--vms-mode-card-bg);
    border: 2px solid var(--vms-mode-card-border);
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.vms-mode-card:hover {
    background: var(--vms-mode-card-hover-bg);
    border-color: var(--vms-mode-card-hover-border);
}

.vms-mode-card.vms-selected {
    border-color: var(--vms-mode-card-selected-border);
    background: var(--vms-mode-card-selected-bg);
    box-shadow: var(--vms-mode-card-selected-shadow);
}

/* 推荐标签 */
.vms-mode-card.vms-recommended::before {
    content: '推荐';
    position: absolute;
    top: 15px;
    right: -30px;
    background: var(--vms-recommend-gradient);
    color: #fff;
    padding: 5px 40px;
    font-size: 12px;
    font-weight: 600;
    transform: rotate(45deg);
    z-index: 1;
}

/* ==================== 选中指示器 ==================== */

.vms-select-indicator {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--vms-indicator-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.vms-mode-card.vms-selected .vms-select-indicator {
    background: var(--vms-primary-gradient);
    border-color: transparent;
}

.vms-select-indicator svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    color: #fff;
}

.vms-mode-card.vms-selected .vms-select-indicator svg {
    opacity: 1;
    transform: scale(1);
}

/* ==================== 模式卡片头部 ==================== */

.vms-mode-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.vms-mode-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.vms-mode-card[data-mode="normal"] .vms-mode-icon {
    background: var(--vms-normal-icon-gradient);
}

.vms-mode-card[data-mode="immersive"] .vms-mode-icon {
    background: var(--vms-immersive-icon-gradient);
}

.vms-mode-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--vms-text-primary);
}

/* ==================== Canvas 容器 ==================== */

.vms-canvas-container {
    background: var(--vms-canvas-bg);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 15px;
    aspect-ratio: 16/10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vms-canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==================== 模式描述 ==================== */

.vms-mode-description {
    color: var(--vms-text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* ==================== 功能标签 ==================== */

.vms-mode-features {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vms-feature-tag {
    background: var(--vms-feature-tag-bg);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    color: var(--vms-feature-tag-text);
}

/* ==================== 确认按钮 ==================== */

.vms-confirm-btn {
    width: 100%;
    padding: 16px;
    background: var(--vms-primary-gradient);
    border: none;
    border-radius: 16px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.vms-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.vms-confirm-btn:active {
    transform: translateY(0);
}

.vms-confirm-btn svg {
    width: 20px;
    height: 20px;
}

/* ==================== 底部切换按钮 ==================== */

.vms-toggle-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--vms-primary-gradient);
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
}

.vms-toggle-btn:hover {
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.6);
}

.vms-toggle-btn:active {
    transform: translateX(-50%) translateY(-1px);
}

.vms-toggle-btn svg {
    width: 24px;
    height: 24px;
}

/* ==================== Toast 提示 ==================== */

.vms-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--vms-toast-bg);
    color: var(--vms-toast-text);
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 20000;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.vms-toast.vms-show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.vms-toast svg {
    width: 20px;
    height: 20px;
    color: #4ade80;
    flex-shrink: 0;
}

/* ==================== 滚动条美化 ==================== */

.vms-modal-card::-webkit-scrollbar {
    width: 6px;
}

.vms-modal-card::-webkit-scrollbar-track {
    background: var(--vms-scrollbar-track);
    border-radius: 3px;
}

.vms-modal-card::-webkit-scrollbar-thumb {
    background: var(--vms-scrollbar-thumb);
    border-radius: 3px;
}

.vms-modal-card::-webkit-scrollbar-thumb:hover {
    background: var(--vms-scrollbar-thumb-hover);
}

/* ==================== 响应式布局 - 平板适配 ==================== */

@media (max-width: 768px) {
    .vms-modes-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .vms-modal-card {
        padding: 24px;
        max-height: 90vh;
    }
}

/* ==================== 响应式布局 - 移动端适配 ==================== */

@media (max-width: 650px) {
    .vms-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    
    .vms-modal-card {
        padding: 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 20px));
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        margin-bottom: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .vms-modal-overlay.vms-active .vms-modal-card {
        transform: scale(1) translateY(0);
    }
    
    .vms-modal-card:not(.vms-active) {
        transform: scale(1) translateY(100%);
    }
    
    .vms-modal-header {
        margin-bottom: 16px;
    }
    
    .vms-modal-header h2 {
        font-size: 1.15rem;
    }
    
    .vms-modal-header p {
        font-size: 13px;
    }
    
    .vms-modes-container {
        gap: 10px;
        margin-bottom: 16px;
    }
    
    .vms-mode-card {
        padding: 14px;
        border-radius: 16px;
    }
    
    /* 推荐标签优化 */
    .vms-mode-card.vms-recommended::before {
        top: 12px;
        right: -32px;
        padding: 4px 40px;
        font-size: 10px;
    }
    
    .vms-select-indicator {
        width: 20px;
        height: 20px;
        top: 12px;
        left: 12px;
    }
    
    .vms-select-indicator svg {
        width: 12px;
        height: 12px;
    }
    
    .vms-mode-card-header {
        margin-bottom: 10px;
        gap: 10px;
    }
    
    .vms-mode-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 16px;
    }
    
    .vms-mode-card-header h3 {
        font-size: 14px;
    }
    
    .vms-canvas-container {
        aspect-ratio: 16/9;
        margin-bottom: 10px;
        border-radius: 12px;
    }
    
    .vms-mode-description {
        font-size: 12px;
        line-height: 1.4;
        color: var(--vms-text-muted);
    }
    
    .vms-mode-features {
        margin-top: 10px;
        gap: 6px;
    }
    
    .vms-feature-tag {
        font-size: 10px;
        padding: 4px 10px;
        border-radius: 12px;
    }
    
    .vms-confirm-btn {
        padding: 14px;
        font-size: 15px;
        border-radius: 14px;
    }
    
    .vms-close-btn {
        width: 32px;
        height: 32px;
        top: 16px;
        right: 16px;
    }
    
    .vms-close-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ==================== 响应式布局 - 小屏手机适配 ==================== */

@media (max-width: 380px) {
    .vms-modal-card {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 16px));
    }
    
    .vms-modal-header {
        margin-bottom: 12px;
    }
    
    .vms-modal-header h2 {
        font-size: 1.05rem;
    }
    
    .vms-modal-header p {
        font-size: 12px;
    }
    
    .vms-modes-container {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .vms-mode-card {
        padding: 12px;
        border-radius: 14px;
    }
    
    .vms-mode-card.vms-recommended::before {
        font-size: 9px;
        padding: 3px 36px;
    }
    
    .vms-mode-icon {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .vms-mode-card-header h3 {
        font-size: 13px;
    }
    
    .vms-canvas-container {
        aspect-ratio: 3/2;
        border-radius: 10px;
    }
    
    .vms-mode-description {
        font-size: 11px;
    }
    
    .vms-feature-tag {
        font-size: 9px;
        padding: 3px 8px;
    }
    
    .vms-confirm-btn {
        padding: 12px;
        font-size: 14px;
        border-radius: 12px;
    }
}

/* ==================== 底部按钮响应式 ==================== */

@media (max-width: 480px) {
    .vms-toggle-btn {
        padding: 12px 20px;
        font-size: 14px;
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        border-radius: 40px;
    }
    
    .vms-toggle-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .vms-toast {
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        padding: 12px 20px;
        font-size: 13px;
        max-width: calc(100% - 40px);
    }
}

/* ==================== 横屏模式适配 ==================== */

@media (max-height: 500px) and (orientation: landscape) {
    .vms-modal-overlay {
        padding: 10px;
        align-items: center;
    }
    
    .vms-modal-card {
        max-height: 95vh;
        border-radius: 16px;
        padding: 16px;
    }
    
    .vms-modes-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .vms-modal-header {
        margin-bottom: 12px;
    }
    
    .vms-modal-header h2 {
        font-size: 1.1rem;
    }
    
    .vms-canvas-container {
        aspect-ratio: 16/9;
    }
    
    .vms-mode-description {
        display: none;
    }
    
    .vms-mode-features {
        margin-top: 8px;
    }
}

/* ==================== 动画关键帧 ==================== */

@keyframes vms-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes vms-slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes vms-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}