/* 移动端响应式样式 */

/* 基础响应式断点 */
@media (max-width: 768px) {
    /* 头部样式 */
    .header {
        padding: 10px 15px;
    }
    
    .header .container {
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    /* 导航栏样式 */
    .nav {
        gap: 1rem;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .nav a {
        padding: 0.3rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        flex-direction: column;
        padding: 0;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        border-bottom: 1px solid #f0f0f0;
    }
    
    .nav-menu a {
        padding: 15px 20px;
        display: block;
    }
    
    .mobile-menu-btn {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: #333;
    }
    
    .user-menu {
        position: relative;
    }
    
    .user-dropdown {
        position: absolute;
        top: 100%;
        right: 0;
        min-width: 150px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
        padding: 10px 0;
        z-index: 1000;
    }
    
    /* 轮播图 */
    .hero-slider {
        height: 200px;
    }
    
    .slide {
        height: 200px;
    }
    
    .slide-content {
        padding: 20px;
    }
    
    .slide-title {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .slide-description {
        font-size: 0.9rem;
    }
    
    /* 区域标题样式 */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .section-header .section-title {
        font-size: 1.5rem;
    }
    
    .more-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .slide-description {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    /* 短剧网格 */
    .drama-grid,
    .dramas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 15px;
    }
    
    .drama-card {
        border-radius: 8px;
    }
    
    .drama-poster {
        height: 280px;
        border-radius: 8px 8px 0 0;
    }
    
    .drama-info {
        padding: 12px;
    }
    
    .drama-title {
        font-size: 0.9rem;
        margin-bottom: 6px;
        line-height: 1.3;
        height: 2.6em;
    }
    
    .drama-description {
        font-size: 0.8rem;
        line-height: 1.4;
        height: 2.8em;
        margin-bottom: 8px;
    }
    
    .drama-meta {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    
    .drama-price {
        font-size: 0.9rem;
    }
    
    /* 播放按钮 */
    .play-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* 价格标签 */
    .price-tag {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    /* 分类标签 */
    .category-tag {
        padding: 2px 6px;
        font-size: 0.7rem;
    }
    
    /* 底部 */
    .footer {
        padding: 30px 15px 20px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .footer-section {
        margin-bottom: 20px;
    }
    
    .footer-title {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 8px;
    }
    
    /* 支付弹窗 */
    .payment-modal {
        padding: 20px;
    }
    
    .payment-content {
        width: 95%;
        max-width: 400px;
        margin: 20px auto;
        padding: 20px;
    }
    
    .payment-header {
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
    
    .payment-title {
        font-size: 1.2rem;
    }
    
    .drama-info-payment {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .drama-title-payment {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .drama-price-payment {
        font-size: 1.1rem;
    }
    
    .payment-methods {
        gap: 10px;
    }
    
    .payment-method {
        padding: 12px;
        border-radius: 8px;
    }
    
    .payment-method-icon {
        width: 30px;
        height: 30px;
        font-size: 1.2rem;
    }
    
    .payment-method-name {
        font-size: 0.9rem;
    }
    
    .payment-actions {
        gap: 10px;
        margin-top: 20px;
    }
    
    .payment-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    /* 微信支付二维码 */
    .wechat-qr {
        padding: 20px;
    }
    
    .qr-code {
        width: 200px;
        height: 200px;
        margin: 0 auto 15px;
    }
    
    .qr-tips {
        font-size: 0.9rem;
    }
    
    /* 消息提示 */
    .message {
        padding: 12px 20px;
        font-size: 0.9rem;
        border-radius: 6px;
        margin: 10px 15px;
    }
    
    /* 加载动画 */
    .loading {
        padding: 40px 20px;
    }
    
    .loading-spinner {
        width: 30px;
        height: 30px;
        margin-bottom: 10px;
    }
    
    .loading-text {
        font-size: 0.9rem;
    }
    
    /* 用户信息 */
    .user-info {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 5px;
        padding: 8px 12px;
        font-size: 0.85rem;
        background: rgba(255,255,255,0.1);
        border-radius: 8px;
        min-width: 120px;
    }
    
    .user-info span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
    }
    
    .user-info a {
        padding: 2px 8px !important;
        font-size: 0.8rem !important;
        background: rgba(255,255,255,0.2);
        border-radius: 12px;
        text-decoration: none;
    }
    
    .user-avatar {
        width: 24px;
        height: 24px;
    }
    
    .user-balance {
        font-size: 0.8rem;
    }
    
    /* 修复主页面用户名显示 */
    .user-name {
        font-size: 0.85rem !important;
        padding: 6px 10px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
        background: rgba(255,255,255,0.2) !important;
        color: white !important;
    }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
    /* 头部进一步优化 */
    .header .container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .nav {
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .nav a:not(.user-name) {
        padding: 0.25rem 0.6rem;
        font-size: 0.85rem;
        flex: 1;
        text-align: center;
    }
    
    .nav .user-name {
        flex: 0 0 auto;
        margin-left: auto;
    }
    
    .user-info {
        align-self: center;
        min-width: auto;
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 5px;
    }
    
    .user-info span {
        max-width: 150px;
        font-size: 0.8rem;
    }
    
    /* 修复主页面用户名显示 */
    .user-name {
        font-size: 0.8rem !important;
        padding: 4px 8px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
        background: rgba(255,255,255,0.2) !important;
        color: white !important;
    }
    
    /* 更小的网格 */
    .drama-grid,
    .dramas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 10px;
    }
    
    .drama-card {
        border-radius: 6px;
    }
    
    .drama-poster {
        height: 260px;
        border-radius: 6px 6px 0 0;
    }
    
    .drama-info {
        padding: 10px;
    }
    
    .drama-title {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }
    
    .drama-description {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }
    
    .drama-meta {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }
    
    .drama-price {
        font-size: 0.85rem;
    }
    
    /* 播放按钮 */
    .play-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    /* 价格标签 */
    .price-tag {
        padding: 3px 6px;
        font-size: 0.65rem;
    }
    
    /* 轮播图 */
    .hero-slider {
        height: 180px;
    }
    
    .slide {
        height: 180px;
    }
    
    .slide-content {
        padding: 15px;
    }
    
    .slide-title {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }
    
    .slide-description {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    /* 支付弹窗 */
    .payment-content {
        width: 98%;
        margin: 10px auto;
        padding: 15px;
    }
    
    .payment-title {
        font-size: 1.1rem;
    }
    
    .drama-info-payment {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .payment-method {
        padding: 10px;
    }
    
    .payment-method-icon {
        width: 25px;
        height: 25px;
        font-size: 1rem;
    }
    
    .payment-method-name {
        font-size: 0.85rem;
    }
    
    .payment-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    /* 微信二维码 */
    .qr-code {
        width: 180px;
        height: 180px;
    }
    
    .qr-tips {
        font-size: 0.85rem;
    }
}

/* 横屏适配 */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-slider {
        height: 150px;
    }
    
    .slide {
        height: 150px;
    }
    
    .slide-content {
        padding: 15px;
    }
    
    .drama-grid,
    .dramas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .drama-poster {
        height: 140px;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .drama-card {
        transition: transform 0.2s ease;
    }
    
    .drama-card:active {
        transform: scale(0.98);
    }
    
    .play-btn:active {
        transform: scale(0.95);
    }
    
    .payment-method:active {
        transform: scale(0.98);
    }
    
    .payment-btn:active {
        transform: scale(0.98);
    }
    
    /* 增大点击区域 */
    .nav-menu a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .user-menu button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .mobile-menu-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .drama-poster {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .user-avatar {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .drama-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .drama-title {
        color: #f7fafc;
    }
    
    .drama-description {
        color: #a0aec0;
    }
    
    .drama-meta {
        color: #718096;
    }
    
    .payment-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .payment-method {
        background: #4a5568;
        border-color: #718096;
    }
    
    .payment-method.selected {
        background: #3182ce;
        border-color: #3182ce;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .drama-card,
    .play-btn,
    .payment-method,
    .payment-btn {
        transition: none;
    }
    
    .hero-slider {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* 打印样式 */
@media print {
    .header,
    .footer,
    .payment-modal,
    .play-btn {
        display: none;
    }
    
    .drama-grid,
    .dramas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .drama-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
    
    .drama-poster {
        height: 200px;
    }
}