/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #f3f4f6;
    --accent-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

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

/* Wheel section */
.wheel-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

.wheel-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#wheelCanvas {
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    background: white;
    transition: var(--transition);
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid #ef4444;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    z-index: 10;
}

.spin-button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: center;
}

.spin-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.spin-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.spin-icon {
    font-size: 1.2rem;
}

/* Controls section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.input-section,
.customization-section,
.history-section {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.input-section h3,
.customization-section h3,
.history-section h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.2rem;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#namesInput {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: var(--transition);
}

#namesInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-actions {
    display: flex;
    gap: 8px;
}

.action-button {
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

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

.action-button.secondary {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.action-button.secondary:hover {
    background: var(--text-secondary);
    color: white;
}

.names-count {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

#namesCount {
    color: var(--primary-color);
    font-weight: 600;
}

/* Customization */
.customization-grid {
    display: grid;
    gap: 16px;
}

.customization-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.customization-item label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.customization-item input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--secondary-color);
    outline: none;
    -webkit-appearance: none;
}

.customization-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.customization-item input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-sm);
}

.customization-item select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.customization-item select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.customization-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* History */
.winners-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.winner-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--secondary-color);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.winner-name {
    font-weight: 500;
    color: var(--text-primary);
}

.winner-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.no-winners {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 20px;
}

.history-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.history-actions .action-button {
    flex: 1;
    min-width: 120px;
}

/* Footer */
.footer {
    margin-top: 60px;
    text-align: center;
    color: white;
    opacity: 0.8;
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.footer-main {
    text-align: left;
    flex: 1;
}

.footer-main p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.footer-credits {
    margin-top: 0.5rem;
}

.footer-credits p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
}

.omeans-link, .developer-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.omeans-link:hover, .developer-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: right;
    flex-wrap: wrap;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
}

.footer-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.footer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.footer-info p {
    margin: 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--text-primary);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.winner-display {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    padding: 40px 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    margin: 20px 0;
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.primary-button,
.secondary-button {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
}

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

.primary-button:hover {
    background: var(--primary-hover);
}

.secondary-button {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.secondary-button:hover {
    background: #e5e7eb;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .container {
        padding: 15px;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .logo-icon {
        font-size: 2rem;
    }

    #wheelCanvas {
        width: 300px;
        height: 300px;
    }

    .wheel-container {
        min-height: 400px;
    }

    .input-actions {
        flex-direction: column;
    }

    .action-button {
        width: 100%;
    }

    .modal-content {
        margin: 20% auto;
        width: 95%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        gap: 8px;
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    #wheelCanvas {
        width: 250px;
        height: 250px;
    }

    .spin-button {
        padding: 14px 24px;
        font-size: 1rem;
        min-width: 180px;
    }

    .input-section,
    .customization-section,
    .history-section {
        padding: 20px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-main {
        text-align: center;
    }
    
    .footer-links {
        text-align: center;
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .footer-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Animation classes */
.spinning {
    animation: spin 0.1s linear infinite;
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}
