/* CSS Variables for Theme */
:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff; 
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --border-color: #e5e5e7;
    --modal-bg: rgba(0, 0, 0, 0.5);
    --button-primary: #007aff;
    --button-hover: #0056cc;
    --nav-bg: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d30 100%);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #404040;
    --modal-bg: rgba(0, 0, 0, 0.8);
    --button-primary: #0a84ff;
    --button-hover: #0066cc;
    --nav-bg: rgba(42, 42, 42, 0.95);
}

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: all 0.3s ease;
}

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

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    margin: 0 -20px 20px -20px;
    padding-left: 20px;
    padding-right: 20px;
    position: relative;
    z-index: 100;
}

.nav-left .site-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-center, .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-button {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-button:hover {
    background: var(--button-primary);
    color: white;
    border-color: var(--button-primary);
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--button-primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.theme-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Header Styles */
.header {
    padding: 40px 0;
    text-align: center;
}

/* Settings Panel */
.settings-panel {
    margin-top: 30px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.setting-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Custom Checkbox */
.setting-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

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

.setting-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 3px;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Custom Sliders */
.slider {
    width: 120px;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--button-primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 122, 255, 0.3);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--button-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tab-container {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button.active {
    background: var(--button-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.tab-button:hover:not(.active) {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
    padding-bottom: 60px;
}

/* Wheel Section */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.wheel-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#wheelCanvas {
    border-radius: 50%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    background: white;
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    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 #ff3b30;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.spin-button {
    background: linear-gradient(135deg, #007aff, #0056d6);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.spin-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

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

.spin-button:disabled {
    background: #d1d1d6;
    color: #8e8e93;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Input Section */
.input-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.tab-content {
    display: none;
}

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

.tab-content h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.input-container {
    position: relative;
}

#customInput {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
}

#customInput:focus {
    outline: none;
    border-color: var(--button-primary);
    background: var(--bg-secondary);
}

.input-info {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: right;
}

.preset-info {
    text-align: center;
    padding: 40px 20px;
}

.preset-info p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.preset-options {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.option-item {
    background: var(--bg-primary);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 500;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    max-width: 300px;
    margin: 0 auto;
}

.alphabet-grid span {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    animation: modalScale 0.3s ease forwards;
}

.info-modal {
    max-width: 600px;
    text-align: left;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    max-height: 400px;
    overflow-y: auto;
}

.instruction-section {
    margin-bottom: 25px;
}

.instruction-section h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.instruction-section p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.contact-info {
    text-align: center;
    padding: 20px 0;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 18px;
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.contact-item i {
    color: var(--button-primary);
}


.winner-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: bounce 0.6s ease;
}

.modal-content h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.winner-text {
    font-size: 24px;
    font-weight: 600;
    color: #007aff;
    margin-bottom: 30px;
    padding: 16px;
    background: #f0f8ff;
    border-radius: 12px;
    border: 2px solid #007aff;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.close-button, .remove-button {
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.close-button {
    background: #007aff;
    color: white;
}

.close-button:hover {
    background: #0056d6;
    transform: translateY(-1px);
}

.remove-button {
    background: #ff3b30;
    color: white;
}

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

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalScale {
    to { transform: scale(1); }
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .nav-center, .nav-right {
        gap: 15px;
    }
    
    .nav-left .site-title {
        font-size: 20px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .header {
        padding: 20px 0;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .settings-panel {
        gap: 20px;
        padding: 16px;
        flex-direction: column;
    }
    
    .setting-group {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }
    
    .slider {
        width: 100px;
    }
    
    #wheelCanvas {
        width: 300px;
        height: 300px;
    }
    
    .input-section {
        padding: 24px;
    }
    
    .tab-content h2 {
        font-size: 24px;
    }
    
    #customInput {
        min-height: 200px;
    }
    
    .alphabet-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .tab-container {
        width: 100%;
        flex-direction: column;
    }
    
    .tab-button {
        width: 100%;
        margin: 2px 0;
    }
    
    #wheelCanvas {
        width: 250px;
        height: 250px;
    }
    
    .spin-button {
        padding: 14px 24px;
        font-size: 16px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .winner-text {
        font-size: 20px;
    }
}
