/**
 * 前台样式
 * 100%复用子比主题CSS变量
 * 完全适配子比主题原生风格
 */

/* 使用子比主题变量 */
:root {
    --zib-main-color: var(--zib-main-color, #007cba);
    --zib-card-bg: var(--zib-card-bg, #fff);
    --zib-text-color: var(--zib-text-color, #333);
    --zib-border-color: var(--zib-border-color, #ddd);
    --zib-shadow: var(--zib-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
    --zib-radius: var(--zib-radius, 8px);
}

/* 抽奖容器 - 子比主题原生风格（兼容新旧类名） */
.pat-lottery-container,
.pat-lottery-wrap {
    background: var(--zib-card-bg, #fff);
    border-radius: var(--zib-radius, 8px);
    padding: 30px;
    margin: 30px auto;
    max-width: 900px;
    box-shadow: var(--zib-shadow, 0 2px 12px rgba(0, 0, 0, 0.08));
    border: 1px solid var(--zib-border-color, #e5e5e5);
    transition: all 0.3s ease;
}

.pat-lottery-container:hover,
.pat-lottery-wrap:hover {
    box-shadow: var(--zib-shadow, 0 4px 16px rgba(0, 0, 0, 0.12));
}

/* 确保新旧类名都能使用新UI样式 */
.pat-lottery-wrap {
    padding: 24px 16px;
    width: 90vw;
    max-width: 520px;
}

.pat-lottery-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--zib-border-color, #e5e5e5);
}

.pat-lottery-header h2 {
    margin: 0 0 15px 0;
    color: var(--zib-text-color, #333);
    font-size: 24px;
    font-weight: 600;
}

.pat-lottery-times {
    display: inline-block;
    background: linear-gradient(135deg, var(--zib-main-color, #007cba) 0%, #005a87 100%);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.pat-lottery-times strong {
    font-size: 18px;
    margin: 0 5px;
}

.pat-lottery-login-tip {
    color: var(--zib-text-color, #666);
    text-align: center;
    padding: 20px;
    background: var(--zib-card-bg, #f9f9f9);
    border-radius: var(--zib-radius, 8px);
}

.pat-lottery-login-tip a {
    color: var(--zib-main-color, #007cba);
    text-decoration: none;
    font-weight: 600;
}

.pat-lottery-login-tip a:hover {
    text-decoration: underline;
}

.pat-lottery-login-required,
.pat-lottery-no-times {
    text-align: center;
    padding: 50px 20px;
    color: var(--zib-text-color, #666);
    background: var(--zib-card-bg, #f9f9f9);
    border-radius: var(--zib-radius, 8px);
    border: 2px dashed var(--zib-border-color, #ddd);
}

.pat-lottery-login-required p,
.pat-lottery-no-times p {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.pat-lottery-login-required .button,
.pat-lottery-no-times .button {
    margin-top: 15px;
    padding: 12px 30px;
    border-radius: var(--zib-radius, 8px);
    font-weight: 600;
    transition: all 0.3s;
}

.pat-lottery-login-required .button:hover,
.pat-lottery-no-times .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

/* 转盘抽奖 - 子比主题原生风格 */
.pat-lottery-wheel-wrapper {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 124, 186, 0.05) 0%, rgba(0, 90, 135, 0.05) 100%);
    border-radius: var(--zib-radius, 8px);
}

.pat-lottery-wheel {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto;
    display: inline-block;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.pat-lottery-wheel canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    background: #fff;
}

.pat-lottery-wheel-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--zib-main-color, #007cba) 0%, #005a87 100%);
    color: #fff;
    border: 4px solid #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    z-index: 10;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pat-lottery-wheel-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 6px 16px rgba(0, 124, 186, 0.5);
}

.pat-lottery-wheel-btn:active:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.05);
}

.pat-lottery-wheel-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translate(-50%, -50%) scale(1);
}

.pat-lottery-prizes-list {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 2px solid var(--zib-border-color, #e5e5e5);
}

.pat-lottery-prizes-list h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: var(--zib-text-color, #333);
    font-weight: 600;
    text-align: center;
}

.pat-lottery-prizes-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.pat-lottery-prizes-list li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    background: var(--zib-card-bg, #f9f9f9);
    border-radius: var(--zib-radius, 8px);
    font-size: 14px;
    border: 1px solid var(--zib-border-color, #e5e5e5);
    transition: all 0.3s;
    text-align: center;
}

.pat-lottery-prizes-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--zib-main-color, #007cba);
}

.pat-lottery-prizes-list li img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--zib-radius, 8px);
    border: 2px solid var(--zib-border-color, #e5e5e5);
}

.pat-lottery-prizes-list li span:first-of-type {
    font-weight: 600;
    color: var(--zib-text-color, #333);
}

.pat-lottery-prizes-list li .probability {
    color: var(--zib-main-color, #007cba);
    font-weight: bold;
    font-size: 12px;
    background: rgba(0, 124, 186, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

/* 九宫格抽奖 - 子比主题原生风格 */
.pat-lottery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 500px;
    margin: 30px auto;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 124, 186, 0.03) 0%, rgba(0, 90, 135, 0.03) 100%);
    border-radius: var(--zib-radius, 8px);
}

.pat-lottery-grid-item {
    aspect-ratio: 1;
    background: var(--zib-card-bg, #fff);
    border: 3px solid var(--zib-border-color, #e5e5e5);
    border-radius: var(--zib-radius, 8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.pat-lottery-grid-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 124, 186, 0.1) 0%, rgba(0, 90, 135, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.pat-lottery-grid-item:hover::before {
    opacity: 1;
}

.pat-lottery-grid-item img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--zib-radius, 8px);
    margin-bottom: 8px;
    border: 2px solid var(--zib-border-color, #e5e5e5);
    position: relative;
    z-index: 1;
}

.pat-lottery-grid-item span {
    font-size: 13px;
    color: var(--zib-text-color, #333);
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.pat-lottery-grid-item.active {
    background: linear-gradient(135deg, var(--zib-main-color, #007cba) 0%, #005a87 100%);
    border-color: var(--zib-main-color, #007cba);
    transform: scale(1.15);
    box-shadow: 0 8px 20px rgba(0, 124, 186, 0.4);
    z-index: 10;
}

.pat-lottery-grid-item.active::before {
    opacity: 0;
}

.pat-lottery-grid-item.active span {
    color: #fff;
    font-weight: bold;
    font-size: 14px;
}

.pat-lottery-grid-item.active img {
    border-color: #fff;
    transform: scale(1.1);
}

.pat-lottery-grid-controls {
    text-align: center;
    margin-top: 30px;
}

.pat-lottery-start-btn {
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--zib-radius, 8px);
    background: linear-gradient(135deg, var(--zib-main-color, #007cba) 0%, #005a87 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.pat-lottery-start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 124, 186, 0.4);
}

.pat-lottery-start-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 老虎机 - 子比主题原生风格 */
.pat-lottery-slot {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(135deg, rgba(0, 124, 186, 0.05) 0%, rgba(0, 90, 135, 0.05) 100%);
    border-radius: var(--zib-radius, 8px);
    border: 2px solid var(--zib-border-color, #e5e5e5);
}

.pat-lottery-slot-item {
    width: 140px;
    height: 180px;
    background: var(--zib-card-bg, #fff);
    border: 4px solid var(--zib-border-color, #e5e5e5);
    border-radius: var(--zib-radius, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.pat-lottery-slot-item:hover {
    border-color: var(--zib-main-color, #007cba);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
}

.pat-lottery-slot-item .slot-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px;
    color: var(--zib-text-color, #333);
    font-weight: bold;
    font-size: 18px;
    background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
}

.pat-lottery-slot-controls {
    text-align: center;
    margin-top: 30px;
}

.pat-lottery-slot-start {
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--zib-radius, 8px);
    background: linear-gradient(135deg, var(--zib-main-color, #007cba) 0%, #005a87 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.pat-lottery-slot-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 124, 186, 0.4);
}

.pat-lottery-slot-start:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 评论抽奖按钮 */
.pat-lottery-comment-draw-btn {
    background: var(--zib-main-color);
    color: #fff;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* 红包掉落容器 */
#pat-lottery-redpack-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.pat-lottery-redpack {
    position: absolute;
    width: 50px;
    height: 50px;
    background: url('redpack.png') no-repeat center;
    background-size: contain;
    animation: fall 3s linear;
}

@keyframes fall {
    from {
        top: -50px;
        opacity: 1;
    }
    to {
        top: 100%;
        opacity: 0;
    }
}

/* 版权信息 */
.pat-lottery-pro-copyright {
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: var(--zib-text-color);
    opacity: 0.6;
}

/* 响应式 */
@media (max-width: 768px) {
    .pat-lottery-wheel {
        width: 250px;
        height: 250px;
    }
    
    .pat-lottery-grid {
        max-width: 300px;
    }
}

/* 深色模式适配 */
.dark-theme .pat-lottery-container {
    background: var(--zib-card-bg, #1e1e1e);
}

.dark-theme .pat-lottery-grid-item {
    background: var(--zib-card-bg, #1e1e1e);
    border-color: var(--zib-border-color, #333);
}
