/* 重置插件样式 */
.fortune-plugin-wrapper,
.fortune-plugin-wrapper *,
.fortune-plugin-modal,
.fortune-plugin-modal * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
    line-height: normal;
    text-shadow: none;
    border: none;
    outline: none;
}

/* 插件主容器 */
.fortune-plugin-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* 表单容器 */
.fortune-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fortune-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

/* 表单样式 */
.fortune-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    justify-content: center;
    width: 100%;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0;
    position: relative;
}

.form-group label {
    display: inline-block;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    margin: 0;
    padding: 0;
    min-width: auto;
    font-size: 1rem;
    cursor: pointer;
}

.form-group input {
    display: inline-block;
    width: 200px;
    height: 42px;
    padding: 0 1rem;
    margin: 0;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 42px;
    color: #2c3e50;
    background: #fff;
    transition: all 0.2s ease;
}

.form-group input:hover {
    border-color: #cbd5e0;
}

.form-group input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* 按钮样式 */
.submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #4a90e2;
    color: white;
    border: none;
    height: 42px;
    padding: 0 2rem;
    margin: 0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 120px;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.submit-button:hover {
    background: #357abd;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.submit-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.submit-button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    color: #718096;
    transform: none;
    box-shadow: none;
}

/* 按钮Loading状态 */
.submit-button.loading {
    pointer-events: none;
    background: #4a90e2;
    color: transparent;
}

.submit-button.loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: button-loading-spinner 0.8s linear infinite;
}

@keyframes button-loading-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* 按钮错误状态 */
.submit-button.error {
    background: #e53e3e;
    color: white;
}

/* 弹窗样式 */
.fortune-plugin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: block;
    pointer-events: none;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
    pointer-events: auto;
}

.fortune-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: #fff;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    z-index: 1000000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.fortune-modal.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-content {
    position: relative;
    padding: 2.5rem;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f7fafc;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.close-button:hover {
    background: #edf2f7;
    color: #4a5568;
    transform: rotate(90deg);
}

.result-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #edf2f7;
}

.result-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.result-section h3 {
    color: #1a202c;
    margin: 0 0 1.2rem 0;
    padding: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.result-content {
    color: #4a5568;
    font-size: 1rem;
    line-height: 1.6;
}

.result-content p {
    margin: 0 0 0.75rem 0;
    padding: 0;
}

.result-content p:last-child {
    margin-bottom: 0;
}

.result-content p span {
    font-weight: 600;
    color: #2d3748;
}

/* 产品列表样式 */
.products-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1rem;
}

.product-card {
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 200px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.product-image {
    height: 160px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7fafc;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 1.25rem;
}

.product-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a202c;
}

.product-info p {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #718096;
    line-height: 1.5;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 1rem;
}

.buy-button {
    display: inline-block;
    background: #4a90e2;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.buy-button:hover {
    background: #357abd;
    transform: translateY(-1px);
    text-decoration: none;
    color: white;
}

.no-products {
    width: 100%;
    text-align: center;
    padding: 2rem;
    color: #718096;
    font-style: italic;
}

/* 太极动画样式 */
.hexagram-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.hexagram-container.fade-out {
    animation: fadeOut 0.5s forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.hexagram {
    position: relative;
    width: 300px;
    height: 300px;
    animation: taijiRotate 3s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hexagram-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image: url('../img/taiji.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    animation: taijiPulse 2s ease-in-out infinite alternate;
    opacity: 0.9;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.4));
}

.hexagram-layer:nth-child(2) {
    animation-delay: 0.67s;
    transform: scale(0.85);
    opacity: 0.7;
}

.hexagram-layer:nth-child(3) {
    animation-delay: 1.33s;
    transform: scale(0.7);
    opacity: 0.5;
}

@keyframes taijiRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes taijiPulse {
    0% {
        opacity: 0.5;
        transform: scale(0.9);
        filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
    }

    100% {
        opacity: 1;
        transform: scale(1.1);
        filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.6));
    }
}

/* 媒体查询适配移动设备 */
@media (max-width: 768px) {
    .fortune-plugin-wrapper {
        padding: 15px;
    }

    .fortune-container {
        padding: 1.5rem;
    }

    .fortune-form {
        flex-direction: column;
        align-items: stretch;
    }

    .form-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .form-group label {
        margin-bottom: 0.5rem;
    }

    .form-group input {
        width: 100%;
    }

    .submit-button {
        width: 100%;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .product-card {
        flex: 1 1 100%;
    }

    /* 移动端太极动画适配 */
    .hexagram {
        width: 250px;
        height: 250px;
    }
}

@media (max-width: 480px) {

    /* 小屏幕进一步调整太极动画尺寸 */
    .hexagram {
        width: 200px;
        height: 200px;
    }
}

/* 聚焦状态样式 */
.form-group.focused label {
    color: #4a90e2;
}