/* ============================================
   LUCKY WHEEL - RESPONSIVE CSS
   Mobile-first, production-ready styling
   ============================================ */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Pattern Overlay */
html::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 100px 100px, 150px 150px;
    background-position: 0 0, 50px 50px;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 20% 20%, rgba(255,255,255,0.15) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 80%, rgba(0,0,0,0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Container Utama */
.container {
    width: 100%;
    max-width: 700px;
    padding: 20px;
    text-align: center;
    animation: slideInDown 0.6s ease-out;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    color: white;
    margin-bottom: 30px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: headerGlow 3s ease-in-out infinite;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 8px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
    letter-spacing: 1px;
}

/* Canvas Wrapper - Responsif */
.canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 30px;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    max-width: 500px;
    max-height: 500px;
    filter: drop-shadow(0 20px 50px rgba(0, 0, 0, 0.5));
    animation: wheelAppear 0.8s ease-out;
    cursor: pointer;
    display: block;
}

/* Pointer/Panah - Di tengah atas wheel untuk menunjuk hadiah */
.pointer {
    position: absolute;
    top: -25px;
    left: calc(50% - 20px);
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 30px solid #FFD700;
    filter: drop-shadow(0 5px 15px rgba(255, 215, 0, 0.5)) drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
    animation: pointerPulse 0.6s ease-out, pointerGlow 2s ease-in-out infinite;
    z-index: 10;
}

/* Info Panel */
.info-panel {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 10px 15px;
    margin-bottom: 20px;
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    font-size: 0.85rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.info-panel:hover {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
}

.last-result {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.label {
    font-weight: 600;
    opacity: 0.8;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.label:hover {
    background: rgba(255, 215, 0, 0.2);
    opacity: 1;
    transform: scale(1.05);
}

.value {
    font-weight: 700;
    color: #FFD700;
    font-size: 0.95rem;
}

/* ============================================
   MODAL POPUP - HASIL WHEEL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    border-radius: 30px;
    padding: 45px 35px;
    max-width: 450px;
    width: 100%;
    position: relative;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.35),
        0 0 1px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: #000;
    transform: rotate(90deg);
}

.modal-body {
    text-align: center;
}

.modal-title {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 700;
}

/* Result Container */
.result-container {
    margin: 30px 0;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.result-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: zoomIn 0.5s ease-out;
}

.result-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    line-height: 1.3;
    animation: fadeInScale 0.5s ease-out;
    word-break: break-word;
}

/* Tombol Klaim */
.btn-claim {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-claim:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.6);
}

.btn-claim:active {
    transform: translateY(0);
}

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* ============================================
   ANIMASI & KEYFRAMES
   ============================================ */

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

@keyframes headerGlow {
    0%, 100% {
        text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
    50% {
        text-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.2);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wheelAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pointerPulse {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pointerGlow {
    0%, 100% {
        filter: drop-shadow(0 5px 15px rgba(255, 215, 0, 0.5)) drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 8px 20px rgba(255, 215, 0, 0.7)) drop-shadow(0 0 15px rgba(255, 215, 0, 0.5));
        transform: scale(1.05);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spinWheel {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .canvas-wrapper {
        max-width: 400px;
    }

    .modal-content {
        padding: 30px 20px;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .result-text {
        font-size: 2rem;
    }

    .btn-claim {
        padding: 12px 30px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .canvas-wrapper {
        max-width: 300px;
        margin-bottom: 20px;
    }

    .modal-content {
        padding: 25px 15px;
        border-radius: 20px;
    }

    .modal-title {
        font-size: 1.3rem;
    }

    .result-text {
        font-size: 1.5rem;
    }

    .result-image {
        max-height: 200px;
    }

    .btn-claim {
        padding: 10px 25px;
        font-size: 0.9rem;
    }

    .info-panel {
        font-size: 0.85rem;
        padding: 12px 15px;
    }
}

/* ============================================
   LOADING & DISABLED STATES
   ============================================ */

.loading {
    opacity: 0.6;
    pointer-events: none;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white;
    }

    .modal {
        display: none !important;
    }
}
