/* CSS Reset and Variables */
:root {
    /* Color Palette - Modern and Premium */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-900: #0c4a6e;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --success-500: #10b981;
    --success-600: #059669;
    --warning-500: #f59e0b;
    --error-500: #ef4444;
    --error-600: #dc2626;
    
    /* Spacing System */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-50) 100%);
    color: var(--gray-800);
    margin: 0;
    padding: var(--space-6);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* Background Pattern */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.03;
    background-image: 
        radial-gradient(circle at 25% 25%, var(--primary-600) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, var(--primary-500) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: var(--space-12);
    animation: fadeInUp 0.8s ease-out;
}

.header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-2xl);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-normal);
}

.header-icon:hover {
    transform: scale(1.05) rotate(5deg);
}

.header-icon i {
    color: white;
    width: 36px;
    height: 36px;
}

.app-header h1 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 var(--space-3) 0;
    background: linear-gradient(135deg, var(--gray-900), var(--primary-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: var(--font-size-lg);
    color: var(--gray-600);
    margin: 0;
    font-weight: 400;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

/* Panel Shared Styles */
.settings-panel,
.results-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
    transition: all var(--transition-normal);
    animation: fadeInUp 0.8s ease-out;
    width: 100%;
}

.settings-panel {
    max-width: 800px;
}

.results-panel {
    max-width: 800px;
}

.settings-panel:hover,
.results-panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2xl);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.panel-header i {
    color: var(--primary-600);
    width: 24px;
    height: 24px;
}

.panel-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

/* Settings Panel */
.settings-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1 1 calc((100% - 2 * var(--space-4)) / 3);
    min-width: 160px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
}

.input-group label i {
    color: var(--primary-500);
    width: 16px;
    height: 16px;
}

.input-group input[type="number"] {
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    background: white;
    transition: all var(--transition-fast);
    outline: none;
}

.input-group input[type="number"]:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.input-group input[type="number"]::placeholder {
    color: var(--gray-400);
}

/* Custom Checkbox */
.checkbox-group {
    margin-top: var(--space-2);
    flex-basis: 100%;
}

.custom-checkbox {
    position: relative;
}

.custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.custom-checkbox label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    transition: background-color var(--transition-fast);
}

.custom-checkbox label:hover {
    background-color: var(--gray-50);
}

.checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    background: white;
}

.checkmark i {
    width: 12px;
    height: 12px;
    color: white;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.custom-checkbox input[type="checkbox"]:checked + label .checkmark {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.custom-checkbox input[type="checkbox"]:checked + label .checkmark i {
    opacity: 1;
}

.label-text {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
}

.label-text i {
    color: var(--primary-500);
    width: 16px;
    height: 16px;
}

/* Generate Button */
.generate-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-4) var(--space-6);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-lg);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
}

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

.generate-button i {
    width: 24px;
    height: 24px;
}

.button-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.generate-button:hover .button-glow {
    left: 100%;
}

/* Results Panel */
.results-grid {
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: center;
    align-items: center;
    align-content: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 150px;
    text-align: center;
    color: var(--gray-500);
}

.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: var(--font-size-sm);
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-xl);
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    
    /* MODIFIED: Set initial state and ensure animation fills forwards */
    opacity: 0;
    transform: scale(0.8);
    animation: resultAppear 0.5s ease-out forwards; 
    /* animation-delay is set inline by JS */
}

.result-item:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: var(--shadow-lg);
}

/* History Section */
.history-section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 1s ease-out;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: var(--space-12);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.clear-button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--error-500);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.clear-button:hover {
    background: var(--error-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.clear-button i {
    width: 16px;
    height: 16px;
}

.history-container {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    min-height: 120px;
    max-height: 400px;
    overflow-y: auto;
}

.history-container:empty::before {
    content: "暂无抽奖记录";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--gray-500);
    font-size: var(--font-size-sm);
}

.history-entry {
    padding: var(--space-4);
    border-bottom: 1px solid var(--gray-200);
    transition: background-color var(--transition-fast);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    background: white;
    box-shadow: var(--shadow-sm);
}

.history-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.history-entry:hover {
    background-color: var(--primary-50);
}

.timestamp {
    font-weight: 600;
    color: var(--gray-700);
    font-size: var(--font-size-xs);
    display: block;
    margin-bottom: var(--space-2);
}

.numbers {
    color: var(--primary-600);
    font-weight: 500;
    font-size: var(--font-size-sm);
    word-break: break-all;
}

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

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

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        gap: var(--space-6);
    }
    
    .container {
        padding: 0 var(--space-4);
    }
}

@media (max-width: 768px) {
    body {
        padding: var(--space-4);
    }
    
    .app-header h1 {
        font-size: var(--font-size-3xl);
    }
    
    .settings-panel,
    .results-panel,
    .history-section {
        padding: var(--space-6);
    }
    
    .history-header {
        flex-direction: column;
        gap: var(--space-4);
        align-items: stretch;
    }
    
    .header-icon {
        width: 60px;
        height: 60px;
    }
    
    .header-icon i {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .results-grid {
        justify-content: center;
    }
    
    .result-item {
        min-width: 50px;
        height: 50px;
        font-size: var(--font-size-lg);
    }
}

/* Custom Scrollbar */
.history-container::-webkit-scrollbar {
    width: 6px;
}

.history-container::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

.history-container::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-sm);
}

.history-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Focus styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
} 