/**
 * Styles pour la roulette côté public
 */

/* Container principal */
.cj-roulette-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
    min-height: 600px;
}

/* En-tête */
.roulette-header {
    margin-bottom: 30px;
}

.roulette-title {
    font-size: 2.2em;
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.roulette-subtitle {
    font-size: 1.1em;
    color: #7f8c8d;
    margin: 0;
    line-height: 1.5;
}

/* Zone de jeu */
.roulette-game {
    margin: 40px 0;
    position: relative;
    overflow: visible;
    min-height: 400px;
}

.roulette-wrapper {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto 30px;
    overflow: visible;
}

/* Roue CSS dynamique avec conic-gradient */
.roulette {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    user-select: none;
    overflow: hidden;
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.roulette.spinning {
    pointer-events: none;
    transition: none;
}

/* Flèche */
.arrow {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 30px solid #391F1E;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transform-origin: 50% 100%;
    transition: transform 0.1s ease-out;
}

/* Segments */
.segment {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.segment-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    font-weight: bold;
    font-size: 28px;
    text-align: center;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 2;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    backdrop-filter: blur(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.segment-divider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 50%;
    background: #391F1E;
    transform-origin: 0 100%;
    z-index: 15;
    margin-left: -1px;
}

/* Clou de butée au-dessus de chaque séparateur */
.segment-stud {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #391F1E;
    border-radius: 50%;
    transform-origin: 6px 6px;
    z-index: 12;
    margin-left: -6px;
    margin-top: -6px;
    border: 2px solid #555;
    animation: pegGlow 2s ease-in-out infinite alternate;
}

@keyframes pegGlow {
    0% { box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 5px rgba(57, 31, 30, 0.5); }
    100% { box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 15px rgba(57, 31, 30, 0.8); }
}

/* Centre de la roue */
.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: #ffffff;
    border-radius: 50%;
    border: 8px solid #391F1E;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
}

.center-logo {
    text-align: center;
}

.center-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: #391F1E;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Labels des récompenses */
.reward-label {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    transform-origin: center;
    z-index: 5;
    pointer-events: none;
}

.reward-label .reward-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
    animation: iconFloat 3s ease-in-out infinite;
}

.reward-label .reward-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    line-height: 1.2;
    max-width: 70px;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

.reward-label .reward-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    line-height: 1.2;
    max-width: 70px;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    word-wrap: break-word;
}

/* Animation de la roue au survol */
.roulette-wheel:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* Animation de rotation fluide */
.roulette-wheel.spinning {
    animation: spinWheel 4s cubic-bezier(0.17, 0.67, 0.12, 0.99) forwards;
}

@keyframes spinWheel {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(1800deg); }
}

/* Effet de brillance sur les segments */
.roulette-wheel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.1) 0%, transparent 50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

/* Animation des clous au survol */
.wheel-peg:hover .peg-inner {
    animation: pegPulse 0.5s ease-in-out;
    transform: scale(1.2);
}

@keyframes pegPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.2); }
}

/* Affichage du gain précédent */
.previous-win-display {
    margin: 50px auto;
    padding: 40px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 20px;
    border: 3px solid #dee2e6;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    max-width: 600px;
    text-align: center;
}

.previous-win-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.previous-win-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.previous-win-title {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: 700;
}

.previous-win-message {
    font-size: 1.4rem;
    color: #495057;
    margin-bottom: 25px;
    font-weight: 600;
}

.previous-win-code {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px dashed #28a745;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.previous-win-code .promo-code {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #28a745;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.copy-code-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.copy-code-btn:hover {
    background: #218838;
}

.previous-win-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.previous-win-actions .button {
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.previous-win-actions .button-primary {
    background: var(--primary-gradient);
    color: white;
}

.previous-win-actions .button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(236, 78, 32, 0.3);
}

.previous-win-actions .button-secondary {
    background: #6c757d;
    color: white;
}

.previous-win-actions .button-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Flèche indicatrice */
.roulette-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: 40px solid #391F1E;
    z-index: 20;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
    pointer-events: none;
}

/* Bouton de lancement */
.roulette-spin-button {
    background: linear-gradient(135deg, #EC4E20, #391F1E);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    margin: 30px auto 20px;
    display: block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(236, 78, 32, 0.3);
    position: relative;
    overflow: hidden;
    min-width: 200px;
    z-index: 100;
    clear: both;
}

.roulette-spin-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.roulette-spin-button:active {
    transform: translateY(0);
}

/* Bouton désactivé */
.roulette-spin-button.disabled {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(149, 165, 166, 0.3);
}

.roulette-spin-button.disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(149, 165, 166, 0.3);
}

/* Message d'information sous le bouton */
.roulette-info-message {
    margin-top: 15px;
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6c757d;
}

.roulette-info-message p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
}

/* Spinner du bouton */
.roulette-spin-button .button-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
}

/* Spinner */
.spinner {
    animation: rotate 1s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}



/* Zone de résultat */
.roulette-result {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    color: #2c3e50;
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
    position: absolute;
    top: 0;
    left: 0;
    width: 400px;
    height: 400px;
    opacity: 1;
    transform: scale(0.8) translateY(20px);
    transition: all 0.6s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.roulette-result.show {
    width: 100% !important;
    left: 0 !important;
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
    box-sizing: border-box !important;
}

.result-content {
    text-align: center;
    width: 100%;
    margin: 0 auto;
}

.result-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
    animation: bounce 0.6s ease-out;
}

.result-title {
    font-size: 1.6em;
    margin: 0 0 12px 0;
    font-weight: 700;
    color: #2c3e50;
}

.result-message {
    font-size: 1.1em;
    margin: 12px 0;
    line-height: 1.4;
    color: #495057;
}

.result-code {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #dee2e6;
}



.promo-code {
    font-family: 'Courier New', monospace;
    font-size: 1.3em;
    font-weight: bold;
    background: #ffffff;
    color: #495057;
    padding: 10px 16px;
    border-radius: 8px;
    letter-spacing: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #dee2e6;
}

.copy-code-btn {
    background: #ffffff;
    border: 2px solid #dee2e6;
    color: #6c757d;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-code-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.copy-code-btn svg {
    width: 16px;
    height: 16px;
}

/* Styles supprimés car result-actions n'existe plus */

/* Zone d'erreur */
.roulette-error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    animation: slideDown 0.5s ease-out;
}

.error-content {
    text-align: center;
}

.error-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.error-title {
    font-size: 2em;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.error-message {
    font-size: 1.2em;
    margin: 15px 0;
    line-height: 1.4;
}

.retry-button {
    background: white;
    color: #e74c3c;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.retry-button:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
}



/* Token utilisé */
.used-token {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.previous-result {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
}

.additional-info {
    display: grid;
    gap: 20px;
    margin: 30px 0;
}

.info-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.info-box h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.info-box ol, .info-box ul {
    margin: 0;
    padding-left: 20px;
}

.info-box li {
    margin: 8px 0;
    color: #5a6c7d;
}

.suggestions {
    margin: 30px 0;
}

.featured-products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.featured-product {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.featured-product:hover {
    transform: translateY(-2px);
}

.featured-product a {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 15px;
}

.featured-product h5 {
    margin: 10px 0 5px 0;
    font-size: 1em;
    color: #2c3e50;
}

.featured-product .price {
    color: #e74c3c;
    font-weight: 600;
}

/* Pied de page */
.roulette-footer {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #ecf0f1;
    color: #7f8c8d;
    font-size: 0.9em;
}

.disclaimer {
    margin: 0 0 10px 0;
    font-style: italic;
}

.powered-by {
    margin: 0;
}

.thank-you {
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: 600;
    margin: 0 0 10px 0;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

/* Responsive */
@media (max-width: 768px) {
    .cj-roulette-container {
        padding: 15px;
        margin: 10px;
        max-width: 100%;
        margin-top: 100px;
    }
    
    .roulette-title {
        font-size: 1.8em;
    }
    
    .roulette-subtitle {
        font-size: 1em;
    }
    
    .roulette-wrapper {
        width: 300px;
        height: 300px;
        margin: 0 auto 20px;
    }
    
    .segment-text {
        font-size: 20px;
        width: 40px;
        height: 40px;
        line-height: 40px;
    }
    
    .arrow {
        top: -40px;
        border-left: 12px solid transparent;
        border-right: 12px solid transparent;
        border-bottom: 25px solid #391F1E;
    }
    
    #rouletteCanvas {
        max-width: 100%;
        height: auto;
    }
    
    .roulette-spin-button {
        font-size: 1.1em;
        padding: 12px 25px;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .result-actions .button {
        width: 100%;
        max-width: 250px;
    }
    
    .result-code {
        flex-direction: column;
        gap: 15px;
    }
    
    .promo-code {
        font-size: 1.2em;
    }
    
    .additional-info {
        grid-template-columns: 1fr;
    }
    
    .featured-products {
        grid-template-columns: 1fr;
    }
}

/* Styles pour très petits écrans (mobile) */
@media only screen and (max-width: 767px) {
    .content_wrapper .section_wrapper, .container, .four.columns .widget-area {
        max-width: 570px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .cj-roulette-container {
        padding: 10px;
        margin: 5px;
        border-radius: 8px;
        min-height: 500px;
        margin-top: 100px;
    }
    
    .roulette-wrapper {
        width: 280px;
        height: 280px;
        margin: 0 auto 15px;
    }
    
    .roulette-title {
        font-size: 1.6em;
        margin-bottom: 8px;
    }
    
    .roulette-subtitle {
        font-size: 0.9em;
    }
    
    .segment-text {
        font-size: 18px;
        width: 35px;
        height: 35px;
        line-height: 35px;
    }
    
    .arrow {
        top: -35px;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-bottom: 20px solid #391F1E;
    }
    
    .roulette-game {
        margin: 20px 0;
        min-height: 320px;
    }
}

/* Styles pour écrans très petits (smartphones) */
@media only screen and (max-width: 480px) {
    .cj-roulette-container {
        padding: 8px;
        margin: 2px;
        border-radius: 6px;
        min-height: 450px;
        margin-top: 100px;
    }
    
    .roulette-wrapper {
        width: 100%;
        height: 100%;
        margin: 0 auto 10px;
        aspect-ratio: 1 / 1;
    }
    
    .roulette-title {
        font-size: 1.4em;
        margin-bottom: 6px;
    }
    
    .roulette-subtitle {
        font-size: 0.85em;
    }
    
    .segment-text {
        font-size: 16px;
        width: 30px;
        height: 30px;
        line-height: 30px;
    }
    
    .arrow {
        top: -30px;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-bottom: 18px solid #391F1E;
    }
    
    .roulette-game {
        margin: 15px 0;
        min-height: 280px;
    }
    
    .roulette-spin-button {
        font-size: 1em;
        padding: 10px 20px;
    }
}

/* États spéciaux */
.cj-roulette-container.loading {
    opacity: 0.8;
    pointer-events: none;
}

.cj-roulette-container.completed .roulette-game {
    opacity: 0.5;
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    .spinner,
    .result-icon,
    .roulette-result,
    .roulette-error {
        animation: none;
    }
    
    .roulette-spin-button,
    .featured-product,
    .button {
        transition: none;
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .cj-roulette-container {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .roulette-title {
        color: #ecf0f1;
    }
    
    .roulette-subtitle {
        color: #bdc3c7;
    }
    
    .roulette-rewards-info {
        background: #34495e;
    }
    
    .reward-item {
        background: #3c5a78;
        color: #ecf0f1;
    }
    
    .info-box {
        background: #34495e;
        color: #ecf0f1;
    }
    
    .featured-product {
        background: #34495e;
    }
}

/* Animations pour la roue améliorée */
@keyframes arrowSwing {
    0% { transform: translateX(-50%) rotate(180deg) rotate(0deg); }
    20% { transform: translateX(-50%) rotate(180deg) rotate(-8deg); }
    100% { transform: translateX(-50%) rotate(180deg) rotate(0deg); }
}

@keyframes rouletteJolt {
    0% { transform: rotate(var(--current-rotation)); }
    30% { transform: rotate(calc(var(--current-rotation) - var(--jolt-intensity, 1.5deg))); }
    100% { transform: rotate(var(--current-rotation)); }
}

/* Animation de disparition de la roue */
@keyframes rouletteDisappear {
    0% {
        transform: scale(1) rotate(var(--current-rotation));
        opacity: 1;
    }
    100% {
        transform: scale(0.8) rotate(var(--current-rotation));
        opacity: 0;
    }
}

@keyframes arrowDisappear {
    0% {
        transform: translateX(-50%) rotate(180deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) rotate(180deg) scale(0.8);
        opacity: 0;
    }
}

.arrow.swinging {
    animation: arrowSwing 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.roulette.jolting {
    animation: rouletteJolt 0.08s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Classes pour l'animation de disparition */
.roulette.disappearing {
    animation: rouletteDisappear 0.8s ease-in-out forwards;
}

.arrow.disappearing {
    animation: arrowDisappear 0.8s ease-in-out forwards;
}

/* Transition fluide pour la zone de résultat */
.result-card {
    animation: resultAppear 0.6s ease-out;
}

@keyframes resultAppear {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
