/**
 * WP Lottery System - Frontend Styles (Wheel/Roulette Version)
 *
 * @package WP_Lottery_System
 * @since 1.0.0
 */

/* ========== Container ========== */
.wp-lottery-container {
    max-width: 500px;
    margin: 30px auto;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #ffffff;
    box-sizing: border-box;
}

.wp-lottery-container * {
    box-sizing: border-box;
}

.wp-lottery-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    padding: 25px 30px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wp-lottery-title {
    margin: 0;
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.wp-lottery-body {
    padding: 30px 20px;
}

/* ========== Wheel Wrapper ========== */
.wp-lottery-wheel-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto 25px;
}

/* ========== Pointer (top triangle indicator) ========== */
.wp-lottery-wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 32px solid #ff4757;
    z-index: 30;
    filter: drop-shadow(0 3px 6px rgba(255, 71, 87, 0.6));
}

.wp-lottery-wheel-pointer::after {
    content: '';
    position: absolute;
    top: -42px;
    left: -10px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.5);
}

/* ========== Decorative Dots Ring ========== */
.wp-lottery-wheel-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5;
}

.wp-lottery-wheel-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.9);
    top: 50%;
    left: 50%;
    transform-origin: center;
}

/* ========== The Rotating Wheel ========== */
.wp-lottery-wheel {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.1),
        0 0 40px rgba(102, 126, 234, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
    transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    overflow: hidden;
    background: #1a1a2e;
    z-index: 10;
}

/* Sector content items (rotated to match each sector center) */
.wp-lottery-wheel-sector-item {
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(0deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 20px;
    pointer-events: none;
}

.wp-lottery-wheel-sector-inner {
    transform: rotate(180deg);
    text-align: center;
    max-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wp-lottery-wheel-sector-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin: 0 auto 5px;
    display: block;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px;
}

.wp-lottery-wheel-sector-text {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    word-break: break-all;
    line-height: 1.3;
    display: block;
}

/* ========== Center Start Button ========== */
.wp-lottery-wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    z-index: 20;
    border: 4px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        0 4px 15px rgba(255, 107, 107, 0.5),
        inset 0 2px 6px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    user-select: none;
    line-height: 1.3;
    padding: 0;
    font-family: inherit;
}

.wp-lottery-wheel-center:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow:
        0 6px 22px rgba(255, 107, 107, 0.7),
        inset 0 2px 6px rgba(255, 255, 255, 0.3);
}

.wp-lottery-wheel-center:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.wp-lottery-wheel-center:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translate(-50%, -50%);
    box-shadow: none;
}

/* ========== Wheel Loading & Error States ========== */
.wp-lottery-wheel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.wp-lottery-wheel-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ff6b6b;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* ========== Chances Bar Section ========== */
.wp-lottery-chances-bar-section {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.wp-lottery-chances-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    text-align: center;
}

.wp-lottery-chances-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.wp-lottery-chances-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ========== Input Section ========== */
.wp-lottery-input-section {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wp-lottery-description {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 15px;
    line-height: 1.6;
    text-align: center;
    font-size: 14px;
}

.wp-lottery-form-group {
    margin-bottom: 15px;
}

.wp-lottery-form-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 14px;
}

.wp-lottery-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    outline: none;
    color: #ffffff;
    font-family: inherit;
}

.wp-lottery-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.wp-lottery-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* ========== Buttons ========== */
.wp-lottery-btn {
    display: inline-block;
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: inherit;
}

.wp-lottery-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.wp-lottery-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.wp-lottery-btn-primary:active {
    transform: translateY(0);
}

.wp-lottery-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wp-lottery-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.wp-lottery-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.wp-lottery-btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wp-lottery-btn-outline {
    background: transparent;
    color: #a8b4ff;
    border: 2px solid rgba(102, 126, 234, 0.5);
}

.wp-lottery-btn-outline:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    color: #ffffff;
}

.wp-lottery-actions {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

/* ========== Message ========== */
.wp-lottery-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    display: none;
}

.wp-lottery-message.error {
    display: block;
    background: rgba(255, 71, 87, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.wp-lottery-message.success {
    display: block;
    background: rgba(46, 213, 115, 0.15);
    color: #2ed573;
    border: 1px solid rgba(46, 213, 115, 0.3);
}

/* ========== Result Modal ========== */
.wp-lottery-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.wp-lottery-result-overlay.active {
    opacity: 1;
    visibility: visible;
}

.wp-lottery-result-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.wp-lottery-result-overlay.active .wp-lottery-result-modal {
    transform: scale(1) translateY(0);
}

.wp-lottery-result {
    color: #ffffff;
}

.wp-lottery-result-header {
    margin-bottom: 20px;
}

.wp-lottery-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.wp-lottery-badge-success {
    background: rgba(46, 213, 115, 0.2);
    color: #2ed573;
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.wp-lottery-badge-final {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa502;
    border: 1px solid rgba(255, 165, 0, 0.3);
}

.wp-lottery-prize-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    margin-bottom: 20px;
}

.wp-lottery-prize-image {
    margin-bottom: 15px;
}

.wp-lottery-prize-image img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
    object-fit: contain;
}

.wp-lottery-prize-level {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
}

.wp-lottery-prize-name {
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 5px;
    word-break: break-all;
}

.wp-lottery-prize-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.wp-lottery-current-draw {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.wp-lottery-current-label {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.wp-lottery-current-prize {
    font-weight: 600;
    color: #ffd700;
}

.wp-lottery-chances-info {
    margin-bottom: 10px;
}

.wp-lottery-result-close {
    margin-top: 15px;
    text-align: center;
}

.wp-lottery-result-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    cursor: pointer;
    padding: 5px 15px;
    transition: color 0.3s ease;
    font-family: inherit;
}

.wp-lottery-result-close-btn:hover {
    color: rgba(255, 255, 255, 0.85);
}

/* ========== Spinner Fallback ========== */
.wp-lottery-drawing {
    text-align: center;
    padding: 30px 0;
}

.wp-lottery-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: wp-lottery-spin 1s linear infinite;
}

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

/* ========== Responsive (Mobile) ========== */
@media (max-width: 480px) {
    .wp-lottery-container {
        margin: 15px;
        border-radius: 12px;
    }

    .wp-lottery-header {
        padding: 20px;
    }

    .wp-lottery-title {
        font-size: 20px;
    }

    .wp-lottery-body {
        padding: 20px 15px;
    }

    .wp-lottery-wheel-wrapper {
        width: 260px;
        height: 260px;
    }

    .wp-lottery-wheel-center {
        width: 72px;
        height: 72px;
        font-size: 14px;
        border-width: 3px;
    }

    .wp-lottery-wheel-sector-text {
        font-size: 10px;
    }

    .wp-lottery-wheel-sector-img {
        width: 24px;
        height: 24px;
    }

    .wp-lottery-wheel-sector-item {
        padding-top: 16px;
    }

    .wp-lottery-wheel-sector-inner {
        max-width: 75px;
    }

    .wp-lottery-wheel-pointer {
        border-left-width: 16px;
        border-right-width: 16px;
        border-top-width: 26px;
        top: -8px;
    }

    .wp-lottery-wheel-pointer::after {
        top: -34px;
        left: -8px;
        width: 16px;
        height: 16px;
    }

    .wp-lottery-prize-name {
        font-size: 18px;
    }

    .wp-lottery-result-modal {
        padding: 20px;
        border-radius: 12px;
    }

    .wp-lottery-input-section {
        padding: 15px;
    }

    .wp-lottery-chances-bar-section {
        padding: 12px 15px;
    }
}

@media (max-width: 360px) {
    .wp-lottery-wheel-wrapper {
        width: 220px;
        height: 220px;
    }

    .wp-lottery-wheel-center {
        width: 60px;
        height: 60px;
        font-size: 12px;
    }

    .wp-lottery-wheel-sector-text {
        font-size: 9px;
    }

    .wp-lottery-wheel-sector-img {
        width: 20px;
        height: 20px;
    }

    .wp-lottery-wheel-sector-item {
        padding-top: 14px;
    }

    .wp-lottery-wheel-sector-inner {
        max-width: 60px;
    }
}


/* === 全部中奖记录列表 === */
.wp-lottery-all-records {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.wp-lottery-all-records-title {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-align: center;
}

.wp-lottery-records-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wp-lottery-record-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.wp-lottery-record-item.is-best {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 193, 7, 0.2));
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.wp-lottery-record-index {
    flex-shrink: 0;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 12px;
}

.wp-lottery-record-level {
    flex-shrink: 0;
    font-weight: 600;
    color: #ffd700;
    font-size: 12px;
}

.wp-lottery-record-name {
    flex: 1;
    color: #fff;
    font-weight: 500;
}

.wp-lottery-record-best-tag {
    flex-shrink: 0;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ff6b6b, #ffa502);
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* 后台验证码列表中得奖品列 */
.wp-lottery-best-prize {
    color: #d63638;
    font-weight: 600;
}

.column-prizes {
    max-width: 200px;
}
