/* CSS变量定义 - 现代化配色方案 */
:root {
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --container-bg: #ffffff;
    --header-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --panel-bg: #f8fafc;
    --panel-border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.1);
    
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    
    --system-msg-bg: linear-gradient(135deg, #e6fffa 0%, #b2f5ea 100%);
    --user-msg-bg: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
    
    --primary-color: #3182ce;
    --primary-hover: #2c5aa0;
    --secondary-color: #38b2ac;
    --secondary-hover: #319795;
    --success-color: #38a169;
    --danger-color: #e53e3e;
    
    --border-radius-sm: 6px;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 获取密钥按钮样式 */
.get-key-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.get-key-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
    color: white;
}

.get-key-btn:active {
    transform: translateY(0);
}

/* 表单操作按钮布局 */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.form-actions .primary-btn {
    flex: 1;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .get-key-btn,
    .form-actions .primary-btn {
        width: 100%;
        justify-content: center;
    }
}

/* 设置面板动画 */
.ckey-panel {
    /* 保留原有样式 */
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    transition: all 0.3s ease;
}

.ckey-panel.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 设置面板背景遮罩 */
.ckey-panel::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ckey-panel.show::before {
    opacity: 1;
}
/* 自动播放按钮样式 */
.tertiary-btn {
    background: rgba(156, 163, 175, 0.1);
    border: 2px solid rgba(156, 163, 175, 0.2);
    color: #6b7280;
}

.tertiary-btn:hover {
    background: rgba(156, 163, 175, 0.2);
    border-color: rgba(156, 163, 175, 0.3);
}

/* 状态颜色 */
:root {
    --success-color: #10b981;
    --error-color: #ef4444;
}

.video-info .info-item .value {
    font-weight: 500;
}

/* 添加到style.css中的新样式 */
.ckey-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    z-index: 1000;
    width: 90%;
    max-width: 500px;
    display: none;
}

.ckey-panel.show {
    display: block;
}

.ckey-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.ckey-panel .close-panel-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
}

.ckey-form .form-group {
    margin-bottom: 20px;
}

.ckey-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.ckey-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.ckey-form input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-help {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.panel-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
}

.icon-btn:hover {
    background: #f5f5f5;
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

/* 主容器 */
.app-container {
    width: 100%;
    max-width: 1400px;
    background: var(--container-bg);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
    backdrop-filter: blur(10px);
}

/* 头部样式 */
.app-header {
    background: var(--header-bg);
    color: white;
    padding: 20px 30px;
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.header-icon {
    font-size: 2rem;
    margin-right: 15px;
}

.header-content h1 {
    font-size: 1.8rem;
    font-weight: var(--font-weight-bold);
    margin: 0;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.header-status i {
    color: #4ade80;
    animation: pulse 2s infinite;
}

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

/* 主内容区域 */
.main-content {
    display: flex;
    flex-grow: 1;
    padding: 24px;
    gap: 24px;
}

/* 面板通用样式 */
.chat-panel, .video-panel {
    background: var(--panel-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
}

.chat-panel:hover, .video-panel:hover {
    box-shadow: var(--shadow-lg);
}

.panel-header {
    background: white;
    padding: 16px 20px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 聊天面板样式 */
.chat-panel {
    flex: 1;
    min-width: 300px;
}

.chat-box {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: white;
}

.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.chat-placeholder i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-message {
    padding: 12px 18px;
    border-radius: var(--border-radius-lg);
    max-width: 85%;
    word-wrap: break-word;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: slideIn 0.3s ease-out;
    position: relative;
    box-shadow: var(--shadow-sm);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.system {
    background: var(--system-msg-bg);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    background: var(--user-msg-bg);
    color: var(--text-primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.clear-chat-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.clear-chat-btn:hover {
    background: rgba(229, 62, 62, 0.1);
}

.chat-stats {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid var(--panel-border);
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* 视频面板样式 */
.video-panel {
    flex: 2;
}

.api-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(56, 178, 172, 0.1);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: var(--font-weight-medium);
}

.api-dot {
    width: 8px;
    height: 8px;
    background: var(--secondary-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.video-wrapper {
    flex-grow: 1;
    position: relative;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 20px;
    box-shadow: var(--shadow-lg);
}

.video-player-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.video-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    text-align: center;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 16px;
}

.video-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    min-width: 140px;
    justify-content: center;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.secondary-btn {
    background: var(--secondary-color);
    color: white;
}

.secondary-btn:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.video-info {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--panel-border);
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
}

.info-item {
    display: flex;
    gap: 8px;
}

.info-item .label {
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}

.info-item .value {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
}

/* 底部状态栏 */
.app-footer {
    background: var(--panel-bg);
    border-top: 1px solid var(--panel-border);
    padding: 12px 30px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .chat-panel, .video-panel {
        flex: none;
    }
    
    .chat-box {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .app-container {
        height: auto;
        border-radius: var(--border-radius);
    }
    
    .app-header {
        padding: 16px 20px;
    }
    
    .header-content h1 {
        font-size: 1.4rem;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .video-controls {
        flex-direction: column;
    }
    
    .control-btn {
        width: 100%;
    }
}

/* 自定义滚动条 */
.chat-box::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
