/* 紫微斗数页面样式 */
body {
    background: var(--terminal-bg);
}

.ziwei-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.ziwei-header {
    text-align: center;
    margin-bottom: 20px;
}

.ziwei-title {
    color: var(--terminal-gold);
    font-size: 44px;
    text-shadow: 0 0 10px var(--terminal-gold);
    margin-bottom: 10px;
}

.ziwei-subtitle {
    color: var(--terminal-gray);
    font-size: 14px;
}

/* 输入区域 */
.input-section {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--terminal-green);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 
        0 0 5px rgba(0, 255, 0, 0.8),
        0 0 10px rgba(0, 255, 0, 0.6),
        0 0 20px rgba(0, 255, 0, 0.4),
        inset 0 0 15px rgba(0, 255, 0, 0.05);
    animation: card-glow 3s ease-in-out infinite;
}

@keyframes card-glow {
    0%, 100% {
        box-shadow: 
            0 0 5px rgba(0, 255, 0, 0.8),
            0 0 20px rgba(0, 255, 0, 0.4),
            inset 0 0 15px rgba(0, 255, 0, 0.05);
    }
    50% {
        box-shadow: 
            0 0 8px rgba(0, 255, 0, 1),
            0 0 20px rgba(0, 255, 0, 0.5),
            inset 0 0 20px rgba(0, 255, 0, 0.08);
    }
}

.input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-label {
    display: block;
    color: var(--terminal-cyan);
    font-size: 14px;
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 12px;
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-gray);
    border-radius: 4px;
    color: var(--terminal-white);
    font-family: inherit;
    font-size: 16px;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: var(--terminal-green);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.input-field[type="date"] {
    color-scheme: dark;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-item {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-item input {
    margin-right: 8px;
    accent-color: var(--terminal-green);
}

.radio-item span {
    color: var(--terminal-white);
}

.calc-btn {
    display: block;
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    background: transparent;
    border: 2px solid var(--terminal-green);
    border-radius: 8px;
    color: var(--terminal-green);
    font-family: inherit;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
}

.calc-btn:hover {
    background: var(--terminal-green);
    color: var(--terminal-bg);
    animation: none;
}

/* 表单容器 */
#inputSection {
    position: relative;
}

/* 表单区域入场动画 - 所有元素一起出来 */
#inputSection {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    filter: blur(5px);
}

#inputSection.animate-entry {
    animation: formEntry 0.8s ease-out forwards;
    animation-delay: 0.2s;
}

#inputSection.animate-entry .ziwei-header,
#inputSection.animate-entry .input-section {
    animation: formEntry 0.8s ease-out forwards;
    animation-delay: 0.2s;
}

@keyframes formEntry {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        filter: blur(5px);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-5px) scale(1.01);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* 背景装饰动画 */
.input-section-backdrop {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(0, 255, 136, 0.08) 0%, transparent 70%);
    animation: backdropPulse 3s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes backdropPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

/* 加载进度条 */
.loading-progress {
    display: none;
    width: 100%;
    height: 4px;
    background: rgba(0, 255, 136, 0.2);
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
}

.loading-progress.active {
    display: block;
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--terminal-green), #00ff88, var(--terminal-green));
    background-size: 200% 100%;
    border-radius: 2px;
    animation: progressGradient 1s linear infinite, progressMove 0.8s ease-out forwards;
    box-shadow: 0 0 10px var(--terminal-green);
}

@keyframes progressGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes progressMove {
    0% { width: 0%; }
    30% { width: 30%; }
    60% { width: 65%; }
    80% { width: 85%; }
    100% { width: 100%; }
}

/* 结果区域加载动画 */
.result-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 50px 20px;
}

.result-loading.active {
    display: flex;
}

.result-loading-circle {
    width: 80px;
    height: 80px;
    border: 3px solid rgba(0, 255, 136, 0.2);
    border-top-color: var(--terminal-green);
    border-radius: 50%;
    animation: loadingSpin 1s linear infinite;
    margin-bottom: 30px;
}

@keyframes loadingSpin {
    to { transform: rotate(360deg); }
}

.result-loading-text {
    font-size: 18px;
    color: var(--terminal-green);
    margin-bottom: 25px;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.result-loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(0, 255, 136, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.result-loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--terminal-green), #00ff88);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--terminal-green);
}

@keyframes resultBarProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* 3D卡片加载动画 */
.result-section.loading-3d {
    perspective: 1000px;
}

.result-section.loading-3d .card-3d-wrapper {
    animation: card3dFlip 1.2s ease-in-out forwards;
}

.card-3d-wrapper {
    transform-style: preserve-3d;
    animation: none;
}

@keyframes card3dFlip {
    0% {
        transform: rotateY(-90deg) scale(0.8);
        opacity: 0;
        filter: blur(10px);
    }
    50% {
        transform: rotateY(10deg) scale(1.02);
        opacity: 0.8;
        filter: blur(2px);
    }
    70% {
        transform: rotateY(-5deg) scale(0.98);
        opacity: 0.9;
        filter: blur(0);
    }
    100% {
        transform: rotateY(0deg) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

/* 3D 浮动粒子效果 */
@keyframes floatParticle {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

.loading-3d::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 255, 136, 0.03) 50%, transparent 100%);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.loading-3d-card {
    width: 300px;
    height: 400px;
    background: linear-gradient(135deg, var(--terminal-bg) 0%, rgba(0, 255, 136, 0.1) 100%);
    border: 2px solid var(--terminal-green);
    border-radius: 20px;
    transform-style: preserve-3d;
    animation: loadingCardRotate 2s ease-in-out infinite;
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.3),
        0 0 60px rgba(0, 255, 136, 0.1),
        inset 0 0 30px rgba(0, 255, 136, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

@keyframes loadingCardRotate {
    0% {
        transform: rotateY(0deg) rotateX(10deg);
    }
    25% {
        transform: rotateY(90deg) rotateX(10deg);
    }
    50% {
        transform: rotateY(180deg) rotateX(10deg);
    }
    75% {
        transform: rotateY(270deg) rotateX(10deg);
    }
    100% {
        transform: rotateY(360deg) rotateX(10deg);
    }
}

.loading-3d-card .orbit {
    width: 150px;
    height: 150px;
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 50%;
    position: relative;
    animation: orbitPulse 1.5s ease-in-out infinite;
}

.loading-3d-card .orbit::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: var(--terminal-green);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--terminal-green);
}

.loading-3d-card .orbit::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: var(--terminal-yellow);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--terminal-yellow);
}

@keyframes orbitPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 255, 136, 0.5);
    }
}

.loading-3d-card .loading-text {
    font-size: 18px;
    color: var(--terminal-green);
    text-align: center;
}

.loading-3d-card .loading-stars {
    display: flex;
    gap: 10px;
}

.loading-3d-card .loading-stars span {
    font-size: 24px;
    animation: starFloat 1s ease-in-out infinite;
}

.loading-3d-card .loading-stars span:nth-child(1) { animation-delay: 0s; }
.loading-3d-card .loading-stars span:nth-child(2) { animation-delay: 0.2s; }
.loading-3d-card .loading-stars span:nth-child(3) { animation-delay: 0.4s; }

@keyframes starFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-10px) scale(1.2);
        opacity: 1;
    }
}

/* 卡片内容淡入 */
.card-content {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out 0.8s;
}

.card-content.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 脉动光环效果 */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 255, 136, 0.6), 0 0 60px rgba(0, 255, 136, 0.3);
    }
    100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    }
}

/* 十二宫命盘 - 传统布局 */
.palace-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 20px 0;
}

.palace-card {
    background: rgba(0, 255, 0, 0.03);
    border: 1px solid var(--terminal-gray);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.palace-card.minggong {
    border-color: var(--terminal-gold);
    background: rgba(255, 155, 21, 0.1);
    box-shadow: 0 0 10px rgba(255, 155, 21, 0.2);
}

.palace-card:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
}

.palace-name {
    color: var(--terminal-gold);
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 6px;
}

.palace-stars {
    color: var(--terminal-white);
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.palace-sihua {
    font-size: 12px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--terminal-gray);
}

/* 四化标签 */
.sihua-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 16px;
    margin: 2px;
}

.sihua-lu { background: rgba(0, 255, 0, 0.2); color: var(--terminal-green); }
.sihua-quan { background: rgba(0, 255, 255, 0.2); color: var(--terminal-cyan); }
.sihua-ke { background: rgba(255, 155, 21, 0.2); color: var(--terminal-yellow); }
.sihua-ji { background: rgba(255, 0, 0, 0.2); color: var(--terminal-red); }

/* 基础信息 */
.basic-info {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--terminal-gray);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px dashed var(--terminal-gray);
}

.info-label {
    color: var(--terminal-gray);
    font-size: 13px;
}

.info-value {
    color: var(--terminal-white);
    font-size: 13px;
}

.gan-label {
    font-size: 13px;
    color: var(--terminal-yellow);
    margin-bottom: 4px;
}

/* 四化详情 */
.sihua-detail-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}

.sihua-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.sihua-detail-star {
    font-size: 14px;
    font-weight: bold;
}

.sihua-detail-gong {
    font-size: 12px;
    color: var(--terminal-gray);
}

.sihua-detail-desc {
    font-size: 12px;
    color: var(--terminal-white);
    opacity: 0.85;
    line-height: 1.5;
}

/* 大限区域 */
.daxian-section {
    margin-top: 20px;
}

.daxian-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
    justify-content: center;
}

.daxian-tab {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--terminal-gray);
    border-radius: 4px;
    color: var(--terminal-gray);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.daxian-tab:hover {
    border-color: var(--terminal-green);
    color: var(--terminal-green);
}

.daxian-tab.active {
    background: var(--terminal-green);
    border-color: var(--terminal-green);
    color: var(--terminal-bg);
}

.daxian-content {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--terminal-gray);
    border-radius: 8px;
    padding: 20px;
    min-height: 150px;
}

.daxian-content .info-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* AI解读 */
.interpretation-section {
    margin-top: 20px;
}

.interp-btn {
    padding: 12px 30px;
    background: transparent;
    border: 2px solid var(--terminal-gold);
    border-radius: 8px;
    color: var(--terminal-gold);
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.interp-btn:hover {
    background: var(--terminal-gold);
    color: #000;
}

.interp-btn.active {
    background: var(--terminal-gold);
    color: #000;
}

.interp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.interp-result {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 155, 21, 0.05);
    border: 1px solid var(--terminal-gold);
    border-radius: 8px;
    color: var(--terminal-white);
    line-height: 1.8;
    white-space: pre-wrap;
}

.loading-text {
    color: #000;
    animation: blink 1s infinite;
}

/* 骨架屏/线框加载样式 */
.skeleton-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--terminal-gray);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-header {
    height: 20px;
    width: 120px;
    background: linear-gradient(90deg, var(--terminal-gray) 25%, rgba(255,255,255,0.1) 50%, var(--terminal-gray) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 15px;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.1) 25%, rgba(0, 255, 136, 0.2) 50%, rgba(0, 255, 136, 0.1) 75%);
    background-size: 200% 100%;
    border-radius: 3px;
    margin-bottom: 10px;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.skeleton-box {
    height: 80px;
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.05) 25%, rgba(0, 255, 136, 0.1) 50%, rgba(0, 255, 136, 0.05) 75%);
    background-size: 200% 100%;
    border-radius: 6px;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 结果区域模块 */
.result-section {
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
    display: none;
}

.result-section.visible,
.result-section.show {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

.result-section.loading {
    display: flex;
}

/* 按钮组 */
.button-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.terminal-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid var(--terminal-gray);
    border-radius: 8px;
    color: var(--terminal-gray);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.terminal-btn:hover {
    border-color: var(--terminal-white);
    color: var(--terminal-white);
}

.terminal-btn.primary {
    border-color: var(--terminal-green);
    color: var(--terminal-green);
}

.terminal-btn.primary:hover {
    background: var(--terminal-green);
    color: var(--terminal-bg);
}

/* 分享弹窗 */
.limit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.limit-modal-content {
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-green);
    border-radius: 12px;
    padding: 25px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.limit-modal-text {
    color: var(--terminal-green);
    font-size: 16px;
}

.limit-modal-btn {
    padding: 10px 25px;
    background: var(--terminal-green);
    border: none;
    border-radius: 6px;
    color: var(--terminal-bg);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.limit-modal-btn:hover {
    background: var(--terminal-gold);
}

/* 移动端适配 */
@media (max-width: 600px) {
    .ziwei-container {
        padding: 15px;
    }
    
    .input-section {
        border-radius: 16px;
        padding: 15px;
    }
    
    .palace-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .palace-grid .palace-card {
        width: calc(50% - 4px);
        min-height: 90px;
    }
    
    .palace-grid .palace-card[style*="visibility: hidden"] {
        display: none;
    }
    
    .palace-card {
        min-height: 100px;
        padding: 10px;
    }
    
    .palace-name {
        font-size: 14px;
    }
    
    .palace-stars {
        font-size: 13px;
    }
    
    .input-row {
        gap: 10px;
    }
    
    .input-row.date-time-row .input-group {
        min-width: 100%;
    }
    
    .input-group {
        min-width: calc(50% - 5px);
    }
    
    .input-field {
        font-size: 14px;
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .info-label {
        font-size: 12px;
    }
    
    .info-value {
        font-size: 12px;
    }
    
    .daxian-tabs {
        gap: 4px;
    }
    
    .daxian-tab {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .daxian-content .info-grid {
        grid-template-columns: 1fr;
    }
    
    .sihua-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .button-row {
        flex-direction: column;
    }
    
    .terminal-btn {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .palace-card {
        min-height: 90px;
        padding: 6px;
    }
    
    .palace-name {
        font-size: 11px;
    }
    
    .palace-stars {
        font-size: 10px;
    }
    
    .sihua-tag {
        font-size: 9px;
        padding: 1px 3px;
    }
}
