/* Tailwind config */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom utilities */
@layer utilities {
    .content-auto {
        content-visibility: auto;
    }
    .text-balance {
        text-wrap: balance;
    }
    .animate-fade-in {
        animation: fadeIn 0.8s ease-in-out forwards;
    }
    .animate-slide-up {
        animation: slideUp 0.8s ease-out forwards;
    }
    .backdrop-blur-sm {
        backdrop-filter: blur(4px);
    }
}

/* Keyframes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 现代简约背景 */
.hero-bg {
    background: linear-gradient(to right, #f5f7fa 0%, #c3cfe2 100%);
    position: relative;
    overflow: hidden;
}

.hero-bg::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* 主标题样式 */
.hero-bg h1 {
    font-size: clamp(2.8rem, 7vw, 5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    color: #1E40AF;
    text-shadow: 
        0 2px 4px rgba(255,255,255,0.5),
        0 4px 16px rgba(255,255,255,0.3);
    position: relative;
    display: inline-block;
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-bg h1::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -0.5rem;
    width: 100%;
    height: 4px;
    background: #1E40AF;
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: right;
    animation: underlineGrow 0.8s 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* 副标题样式 */
.hero-bg p {
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    line-height: 1.6;
    max-width: 42rem;
    margin-bottom: 2rem;
    color: #1E40AF;
    text-shadow: 0 2px 4px rgba(255,255,255,0.5);
    animation: fadeIn 0.8s 0.2s ease-out forwards;
    opacity: 0;
    font-weight: 500;
}

/* 背景调整 */
.hero-bg::before {
    opacity: 0.1;
    z-index: 1;
}

.hero-bg > .absolute {
    z-index: 5;
    opacity: 0.15;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes underlineGrow {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes textPulse {
    from {
        transform: translateZ(0) scale(1);
        text-shadow: 0 4px 20px rgba(59, 130, 246, 0.5),
                     0 0 0 rgba(0,0,0,0.8),
                     2px 2px 4px rgba(0,0,0,0.5);
    }
    to {
        transform: translateZ(20px) scale(1.05);
        text-shadow: 0 8px 30px rgba(59, 130, 246, 0.7),
                     0 0 0 rgba(0,0,0,0.8),
                     4px 4px 8px rgba(0,0,0,0.6);
    }
}

@keyframes underlinePulse {
    from {
        transform: scaleX(0.8);
        opacity: 0.8;
    }
    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

.hero-bg p {
    color: #1e40af;
}

.hero-bg button {
    color: white;
    background-color: #1a56db;
    border: 2px solid #1e40af;
}

.hero-bg button:hover {
    background-color: #1e40af;
}

/* 悬浮图片样式 */
.qrcode-modal, .api-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.qrcode-modal.active, .api-modal.active {
    opacity: 1;
    pointer-events: all;
}
.qrcode-container, .api-modal-container {
    background-color: white;
    padding: 2rem;
    border-radius: 1rem;
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
}
.close-qrcode, .close-api-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748B;
}
.api-modal-content {
    width: 800px;
    max-width: 90vw;
}
.api-modal-content #api-modal-content {
    padding: 1rem;
    max-height: 80vh;
    overflow-y: auto;
}

/* 视频悬浮框样式 */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-modal.active {
    opacity: 1;
    pointer-events: all;
}

.video-modal-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 比例 */
    height: 0;
}

.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    margin: auto;
}

.close-video-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #1a56db;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: none;
    font-size: 18px;
    z-index: 10;
    transition: all 0.2s ease;
}

.close-video-modal:hover {
    background: #1e40af;
    transform: scale(1.1);
}

/* 确保原内容隐藏 */
#api-cooperation {
    display: none !important;
}

/* 模态框内容样式 */
#api-modal-content .prose {
    padding: 20px;
}

#api-modal-content h2 {
    margin-bottom: 1.5rem;
    color: #1e293b;
}

#api-modal-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #3b82f6;
}

#api-modal-content h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

#api-modal-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

#api-modal-content li {
    margin-bottom: 0.5rem;
}

#api-modal-content .border-b {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

#api-modal-content .bg-blue-50 {
    background-color: #eff6ff;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

.close-qrcode {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #1a56db;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: none;
    font-size: 16px;
    transition: all 0.2s ease;
}

.close-qrcode:hover {
    background: #1e40af;
    transform: scale(1.1);
}

/* API合作方案区域样式 */
#api-cooperation {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
    background-color: #f8fafc;
}

#api-cooperation:not(.hidden) {
    max-height: 2000px; /* 设置为足够大的值 */
    transition: max-height 0.5s ease-in;
}

#api-cooperation .prose {
    padding: 20px;
}

#api-cooperation h2 {
    margin-bottom: 1.5rem;
    color: #1e293b;
}

#api-cooperation h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #3b82f6;
}

#api-cooperation h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

#api-cooperation ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

#api-cooperation li {
    margin-bottom: 0.5rem;
}

#api-cooperation .border-b {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

#api-cooperation .bg-blue-50 {
    background-color: #eff6ff;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    #api-cooperation .prose {
        padding: 15px;
    }
}

/* 字幕文本样式 */
video::cue {
    color: #3B82F6 !important; /* 蓝色字体 */
    background-color: transparent;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    font-size: 18px;
    line-height: 1.4;
}

/* 字幕背景适应 */
video::cue {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
}
