* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.input-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.input-section h2 {
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3748;
    font-size: 1.1rem;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group small {
    display: block;
    margin-top: 5px;
    color: #718096;
    font-size: 0.9rem;
}

.fetch-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.fetch-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

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

.fetch-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: 500;
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

.simulate-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.simulate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

.user-tickets-section {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 15px;
    border: 2px solid #e2e8f0;
}

.user-tickets-section h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-align: center;
}

.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(255,255,255,0.7);
    border-radius: 10px;
}

.ticket-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 1rem;
    color: #2d3748;
    border: 2px solid #cbd5e0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ticket-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.ticket-item.winning-ticket {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    animation: pulse 2s infinite;
}

.results-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.results-section h2 {
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.odds-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    color: white;
}

.odds-display h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.odds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.odds-item {
    background: rgba(255,255,255,0.2);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.odds-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.odds-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.simulation-results h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: #f7fafc;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
}

.cycles-breakdown h4 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.cycles-header {
    display: grid;
    grid-template-columns: auto 1fr 80px;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    background: #e2e8f0;
    border: 1px solid #cbd5e0;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-ticket {
    text-align: center;
}

.cycles-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: #f7fafc;
}

.cycle-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: grid;
    grid-template-columns: auto 1fr 80px;
    align-items: center;
    gap: 20px;
    transition: background-color 0.2s ease;
    min-height: 50px;
}

.cycle-item:last-child {
    border-bottom: none;
}

.cycle-item:hover {
    background: #edf2f7;
}

.cycle-number {
    font-weight: 600;
    color: #4a5568;
    min-width: 80px;
    display: flex;
    align-items: center;
}

.cycle-ticket {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    background: white;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
    justify-self: center;
    text-align: center;
}

.cycle-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    text-align: center;
}

.status-sold {
    background: #c6f6d5;
    color: #22543d;
}

.status-unsold {
    background: #fed7d7;
    color: #742a2a;
}

.status-winner {
    background: #bee3f8;
    color: #2a4365;
    animation: pulse 2s infinite;
}

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

.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading p {
    color: #4a5568;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    .input-section, .results-section {
        padding: 20px;
    }
    
    .odds-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .cycles-header {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .cycle-item {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .cycle-item > div {
        width: 100%;
    }
    
    .cycle-ticket {
        justify-self: center;
    }
    
    .tickets-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .ticket-item {
        padding: 8px;
        font-size: 0.9rem;
    }
}

/* Scrollbar Styling */
.cycles-list::-webkit-scrollbar {
    width: 8px;
}

.cycles-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.cycles-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.cycles-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
