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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
    line-height: 1.6;
}

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

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

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

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

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Input Section */
.input-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #4f46e5;
}

.preset-group {
    margin: 20px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    border: 2px solid #e1e5e9;
}

.preset-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.preset-dropdown {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    margin-bottom: 10px;
}

.preset-dropdown:focus {
    outline: none;
    border-color: #4f46e5;
}

.preset-dropdown:hover {
    border-color: #9ca3af;
}

.error-message {
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.error-message.show {
    display: block;
}

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

.entry-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-2px);
}

.btn-spin {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    font-size: 18px;
    font-weight: 600;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-spin:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

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

/* Wheel Section */
.wheel-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.wheel-container {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

#wheelCanvas {
    border-radius: 50%;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    display: block;
    margin: 0 auto;
}

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

.center-spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    z-index: 20;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.center-spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 12px 35px rgba(0,0,0,0.4);
}

.center-spin-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.center-spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translate(-50%, -50%) scale(1);
}

.center-spin-btn:disabled:hover {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.spin-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spin-settings {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spin-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.spin-settings input[type="range"] {
    width: 150px;
}

/* Results Section */
.results-section {
    grid-column: 1 / -1;
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.current-result {
    margin-bottom: 30px;
    text-align: center;
}

.result-display {
    font-size: 2rem;
    font-weight: 600;
    color: #4f46e5;
    margin: 15px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    border: 2px solid #e1e5e9;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-history {
    text-align: center;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
    min-height: 50px;
}

.history-item {
    background: #4f46e5;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Customization Section */
.customization-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

/* Inline Customization Section */
.customization-section-inline {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e1e5e9;
}

.customization-section-inline h3 {
    margin-bottom: 20px;
    color: #374151;
    font-size: 1.1rem;
    font-weight: 600;
}

.customization-section h3 {
    margin-bottom: 20px;
    color: #374151;
}

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

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 500;
    color: #374151;
}

.control-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.control-group input[type="checkbox"] {
    margin-right: 8px;
}

/* Entries Section */
.entries-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Inline Entries Section */
.entries-section-inline {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e1e5e9;
}

.entries-section-inline h3 {
    margin-bottom: 15px;
    color: #374151;
    font-size: 1.1rem;
    font-weight: 600;
}

.entries-section h3 {
    margin-bottom: 20px;
    color: #374151;
}

.entries-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 50px;
}

.entry-item {
    background: #f1f5f9;
    border: 2px solid #e1e5e9;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.entry-item:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.remove-entry-btn {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: #ffffff;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.remove-entry-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.45);
}

.remove-entry-btn:active {
    transform: scale(0.96);
}

.remove-entry-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25), 0 4px 10px rgba(239, 68, 68, 0.45);
}

/* High-contrast/disabled states */
.remove-entry-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .remove-entry-btn {
        transition: none;
    }
}

.entry-remove {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.entry-remove:hover {
    background: #dc2626;
}

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

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

.spinning {
    transition: transform 0.1s ease-out;
}

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

.pulse {
    animation: pulse 0.5s ease-in-out;
}

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

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

/* Confetti Animation */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    #wheelCanvas {
        width: 350px;
        height: 350px;
    }
    
    .center-spin-btn {
        width: 60px;
        height: 60px;
        font-size: 14px;
    }
    
    .entry-controls {
        justify-content: center;
    }
    
    .customization-controls {
        grid-template-columns: 1fr;
    }
    
    .result-display {
        font-size: 1.5rem;
    }
    
    .entries-section-inline {
        margin-top: 20px;
        padding-top: 20px;
    }
    
    .customization-section-inline {
        margin-top: 20px;
        padding-top: 20px;
    }
}

@media (max-width: 480px) {
    #wheelCanvas {
        width: 280px;
        height: 280px;
    }
    
    .center-spin-btn {
        width: 50px;
        height: 50px;
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .btn-spin {
        font-size: 16px;
        padding: 12px 24px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success States */
.success {
    background: #10b981 !important;
    color: white !important;
}

/* Error States */
.error {
    background: #ef4444 !important;
    color: white !important;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    overflow: hidden;
    max-height: 450px;
}

.modal-header {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 40px 30px;
    text-align: center;
}

.result-display-modal {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 15px;
    padding: 30px;
    border: 3px solid #4f46e5;
    position: relative;
    overflow: hidden;
}

.result-display-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed, #ec4899, #4f46e5);
    background-size: 200% 100%;
    animation: gradientShift 2s ease-in-out infinite;
}

.result-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: #4f46e5;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: resultPulse 0.6s ease-out;
}

.result-subtitle {
    font-size: 1.2rem;
    color: #6b7280;
    font-weight: 500;
}

.modal-footer {
    padding: 20px 30px;
    background: #f8fafc;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-footer .btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Modal Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes resultPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Modal Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 20px 25px;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 30px 25px;
    }
    
    .result-text {
        font-size: 2rem;
    }
    
    .modal-footer {
        padding: 15px 25px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        flex: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .result-text {
        font-size: 1.5rem;
    }
    
    .result-subtitle {
        font-size: 1rem;
    }
}
