/* Dido Games Widget - Mobile First Design */
/* All styles are scoped to .dido-games-container to prevent conflicts with theme */

.dido-games-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 15px;
    font-family: var(--font-family, inherit);
    font-size: var(--font-size-base, inherit);
    font-weight: var(--font-weight, 400);
    color: var(--text-primary-color, #1f2937);
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    isolation: isolate; /* Create new stacking context */
    position: relative;
    z-index: 1;
    border: var(--border-width, 0) solid var(--border-color, #e5e7eb);
    border-radius: var(--border-radius, 12px);
}

/* Tabs */
.dido-games-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 5px;
}

.dido-games-tabs::-webkit-scrollbar {
    display: none;
}

.dido-tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    background: var(--tab-bg-color, #f3f4f6);
    border: var(--border-width, 0) solid var(--border-color, transparent);
    border-radius: var(--tab-border-radius, var(--border-radius, 12px));
    color: var(--tab-text-color, #6b7280);
    font-size: 14px;
    font-weight: var(--font-weight, 600);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.dido-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.dido-tab-btn:hover::before {
    left: 100%;
}

.dido-tab-btn.active {
    background: var(--tab-active-bg-color, var(--primary-color, #6366f1));
    color: var(--tab-active-text-color, #ffffff);
    border-color: var(--tab-active-bg-color, var(--primary-color, #6366f1));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.dido-tab-content {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

.dido-tab-content.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Questions Game */
.dido-questions-game {
    background: white;
    border: var(--border-width, 0) solid var(--border-color, #e5e7eb);
    border-radius: var(--border-radius, 12px);
    padding: 25px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.dido-questions-progress {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 10px;
    margin-bottom: 25px;
    overflow: hidden;
}

.dido-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dido-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.dido-question-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
    line-height: 1.6;
}

.dido-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dido-option {
    padding: 16px 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: var(--border-radius, 12px);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    position: relative;
    overflow: hidden;
}

.dido-option::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    transition: all 0.3s;
}

.dido-option:hover {
    background: #f3f4f6;
    border-color: var(--primary-color, #6366f1);
    transform: translateX(-5px);
}

.dido-option.selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color, #6366f1);
    color: var(--primary-color, #6366f1);
}

.dido-option.selected::before {
    border-color: var(--primary-color, #6366f1);
    background: var(--primary-color, #6366f1);
}

.dido-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.dido-option.correct {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color, #10b981);
    animation: pulse 0.5s;
}

.dido-option.wrong {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color, #ef4444);
    animation: shake 0.5s;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Result Container */
.dido-result-container,
.dido-luck-result,
.dido-instagram-result {
    text-align: center;
    padding: 30px 20px;
    animation: fadeInScale 0.5s ease-out;
}

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

.dido-result-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.dido-result-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #1f2937;
}

.dido-result-message {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 25px;
    line-height: 1.6;
}

.dido-discount-code {
    background: #f9fafb;
    border-radius: var(--border-radius, 12px);
    padding: 20px;
    margin: 25px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dido-code-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 2px;
    background: white;
    border: 2px dashed var(--primary-color, #6366f1);
    border-radius: var(--border-radius, 12px);
    color: var(--primary-color, #6366f1);
    direction: ltr;
}

.dido-copy-btn {
    padding: 12px 24px;
    background: var(--button-bg-color, var(--primary-color, #6366f1));
    color: var(--button-text-color, #ffffff);
    border: var(--border-width, 0) solid var(--border-color, transparent);
    border-radius: var(--button-border-radius, var(--border-radius, 12px));
    font-size: 15px;
    font-weight: var(--font-weight, 600);
    cursor: pointer;
    transition: all 0.3s;
}

.dido-copy-btn:hover {
    background: var(--button-hover-bg-color, var(--secondary-color, #8b5cf6));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

.dido-restart-btn {
    padding: 14px 32px;
    background: var(--button-bg-color, var(--primary-color, #6366f1));
    color: var(--button-text-color, #ffffff);
    border: var(--border-width, 0) solid var(--border-color, transparent);
    border-radius: var(--button-border-radius, var(--border-radius, 12px));
    font-size: 16px;
    font-weight: var(--font-weight, 600);
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
}

.dido-restart-btn:hover {
    background: var(--button-hover-bg-color, var(--secondary-color, #8b5cf6));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* Luck Box Game */
.dido-luck-box-game {
    background: white;
    border: var(--border-width, 0) solid var(--border-color, #e5e7eb);
    border-radius: var(--border-radius, 12px);
    padding: 25px 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.dido-game-title {
    text-align: center;
    font-size: 20px;
    font-weight: var(--font-weight, 700);
    color: var(--text-primary-color, #1f2937);
    margin-bottom: 25px;
}

.dido-boxes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.dido-box {
    aspect-ratio: 1;
    position: relative;
    perspective: 1000px;
    cursor: pointer;
}

.dido-box.flipped {
    pointer-events: none;
}

.dido-box-front,
.dido-box-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius, 12px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.dido-box-front {
    background: linear-gradient(135deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
    color: white;
}

.dido-box-front span {
    font-size: 36px;
    font-weight: 700;
}

.dido-box-back {
    background: white;
    transform: rotateY(180deg);
    border: 3px solid;
}

.dido-box.flipped .dido-box-front {
    transform: rotateY(180deg);
}

.dido-box.flipped .dido-box-back {
    transform: rotateY(0deg);
}

.dido-box-back.void {
    border-color: #9ca3af;
    color: #6b7280;
}

.dido-box-back.void::before {
    content: '❌';
    font-size: 40px;
}

.dido-box-back.discount-5 {
    border-color: var(--success-color, #10b981);
    color: var(--success-color, #10b981);
}

.dido-box-back.discount-5::before {
    content: '5%';
    font-size: 32px;
    font-weight: 700;
}

.dido-box-back.discount-10 {
    border-color: var(--success-color, #10b981);
    color: var(--success-color, #10b981);
}

.dido-box-back.discount-10::before {
    content: '10%';
    font-size: 32px;
    font-weight: 700;
}

.dido-box-back.discount-15 {
    border-color: var(--success-color, #10b981);
    color: var(--success-color, #10b981);
}

.dido-box-back.discount-15::before {
    content: '15%';
    font-size: 32px;
    font-weight: 700;
}

.dido-box:hover .dido-box-front {
    transform: scale(1.05) rotateY(0deg);
}

/* Instagram Game */
.dido-instagram-game {
    background: white;
    border: var(--border-width, 0) solid var(--border-color, #e5e7eb);
    border-radius: var(--border-radius, 12px);
    padding: 30px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.dido-instagram-step {
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.dido-instagram-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dido-instagram-icon img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: var(--border-radius, 12px);
}

.dido-instagram-icon i,
.dido-instagram-icon svg {
    font-size: 64px;
    width: 64px;
    height: 64px;
}

.dido-instagram-step h3 {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 15px;
}

.dido-instagram-step p {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 25px;
    line-height: 1.6;
}

.dido-instagram-link {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, #E1306C, #C13584);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius, 12px);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(225, 48, 108, 0.3);
}

.dido-instagram-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 48, 108, 0.4);
}

.dido-next-step-btn,
.dido-verify-btn {
    padding: 14px 32px;
    background: var(--button-bg-color, var(--primary-color, #6366f1));
    color: var(--button-text-color, #ffffff);
    border: var(--border-width, 0) solid var(--border-color, transparent);
    border-radius: var(--button-border-radius, var(--border-radius, 12px));
    font-size: 16px;
    font-weight: var(--font-weight, 600);
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    max-width: 300px;
}

.dido-next-step-btn:hover,
.dido-verify-btn:hover {
    background: var(--button-hover-bg-color, var(--secondary-color, #8b5cf6));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.dido-code-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 25px 0;
}

.dido-code-input-field {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    text-align: center;
    border: 2px solid #e5e7eb;
    border-radius: var(--border-radius, 12px);
    transition: all 0.3s;
    direction: ltr;
    letter-spacing: 2px;
    font-weight: 600;
}

.dido-code-input-field:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Loading State */
.dido-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive - Tablet and Desktop */
@media (min-width: 768px) {
    .dido-games-container {
        max-width: 600px;
        padding: 30px 25px;
    }
    
    .dido-boxes-grid {
        gap: 16px;
    }
    
    .dido-code-input-container {
        flex-direction: row;
    }
    
    .dido-code-input-field {
        flex: 1;
    }
    
    .dido-verify-btn {
        width: auto;
        min-width: 120px;
    }
}

@media (min-width: 1024px) {
    .dido-games-container {
        max-width: 700px;
    }
}

/* RTL Support */
[dir="rtl"] .dido-games-container {
    direction: rtl;
}

[dir="ltr"] .dido-games-container {
    direction: ltr;
}

/* Spin Wheel Game */
.dido-spin-wheel-game {
    background: white;
    border: var(--border-width, 0) solid var(--border-color, #e5e7eb);
    border-radius: var(--border-radius, 12px);
    padding: 25px 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.dido-wheel-container {
    margin: 30px 0;
}

.dido-wheel-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto 30px;
}

.dido-wheel-outer {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    padding: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.dido-wheel-lights {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

.dido-wheel-lights::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #fbbf24;
    border-radius: 50%;
    box-shadow: 
        0 0 10px #fbbf24,
        0 0 20px #fbbf24,
        0 0 30px #fbbf24;
    animation: pulse-light 2s infinite;
}

@keyframes pulse-light {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateX(-50%) scale(1.2); }
}

.dido-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: conic-gradient(
        from -90deg,
        #9ca3af 0deg 45deg,
        #9ca3af 45deg 90deg,
        #9ca3af 90deg 135deg,
        #fbbf24 135deg 180deg,
        #9ca3af 180deg 225deg,
        #fbbf24 225deg 270deg,
        #9ca3af 270deg 315deg,
        #fbbf24 315deg 360deg
    );
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    transform: rotate(0deg);
    z-index: 2;
}

.dido-wheel.spinning {
    pointer-events: none;
}

.dido-wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    left: 50%;
    top: 0;
    transform-origin: 0 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 25px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 10;
}

.dido-segment-text {
    font-weight: 700;
    font-size: 18px;
    color: #1f2937;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
    transform: rotate(22.5deg);
    white-space: nowrap;
    position: relative;
    z-index: 20;
    pointer-events: none;
}

.dido-wheel-segment[data-value="void"] .dido-segment-text {
    color: #4b5563;
}

.dido-wheel-segment[data-value="5"] .dido-segment-text,
.dido-wheel-segment[data-value="10"] .dido-segment-text,
.dido-wheel-segment[data-value="15"] .dido-segment-text {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* 8 segments - 45 degrees each, starting from top */
.dido-wheel-segment[data-index="0"] {
    transform: rotate(0deg);
}

.dido-wheel-segment[data-index="1"] {
    transform: rotate(45deg);
}

.dido-wheel-segment[data-index="2"] {
    transform: rotate(90deg);
}

.dido-wheel-segment[data-index="3"] {
    transform: rotate(135deg);
}

.dido-wheel-segment[data-index="4"] {
    transform: rotate(180deg);
}

.dido-wheel-segment[data-index="5"] {
    transform: rotate(225deg);
}

.dido-wheel-segment[data-index="6"] {
    transform: rotate(270deg);
}

.dido-wheel-segment[data-index="7"] {
    transform: rotate(315deg);
}

.dido-wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    transition: all 0.3s;
}

.dido-wheel-center:hover {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.dido-center-button {
    font-weight: var(--font-weight, 700);
    font-size: 14px;
    color: var(--button-text-color, #fff);
    text-align: center;
    line-height: 1.2;
    border-radius: var(--button-border-radius, var(--border-radius, 50%));
}

.dido-wheel-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 35px solid #1f2937;
    z-index: 15;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

.dido-wheel-pointer::after {
    content: '';
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255,255,255,0.8);
}

.dido-spin-btn {
    display: none; /* Hide bottom button, use center button instead */
}

.dido-wheel-result {
    text-align: center;
    padding: 30px 20px;
    animation: fadeInScale 0.5s ease-out;
}

/* Responsive Wheel */
@media (max-width: 480px) {
    .dido-wheel-wrapper {
        width: 280px;
        height: 280px;
    }
    
    .dido-wheel-center {
        width: 70px;
        height: 70px;
    }
    
    .dido-center-button {
        font-size: 12px;
    }
    
    .dido-segment-text {
        font-size: 16px;
    }
}

