:root {
    --primary: #6366f1;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px 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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-lg: 16px;
}


/* Main layout */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Control panel wrapper - Animated gradient border */
.control-panel-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 4px;
    background: linear-gradient(135deg, 
        #667eea 0%,
        #764ba2 25%,
        #f093fb 50%,
        #4facfe 75%,
        #667eea 100%
    );
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
    box-shadow: 
        0 8px 32px rgba(102, 126, 234, 0.3),
        0 2px 8px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.control-panel-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 48px rgba(102, 126, 234, 0.4),
        0 4px 16px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Control panel - Enhanced styling */
.control-panel {
    background: linear-gradient(to bottom, #ffffff, #fafbff);
    border-radius: calc(var(--radius-lg) - 4px);
    padding: 32px;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.control-panel form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Main text input - Enhanced with glow effect */
.input-group:has(#textInput) {
    width: 100%;
    margin-bottom: 8px;
}

.input-group:has(#textInput) input {
    width: 100%;
    padding: 18px 24px;
    text-align: center;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #667eea, #764ba2) border-box;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.input-group:has(#textInput) input:focus {
    border-color: transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #667eea, #f093fb) border-box;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 8px 24px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

.input-group:has(#textInput) input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Horizontal select group */
.select-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}

.input-group {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(to bottom, #ffffff, #fafbff);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 
        0 0 0 3px rgba(99, 102, 241, 0.1),
        0 4px 16px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg width='14' height='14' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M4 6L8 10L12 6' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 42px;
    text-align: center;
    font-weight: 500;
}

.input-group select:hover {
    border-color: var(--primary-light);
}

/* Generate button - Ultra prominent with animation */
.generate-btn {
    width: 100%;
    padding: 18px 32px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #ea580c 100%);
    background-size: 200% auto;
    color: #000;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 
        0 8px 24px rgba(251, 191, 36, 0.4),
        0 4px 12px rgba(245, 158, 11, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    background-position: right center;
    box-shadow: 
        0 12px 32px rgba(251, 191, 36, 0.5),
        0 6px 16px rgba(245, 158, 11, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.generate-btn:active:not(:disabled) {
    transform: translateY(-1px) scale(1);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.generate-btn span:first-child {
    font-size: 20px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.8;
    }
}

/* Loading in control panel */
.control-panel .loading-state {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.control-panel .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.control-panel.loading .loading-state {
    display: block;
}

.control-panel.loading .generate-btn {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Error message */
.error-message {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 2px solid #fecaca;
    color: var(--error);
    padding: 16px;
    border-radius: var(--radius);
    display: none;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Results section */
.results-section {
    background: var(--bg-card);
    display: none;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-section.visible {
    display: block;
}

/* Loading state */
.loading-state {
    display: none;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Nickname grid */
.nickname-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 4px;
}

.nickname-item {
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.nickname-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(240, 147, 251, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nickname-item:hover::before {
    opacity: 1;
}

.nickname-item:hover {
    border-color: var(--primary);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 12px 32px rgba(102, 126, 234, 0.15),
        0 4px 16px rgba(102, 126, 234, 0.1);
    background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
}

.nickname-item:active {
    transform: translateY(-2px) scale(1);
}

.nickname-text {
    font-size: 22px;
    color: var(--text);
    margin-bottom: 8px;
    word-break: break-all;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

.nickname-label {
    font-size: 11px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-size: 200% auto;
    border-radius: 20px;
    padding: 6px 14px;
    display: inline-block;
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.copy-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transform: scale(0.5) rotate(-45deg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    z-index: 2;
}

.nickname-item:hover .copy-indicator {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Suggestions */
.suggestions-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid var(--border);
    text-align: center;
}

.suggestions-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 50%, #0e7490 100%);
    background-size: 200% auto;
    color: white;
    text-decoration: none;
    padding: 16px 28px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 24px rgba(6, 182, 212, 0.3),
        0 4px 12px rgba(8, 145, 178, 0.2);
    position: relative;
    overflow: hidden;
}

.suggestions-btn::before {
    content: '';
    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;
}

.suggestions-btn:hover::before {
    left: 100%;
}

.suggestions-btn:hover {
    transform: translateY(-2px) scale(1.05);
    background-position: right center;
    box-shadow: 
        0 12px 32px rgba(6, 182, 212, 0.4),
        0 6px 16px rgba(8, 145, 178, 0.3);
}

.suggestions-btn span:first-child {
    font-size: 20px;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Toast notification */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 
        0 12px 32px rgba(16, 185, 129, 0.4),
        0 4px 16px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(0);
    animation: slideInBounce 0.5s ease-out;
}

@keyframes slideInBounce {
    0% {
        transform: translateX(400px);
    }
    60% {
        transform: translateX(-10px);
    }
    80% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
    }
}

.toast span:first-child {
    font-size: 20px;
    animation: checkmark 0.5s ease-out;
}

@keyframes checkmark {
    0% {
        transform: scale(0) rotate(-45deg);
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Animation for nickname items */
.nickname-item {
    animation: fadeInUp 0.4s ease forwards;
    animation-delay: calc(var(--item-index, 0) * 0.05s);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Add stagger effect to grid items */
.nickname-grid .nickname-item:nth-child(1) { --item-index: 0; }
.nickname-grid .nickname-item:nth-child(2) { --item-index: 1; }
.nickname-grid .nickname-item:nth-child(3) { --item-index: 2; }
.nickname-grid .nickname-item:nth-child(4) { --item-index: 3; }
.nickname-grid .nickname-item:nth-child(5) { --item-index: 4; }
.nickname-grid .nickname-item:nth-child(6) { --item-index: 5; }
.nickname-grid .nickname-item:nth-child(7) { --item-index: 6; }
.nickname-grid .nickname-item:nth-child(8) { --item-index: 7; }
.nickname-grid .nickname-item:nth-child(9) { --item-index: 8; }

/* Responsive */
@media (max-width: 768px) {
    .main-grid {
        gap: 24px;
        padding: 0 12px;
    }
    
    .control-panel-wrapper {
        padding: 3px;
    }
    
    .control-panel {
        padding: 24px 20px;
    }
    
    .select-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .nickname-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .input-group:has(#textInput) input {
        padding: 16px 20px;
        font-size: 15px;
    }
    
    .generate-btn {
        font-size: 15px;
        padding: 16px 28px;
    }
}

@media (max-width: 480px) {
    .generate-btn {
        padding: 14px 24px;
        font-size: 14px;
    }
    
    .toast {
        right: 12px;
        left: 12px;
        font-size: 14px;
        padding: 14px 20px;
    }
    
    .suggestions-btn {
        padding: 14px 24px;
        font-size: 15px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --bg-card: #1e293b;
        --bg-input: #334155;
        --border: #475569;
        --text: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
    }
    
    .control-panel {
        background: linear-gradient(to bottom, #1e293b, #0f172a);
    }
    
    .input-group:has(#textInput) input {
        background: linear-gradient(#1e293b, #1e293b) padding-box,
                    linear-gradient(135deg, #667eea, #764ba2) border-box;
    }
    
    .nickname-item {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }
    
    .nickname-item:hover {
        background: linear-gradient(135deg, #1e293b 0%, #1e3a5f 100%);
    }
}