/* 基础样式重置与全局设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 62.5%;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    scroll-behavior: smooth;
}

body {
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    font-size: 1.4rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #d14444 0%, #f16565 100%);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.8;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

/* 导航菜单样式 */
.nav-container {
    display: flex;
    align-items: center;
    padding: 0.8rem 0;
}

.logo-container {
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
}

.logo-container img {
    height: 36px;
    margin-right: 0;
    transition: transform 0.3s ease;
}

.logo-container img:hover {
    transform: scale(1.05);
}

.main-nav {
    display: flex;
    gap: 1.5rem;
    margin-left: 0.5rem;
}

.main-nav a {
    color: white;
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 500;
    padding: 0.6rem 0;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #ce93d8;
    transition: width 0.3s ease;
}

.main-nav a:hover {
    color: #e1bee7;
}

.main-nav a:hover::after {
    width: 100%;
}

.main-nav a.active {
    color: #e1bee7;
}

.main-nav a.active::after {
    width: 100%;
}

/* 标题样式 */
.header-title {
    text-align: center;
    padding: 0.6rem 0 1.5rem;
}

.header-title h1 {
    color: white;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 主容器样式 */
.container {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 3rem auto;
    padding: 0 2rem;
}

/* 输入区域样式 */
.input-section {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    margin-bottom: 2.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.input-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #6a1b9a, #8e24aa, #ba68c8);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.input-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

.input-section:hover::before {
    transform: scaleX(1);
}

/* 输入框和按钮容器优化 */
.input-container {
    display: flex;
    gap: 1rem;
    width: 100%;
    align-items: center;
    margin-bottom: 1.5rem;
}

#url {
    flex: 1;
    padding: 1.6rem 1.8rem;
    font-size: 1.6rem;
    border: 1px solid #e1e5eb;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: #fafafa;
    min-width: 0;
}

#url:focus {
    border-color: #8e24aa;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.15);
    outline: none;
    background-color: white;
}

/* 播放按钮优化 */
#doplayers {
    background: linear-gradient(135deg, #f16565 0%, #ff7979 100%);
    color: white;
    border: none;
    padding: 1.6rem 2.2rem;
    border-radius: 8px;
    font-size: 1.6rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    box-shadow: 0 4px 15px rgba(241, 101, 101, 0.3);
    white-space: nowrap;
    min-width: 130px;
    flex-shrink: 0;
    height: auto;
}

#doplayers:hover {
    background: linear-gradient(135deg, #d14444 0%, #e55555 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(241, 101, 101, 0.4);
}

#doplayers:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(241, 101, 101, 0.3);
}

/* 示例视频链接样式 */
.example-link {
    display: inline-block;
    color: #f16565;
    text-decoration: none;
    font-size: 1.4rem;
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    border: 1px solid #ffcccc;
    background-color: #fff5f5;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-left: 1rem;
}

.example-link:hover {
    background-color: #ffcccc;
    color: #d14444;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(241, 101, 101, 0.2);
}

/* 播放器区域样式 */
.player-section {
    background: #121212;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    position: relative;
    aspect-ratio: 16 / 9;
    min-height: 300px;
    transition: all 0.3s ease;
}

.player-section:hover {
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.22);
}

#ckplays {
    width: 100%;
    height: 100%;
}

/* 播放历史区域样式 */
.history-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    margin: 2.5rem 0;
    display: none;
    animation: fadeIn 0.5s ease forwards;
}

.history-section.visible {
    display: block;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.history-title {
    font-size: 1.8rem;
    color: #4a148c;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.clear-history {
    color: #6a1b9a;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.clear-history:hover {
    color: #4a148c;
    background-color: rgba(106, 27, 154, 0.1);
    transform: translateY(-2px);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 1rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: #f9f5ff;
    border: 1px solid #e1e5eb;
    transition: all 0.3s ease;
    cursor: pointer;
}

.history-item:hover {
    background-color: #f0e6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.1);
}

.history-url {
    flex: 1;
    font-size: 1.4rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 1rem;
}

.history-actions {
    display: flex;
    gap: 0.8rem;
}

.history-play, .history-remove {
    background: none;
    border: none;
    color: #6a1b9a;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-play:hover, .history-remove:hover {
    background-color: rgba(106, 27, 154, 0.1);
    color: #4a148c;
}

.no-history {
    text-align: center;
    padding: 2rem;
    color: #9e9e9e;
    font-size: 1.6rem;
}

/* 加载状态样式 */
.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: white;
    font-size: 1.6rem;
    gap: 1.5rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.15);
    border-top-color: #ce93d8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: relative;
}

.spinner::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #e1bee7;
    border-radius: 50%;
    animation: spin 0.8s reverse infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 提示信息样式 */
.info-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #9e9e9e;
    font-size: 1.8rem;
    text-align: center;
    padding: 0 2rem;
    transition: all 0.3s ease;
}

/* 功能说明区域 */
.features-section {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-top: 3rem;
}

.features-title {
    font-size: 2rem;
    color: #4a148c;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background-color: #f9f5ff;
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    color: #8e24aa;
    margin-bottom: 1.5rem;
}

.feature-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.feature-desc {
    font-size: 1.4rem;
    color: #666;
    line-height: 1.6;
}

/* 页脚样式 */
footer {
    background-color: #212121;
    color: #a0aec0;
    padding: 4rem 0 2rem;
    margin-top: 5rem;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #6a1b9a, #8e24aa, #ba68c8);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.copyright {
    font-size: 1.3rem;
    margin-top: 1.5rem;
    opacity: 0.8;
    line-height: 1.8;
}

/* 主题设置区域样式 */
.theme-settings {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed #f0f0f0;
    padding-bottom: 0.5rem;
}

.theme-label {
    font-size: 1.5rem;
    margin-right: 0.8rem;
    font-weight: 600;
    transition: color 0.3s ease;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.15);
    line-height: 1.8;
}

.theme-control-group {
    display: flex;
    align-items: center;
}

#themeToggle {
    vertical-align: middle;
    font-weight: 600 !important;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.3) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

#primaryColor {
    vertical-align: middle;
}

/* 错误状态样式 */
#url.error {
    border-color: #ff4444;
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.15);
}

/* 黑夜模式样式 */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode .input-section,
body.dark-mode .history-section,
body.dark-mode .features-section {
    background: #1e1e1e;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

body.dark-mode .feature-title,
body.dark-mode .history-url {
    color: #e0e0e0;
}

body.dark-mode .feature-desc {
    color: #b0b0b0;
}

body.dark-mode #url {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-color: #3d3d3d;
}

body.dark-mode .example-link,
body.dark-mode .history-item {
    background-color: #332940;
    color: #ce93d8;
    border-color: #4a3a5c;
}

body.dark-mode .example-link:hover,
body.dark-mode .history-item:hover {
    background-color: #4a3a5c;
    color: #e1bee7;
}

body.dark-mode .info-message,
body.dark-mode .no-history {
    color: #b0b0b0;
}

body.dark-mode .copyright {
    color: #707070;
}

body.dark-mode .theme-settings,
body.dark-mode .history-header {
    border-top: 1px dashed #333;
}

body.dark-mode .features-title,
body.dark-mode .history-title {
    color: #ce93d8;
    border-bottom: 1px solid #333;
}

body.dark-mode .clear-history,
body.dark-mode .history-play,
body.dark-mode .history-remove {
    color: #ce93d8;
}

body.dark-mode .clear-history:hover,
body.dark-mode .history-play:hover,
body.dark-mode .history-remove:hover {
    color: #e1bee7;
    background-color: rgba(156, 39, 176, 0.2);
}

body.dark-mode .theme-label {
    color: #f0f0f0;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

body:not(.dark-mode) .theme-label {
    color: #222;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.8);
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.container > div {
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.input-section {
    animation-delay: 0.1s;
}

.player-section {
    animation-delay: 0.3s;
}

.history-section {
    animation-delay: 0.4s;
}

.features-section {
    animation-delay: 0.5s;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .input-container {
        flex-direction: column;
        margin-bottom: 1rem;
    }
    
    #doplayers {
        width: 100%;
        padding: 1.6rem 1.2rem;
        min-width: auto;
        font-size: 1.7rem;
    }
    
    .example-link {
        width: 100%;
        margin-left: 0;
        text-align: center;
        margin-top: 1rem;
    }
    
    .header-title h1 {
        font-size: 2.2rem;
    }
    
    .input-section {
        padding: 2rem;
    }
    
    .main-nav {
        gap: 1rem;
    }
    
    .main-nav a {
        font-size: 1.2rem;
    }
    
    .theme-settings {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem !important;
    }
    
    .logo-container img {
        height: 30px;
        margin-right: 0;
    }
    
    .history-url {
        font-size: 1.3rem;
    }
    
    /* 播放器区域移动端优化 */
    .player-section {
        margin: 2rem 0;
        min-height: 250px;
        border-radius: 8px;
    }
    
    #ckplays {
        border-radius: 8px;
    }
    
    .container {
        margin: 2rem auto;
        padding: 0 1rem;
    }
}

/* 针对超小屏幕的额外适配 */
@media screen and (max-width: 360px) {
    #doplayers {
        font-size: 1.5rem;
        gap: 0.5rem;
        padding: 1.4rem 1rem;
    }
    
    .input-section {
        padding: 1.5rem;
    }
    
    .main-nav {
        gap: 0.7rem;
    }
    
    .logo-container img {
        height: 26px;
    }
    
    .main-nav a {
        font-size: 1.1rem;
    }
    
    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    /* 超小屏幕播放器优化 */
    .player-section {
        min-height: 200px;
        border-radius: 6px;
        margin: 1.5rem 0;
    }
    
    .container {
        margin: 1.5rem auto;
        padding: 0 0.8rem;
    }
    
    .input-section {
        padding: 1.2rem;
        margin-bottom: 1.5rem;
    }
}

/* 针对极小屏幕的额外优化 */
@media screen and (max-width: 320px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .player-section {
        min-height: 180px;
        border-radius: 4px;
    }
    
    .input-section {
        padding: 1rem;
    }
    
    .header-title h1 {
        font-size: 1.8rem;
    }
}

/* 确保播放器容器在所有屏幕尺寸下都能正确显示 */
@media screen and (max-width: 480px) {
    .player-section {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    #ckplays {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 确保DPlayer容器不会溢出 */
    .dplayer {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .dplayer-video-wrap {
        width: 100% !important;
        max-width: 100% !important;
    }
}
