/**
 * Estilos para la Bola de Lotería de Torifa - Rediseñado
 * Shortcode: [torifa_lottery_ball]
 */

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */
.torifa-lottery-ball-container {
    text-align: center;
    padding: 30px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 600px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.torifa-lottery-header {
    margin-bottom: 30px;
}

.torifa-lottery-title {
    font-size: 1.8em;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 15px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.torifa-lottery-counter {
    font-size: 1.1em;
    color: #7f8c8d;
    margin: 0;
}

.torifa-selected-count {
    color: #3498db;
    font-size: 1.3em;
    font-weight: 700;
}

.torifa-unlimited {
    color: #95a5a6;
    font-size: 0.9em;
    font-weight: 500;
    font-style: italic;
}

/* ============================================
   BOLA DE LOTERÍA
   ============================================ */
.torifa-lottery-ball-wrapper {
    position: relative;
    display: inline-block;
    margin: 30px 0;
    perspective: 1000px;
}

.torifa-lottery-ball {
    position: relative;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(52, 152, 219, 0.45);
    border: 4px solid #fff;
    transform-style: preserve-3d;
    overflow: hidden;
}

.torifa-lottery-ball:hover:not(.spinning) {
    transform: scale(1.08);
    box-shadow: 0 15px 40px rgba(52, 152, 219, 0.6);
}

/* Tamaños */
.torifa-ball-small { 
    width: 100px; 
    height: 100px; 
}

.torifa-ball-medium { 
    width: 140px; 
    height: 140px; 
}

.torifa-ball-large { 
    width: 180px; 
    height: 180px; 
}

.torifa-ball-xlarge { 
    width: 220px; 
    height: 220px; 
}

/* Número dentro de la bola */
.torifa-ball-number {
    font-size: 2.5em;
    font-weight: 900;
    color: #000;
    z-index: 2;
    position: relative;
    text-shadow: 0 3px 6px rgba(0,0,0,0.4);
    user-select: none;
    transition: all 0.2s ease;
}

.torifa-ball-small .torifa-ball-number { 
    font-size: 2em; 
}

.torifa-ball-medium .torifa-ball-number { 
    font-size: 2.5em; 
}

.torifa-ball-large .torifa-ball-number { 
    font-size: 3.5em; 
}

.torifa-ball-xlarge .torifa-ball-number { 
    font-size: 4.5em; 
}

/* Efecto de brillo */
.torifa-ball-shine {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 35%;
    height: 35%;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.3), transparent);
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    animation: torifaShineMove 3s ease-in-out infinite;
}

@keyframes torifaShineMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(20%, 20%) rotate(180deg); }
}

/* Partículas */
.torifa-ball-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   ANIMACIONES
   ============================================ */
.torifa-lottery-ball.spinning {
    animation: torifaSpin 0.08s linear infinite;
}

.torifa-lottery-ball.bouncing {
    animation: torifaBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.torifa-lottery-ball.pulsing {
    animation: torifaPulse 1.5s ease-in-out infinite;
}

.torifa-lottery-ball.glowing {
    box-shadow: 0 0 30px currentColor, 0 0 60px currentColor, 0 0 90px currentColor;
    animation: torifaGlow 1.5s ease-in-out infinite alternate;
}

.torifa-lottery-ball.winner {
    animation: torifaWinner 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes torifaSpin {
    from { transform: rotate(0deg) scale(1); }
    to { transform: rotate(360deg) scale(1); }
}

@keyframes torifaBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-25px) scale(1.05); }
    50% { transform: translateY(-10px) scale(1.02); }
    75% { transform: translateY(-15px) scale(1.03); }
}

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

@keyframes torifaGlow {
    0% { 
        box-shadow: 0 0 20px currentColor, 0 0 40px currentColor, 0 0 60px currentColor;
    }
    100% { 
        box-shadow: 0 0 40px currentColor, 0 0 80px currentColor, 0 0 120px currentColor;
    }
}

@keyframes torifaWinner {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.25) rotate(10deg); }
    50% { transform: scale(1.15) rotate(-10deg); }
    75% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1.1) rotate(0deg); }
}

/* ============================================
   COLORES
   ============================================ */
.torifa-lottery-ball[data-color="red"] { 
    background: linear-gradient(145deg, #ff4757, #ee5a24); 
    color: #ff4757;
}

.torifa-lottery-ball[data-color="blue"] { 
    background: linear-gradient(145deg, #3742fa, #2f3542); 
    color: #3742fa;
}

.torifa-lottery-ball[data-color="green"] { 
    background: linear-gradient(145deg, #2ed573, #1e90ff); 
    color: #2ed573;
}

.torifa-lottery-ball[data-color="gold"] { 
    background: linear-gradient(145deg, #ffa502, #ff6348); 
    color: #ffa502;
}

.torifa-lottery-ball[data-color="custom"] { 
    background: linear-gradient(145deg, var(--custom-color), var(--custom-color-dark)); 
    color: var(--custom-color);
}

/* ============================================
   CONTROLES
   ============================================ */
.torifa-lottery-controls {
    margin: 25px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.torifa-spin-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 35px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* Botones de selección rápida */
.torifa-quick-select-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

.torifa-quick-select-btn {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.torifa-quick-select-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.torifa-quick-select-btn:active:not(:disabled) {
    transform: translateY(0);
}

.torifa-quick-select-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.torifa-spin-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.torifa-spin-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.torifa-spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.torifa-spin-btn.spinning {
    opacity: 0.8;
}

.torifa-spin-icon {
    font-size: 1.3em;
    display: inline-block;
    animation: torifaIconSpin 2s linear infinite;
}

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

/* ============================================
   NÚMEROS SELECCIONADOS
   ============================================ */
.torifa-selected-numbers-display {
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    border: 2px solid #dee2e6;
}

.torifa-selected-numbers-display h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.2em;
}

.torifa-selected-numbers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.torifa-selected-number-badge {
    display: inline-flex;
    align-items: center;
    position: relative;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    animation: torifaBadgeAppear 0.3s ease-out;
}

.torifa-number-text {
    padding-right: 4px;
}

.torifa-remove-number {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: 2px solid white;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    z-index: 10;
}

.torifa-remove-number:hover {
    background: #c82333;
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.torifa-remove-number:active {
    transform: scale(0.95);
}

.torifa-remove-number:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.3);
}

@keyframes torifaBadgeAppear {
    from {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ============================================
   BOTÓN CONTINUAR
   ============================================ */
.torifa-continue-wrapper {
    margin: 25px 0;
}

.torifa-continue-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 1.2em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.torifa-continue-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(46, 204, 113, 0.5);
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

/* ============================================
   MODAL
   ============================================ */
.torifa-lottery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    overflow-y: auto;
}

.torifa-lottery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: torifaModalFadeIn 0.3s ease-out;
}

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

.torifa-lottery-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.torifa-lottery-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: torifaModalSlideIn 0.3s ease-out;
    z-index: 10001;
}

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

.torifa-lottery-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #e74c3c;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.torifa-lottery-modal-close:hover {
    background: #c0392b;
    transform: rotate(90deg);
}

.torifa-lottery-modal-title {
    padding: 25px 25px 15px;
    margin: 0;
    font-size: 1.8em;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
}

.torifa-lottery-modal-body {
    padding: 25px;
}

/* ============================================
   OVERLAY DE ENVÍO
   ============================================ */
.torifa-lottery-sending-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 1000;
}

.torifa-lottery-sending-overlay.active {
    display: flex;
}

.torifa-lottery-sending-content {
    text-align: center;
}

.torifa-lottery-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #ecf0f1;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: torifaSpinner 1s linear infinite;
    margin: 0 auto 20px;
}

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

.torifa-lottery-success-icon {
    width: 60px;
    height: 60px;
    background: #2ecc71;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: bold;
    margin: 0 auto 20px;
    animation: torifaSuccessPop 0.5s ease-out;
}

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

.torifa-lottery-sending-text {
    font-size: 1.3em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.torifa-lottery-sending-subtext {
    color: #7f8c8d;
    font-size: 1em;
}

/* ============================================
   RESUMEN Y FORMULARIO
   ============================================ */
.torifa-lottery-summary {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.torifa-lottery-summary h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.torifa-lottery-numbers-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.torifa-lottery-numbers-list li {
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.torifa-lottery-total {
    border-top: 2px solid #dee2e6;
    padding-top: 15px;
}

.torifa-lottery-total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 1.1em;
}

.torifa-lottery-total-main {
    font-size: 1.3em;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #dee2e6;
}

.torifa-lottery-form {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.torifa-lottery-form h4 {
    margin: 0 0 20px 0;
    color: #2c3e50;
}

.torifa-lottery-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.torifa-lottery-form-group {
    flex: 1;
}

.torifa-lottery-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.torifa-lottery-form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.torifa-lottery-form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.torifa-lottery-form-group input.error {
    border-color: #e74c3c;
}

.torifa-lottery-terms {
    margin: 20px 0;
    padding: 15px;
    background: #fff3cd;
    border-radius: 10px;
    border: 2px solid #ffc107;
}

.torifa-lottery-terms label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #856404;
}

.torifa-lottery-terms input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ============================================
   BOTONES DE PAGO
   ============================================ */
.torifa-lottery-payment {
    margin: 25px 0;
}

.torifa-lottery-payment h4 {
    margin: 0 0 20px 0;
    color: #2c3e50;
}

.torifa-lottery-payment-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.torifa-lottery-pay-btn {
    width: 100%;
    padding: 15px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
}

.torifa-lottery-pay-direct {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.torifa-lottery-pay-paypal {
    background: linear-gradient(135deg, #0070ba, #003087);
    color: white;
}

.torifa-lottery-pay-mercadopago {
    background: linear-gradient(135deg, #009ee3, #0070ba);
    color: white;
}

.torifa-lottery-pay-whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
}

.torifa-lottery-pay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.torifa-lottery-modal-actions {
    margin-top: 25px;
    text-align: center;
}

.torifa-lottery-cancel-btn {
    padding: 12px 30px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.torifa-lottery-cancel-btn:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

/* ============================================
   CONFETTI
   ============================================ */
.torifa-confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.torifa-confetti-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: torifaConfettiFall linear forwards;
}

@keyframes torifaConfettiFall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(200px) rotate(360deg);
        opacity: 0;
    }
}

/* ============================================
   TOAST
   ============================================ */
.torifa-lottery-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #2c3e50;
    color: white;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 10002;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 400px;
}

.torifa-lottery-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.torifa-lottery-toast-error {
    background: #e74c3c;
}

.torifa-lottery-toast-warning {
    background: #f39c12;
}

.torifa-lottery-toast-success {
    background: #2ecc71;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .torifa-lottery-ball-container {
        padding: 20px 15px;
    }
    
    .torifa-lottery-title {
        font-size: 1.5em;
    }
    
    .torifa-ball-large { 
        width: 160px; 
        height: 160px; 
    }
    
    .torifa-ball-xlarge { 
        width: 180px; 
        height: 180px; 
    }
    
    .torifa-ball-large .torifa-ball-number { 
        font-size: 3em; 
    }
    
    .torifa-ball-xlarge .torifa-ball-number { 
        font-size: 4em; 
    }
    
    .torifa-lottery-form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .torifa-lottery-modal-content {
        width: 95%;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .torifa-lottery-title {
        font-size: 1.3em;
    }
    
    .torifa-ball-medium { 
        width: 120px; 
        height: 120px; 
    }
    
    .torifa-ball-large { 
        width: 140px; 
        height: 140px; 
    }
    
    .torifa-ball-xlarge { 
        width: 160px; 
        height: 160px; 
    }
    
    .torifa-ball-medium .torifa-ball-number { 
        font-size: 2em; 
    }
    
    .torifa-spin-btn {
        padding: 12px 25px;
        font-size: 1em;
    }
    
    .torifa-continue-btn {
        padding: 15px 30px;
        font-size: 1em;
    }
}
