/**
 * AI短剧制作平台样式
 */

/* 全局样式 */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

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

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-shake {
    animation: shake 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* 卡片滑动容器 */
#card-container {
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* 玻璃态效果 */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 卡片hover效果 */
.card-hover {
    transition: all 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* 参考图筛选激活状态 */
.filter-active {
    background-color: #f3e8ff;
    color: #7c3aed;
    font-weight: 500;
}

/* 状态徽章 */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

/* 进度条 */
.progress-bar {
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #7c3aed;
    transition: width 0.3s ease;
}

/* 按钮涟漪效果 */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* 悬停视频播放器 */
.hover-video {
    position: relative;
    overflow: hidden;
}

.hover-video video {
    transition: transform 0.3s ease;
}

.hover-video:hover video {
    transform: scale(1.05);
}

/* 文本截断 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 骨架屏 */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* 响应式 */
@media (max-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .md\:flex-row {
        flex-direction: column;
    }
}

/* 自定义滚动容器 */
.custom-scroll {
    scrollbar-width: thin;
    scrollbar-color: #7c3aed #f3f4f6;
}

/* 输入框焦点样式 */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* 禁用状态 */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载动画 */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #7c3aed;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* 一级导航样式 */
.nav-tab {
    padding: 12px 24px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-tab:hover {
    color: #9333ea;
}

.nav-tab.active {
    border-bottom-color: #9333ea;
    color: #9333ea;
    font-weight: 600;
}

/* 分镜头卡片样式 */
.scene-card {
    transition: all 0.2s ease;
}

.scene-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scene-card.collapsed .scene-content {
    display: none;
}

.scene-card.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.scene-card:not(.collapsed) .collapse-icon {
    transform: rotate(0deg);
}

/* 状态徽章样式 */
.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    background: #e5e7eb;
    color: #6b7280;
    transition: all 0.2s;
}

.status-badge.done {
    background: #d1fae5;
    color: #065f46;
}

/* 剧集标签样式 */
.episode-tab {
    transition: all 0.2s ease;
}

.episode-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 参考图卡片样式 */
.reference-card {
    transition: all 0.2s ease;
}

.reference-card:hover {
    transform: translateY(-4px);
}

/* 用户中心下拉菜单优化 */
.group:hover > div {
    display: block !important;
}

/* 确保下拉菜单的hover状态 */
.group > div:hover {
    display: block !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 横向滚动容器 */
.overflow-x-auto {
    scrollbar-width: thin;
    scrollbar-color: #9333ea #f3f4f6;
}

.overflow-x-auto::-webkit-scrollbar {
    height: 6px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #9333ea;
    border-radius: 3px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

/* 响应式网格 */
@media (max-width: 768px) {
    .scene-card .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .nav-tab {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* 平滑过渡 */
.transition-all {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== 参考图占位符系统样式 ==================== */

/* 参考图占位符样式 */
.reference-placeholder {
    display: inline-block;
    padding: 2px 6px;
    margin: 0 1px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

/* 已关联参考图的占位符 */
.reference-placeholder.has-ref {
    background: #e9d5ff;
    color: #7c3aed;
    border: 1px solid #c084fc;
}

.reference-placeholder.has-ref:hover {
    background: #ddd6fe;
    border-color: #a855f7;
    box-shadow: 0 2px 4px rgba(124, 58, 237, 0.2);
    transform: translateY(-1px);
}

/* 未关联参考图的占位符 */
.reference-placeholder.no-ref {
    background: #fef3c7;
    color: #d97706;
    border: 1px dashed #fbbf24;
}

.reference-placeholder.no-ref:hover {
    background: #fde68a;
    border-color: #f59e0b;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.2);
}

/* 可编辑div样式 */
div[contenteditable="true"] {
    white-space: pre-wrap;
    word-wrap: break-word;
    outline: none;
}

div[contenteditable="true"]:empty:before {
    content: attr(placeholder);
    color: #9ca3af;
    font-style: italic;
}

div[contenteditable="true"]:focus {
    outline: none;
}

/* 参考图预览网格 */
.reference-preview {
    background: #f9fafb;
}

/* 参考图缩略图 */
.reference-thumb {
    width: 120px;
    padding: 4px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #fff;
}

.reference-thumb-image {
    width: 100%;
    height: 100px;
    background: #f8fafc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.reference-thumb-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.reference-card-thumb {
    width: 100%;
    height: 120px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    padding: 10px;
}

.reference-card-thumb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.reference-thumb:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.03);
}

.reference-preview .group {
    transition: all 0.2s ease;
}

.reference-preview .group:hover {
    transform: translateY(-2px);
}

/* 参考图选择器中的项目 */
.reference-item {
    background: white;
    transition: all 0.2s ease;
}

.reference-item:hover {
    transform: translateY(-2px);
}

.reference-item img {
    transition: transform 0.3s ease;
}

.reference-item:hover img {
    transform: scale(1.05);
}

/* 加载动画 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* 模态框遮罩 */
#reference-picker-modal {
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#reference-picker-modal > div {
    animation: slideUp 0.3s ease;
}

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

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

#ref-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#ref-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#ref-grid::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ==================== 画面比例样式 ==================== */

/* 竖屏 9:16 比例容器 */
.aspect-9-16 {
    position: relative;
    width: 100%;
    padding-bottom: 177.78%; /* 16/9 * 100% */
}

.aspect-9-16 > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 横屏 16:9 比例容器（Tailwind 的 aspect-video 就是这个比例） */
.aspect-16-9 {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 9/16 * 100% */
}

.aspect-16-9 > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scene-media-frame {
    width: 240px;
    margin: 0 auto;
}

.scene-media-frame .scene-media {
    width: 100%;
}

@media (max-width: 768px) {
    .scene-media-frame {
        width: 100%;
    }
}

/* 响应式调整 */
@media (max-width: 640px) {
    .reference-placeholder {
        padding: 1px 4px;
        font-size: 13px;
    }
    
    #reference-picker-modal > div {
        max-width: 95vw;
        max-height: 90vh;
    }
    
    #ref-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

