/* 红大爷影视 - 自定义样式 */

/* 基础样式重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

::-webkit-scrollbar-track {
    background: #1f2937;
}

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

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

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

/* 字体优化 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 焦点样式 */
*:focus {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

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

/* 淡入动画类 */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

/* 导航栏增强 */
header nav {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 按钮悬停效果增强 */
button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

button:active {
    transform: translateY(0);
}

/* 卡片阴影增强 */
.group:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* 渐变文字效果 */
.gradient-text {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 加载状态 */
.loading {
    position: relative;
    color: transparent;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ef4444;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 响应式图片 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 视频容器 */
.video-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.video-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.1) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    z-index: 1;
}

.video-container:hover::before {
    transform: translateX(100%);
}

/* 搜索框增强 */
input[type="search"] {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

input[type="search"]:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    transform: scale(1.02);
}

/* 移动端菜单动画 */
#mobile-menu {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#mobile-menu > div {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

#mobile-menu:not(.hidden) > div {
    transform: translateX(0);
}

/* 分类卡片特效 */
.category-card {
    background: linear-gradient(135deg, var(--from-color), var(--to-color));
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* 文字选择样式 */
::selection {
    background: #ef4444;
    color: white;
}

::-moz-selection {
    background: #ef4444;
    color: white;
}

/* 无障碍改进 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 打印样式 */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    header, footer, #mobile-menu {
        display: none !important;
    }
    
    main {
        padding: 0 !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    body {
        background: black;
        color: white;
    }
    
    .bg-gray-800 {
        background: #333 !important;
    }
    
    .bg-gray-900 {
        background: black !important;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 响应式断点优化 */
@media (max-width: 640px) {
    /* 小屏幕优化 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .text-4xl {
        font-size: 2rem !important;
    }
    
    .text-6xl {
        font-size: 2.5rem !important;
    }
}

@media (min-width: 641px) and (max-width: 768px) {
    /* 平板优化 */
    .grid-cols-2 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1024px) {
    /* 大屏幕优化 */
    .container {
        max-width: 1200px;
    }
}

/* 性能优化 */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    /* 默认已经是暗色主题，这里可以做进一步优化 */
    body {
        background: #0f0f0f;
    }
}

/* Hover 设备支持 */
@media (hover: hover) {
    .hover-only:hover {
        transform: scale(1.05);
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    button,
    .cursor-pointer {
        padding: 0.75rem;
        min-height: 44px;
        min-width: 44px;
    }
}

/* 自定义属性（CSS变量）*/
:root {
    --primary-red: #ef4444;
    --primary-red-dark: #dc2626;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --transition-standard: all 0.3s ease;
}

/* 工具类 */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.backdrop-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.safe-area-padding {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}