:root {
    --primary-color: #ef5350; /* Pokeball red */
    --primary-dark: #c62828;
    --primary-light: #ff867c;
    --secondary-color: #3b4cca; /* Pokemon blue */
    --accent-color: #ffde00; /* Pikachu yellow */
    
    --bg-color: #f5f7fa;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --card-bg: rgba(255, 255, 255, 0.85);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-pill: 9999px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Type Colors */
    --type-normal: #A8A77A;
    --type-fire: #EE8130;
    --type-water: #6390F0;
    --type-electric: #F7D02C;
    --type-grass: #7AC74C;
    --type-ice: #96D9D6;
    --type-fighting: #C22E28;
    --type-poison: #A33EA1;
    --type-ground: #E2BF65;
    --type-flying: #A98FF3;
    --type-psychic: #F95587;
    --type-bug: #A6B91A;
    --type-rock: #B6A136;
    --type-ghost: #735797;
    --type-dragon: #6F35FC;
    --type-dark: #705746;
    --type-steel: #B7B7CE;
    --type-fairy: #D685AD;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(#e0e5ec 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography & Utilities */
h1, h2, h3 {
    font-weight: 900;
}

.hidden {
    display: none !important;
}

.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo h1 {
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.logo-icon {
    font-size: 2rem;
    animation: spin 10s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.header-nav {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.icon-btn.dark {
    color: var(--text-main);
    background: rgba(0,0,0,0.05);
}

.icon-btn.dark:hover {
    background: rgba(0,0,0,0.1);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-color);
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--primary-color);
}

/* Main Layout */
.app-main {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .app-main {
        grid-template-columns: 1fr;
    }
}

/* Controls Section */
.controls-section {
    padding: 1.5rem;
    height: fit-content;
}

.controls-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
    color: var(--primary-dark);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group label .material-icons-round {
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* Autocomplete Input */
.autocomplete-wrapper {
    position: relative;
}

input[type="text"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-pill);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition-fast);
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.2);
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    margin-top: 5px;
    list-style: none;
    padding: 0.5rem 0;
}

.suggestions li {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.suggestions li:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

/* Type Grid */
.type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.type-btn {
    padding: 0.4rem;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    opacity: 0.6;
    filter: grayscale(0.5);
    font-family: inherit;
}

.type-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.type-btn.active {
    opacity: 1;
    filter: grayscale(0);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: scale(1.05);
}

/* Theme Tags */
.theme-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.theme-btn {
    padding: 0.4rem 0.8rem;
    background: #e2e8f0;
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
}

.theme-btn:hover {
    background: #cbd5e1;
}

.theme-btn.active {
    background: white;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    box-shadow: var(--shadow-sm);
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-val {
    font-weight: bold;
    color: var(--primary-color);
    min-width: 60px;
    text-align: center;
    background: #ffebee;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text-main);
    background: var(--accent-color);
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(255, 222, 0, 0.4);
    font-family: inherit;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 222, 0, 0.6);
    filter: brightness(1.05);
}

.generate-btn:active {
    transform: translateY(1px);
}

.pulse-anim {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 222, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 222, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 222, 0, 0); }
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
    background: rgba(255,255,255,0.5);
    border-radius: var(--radius-md);
    border: 2px dashed #cbd5e1;
}

.huge-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Result Cards */
.result-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 2px solid transparent;
    animation: fadeUp 0.4s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.nickname-display {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    text-align: center;
    word-break: break-word;
}

.method-tag {
    align-self: center;
    font-size: 0.7rem;
    background: #f1f5f9;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.card-actions {
    display: flex;
    justify-content: space-around;
    margin-top: auto;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.5rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    font-family: inherit;
    gap: 0.2rem;
}

.action-btn:hover {
    color: var(--primary-color);
}

.action-btn.active .material-icons-round {
    color: var(--primary-color);
    font-variation-settings: 'FILL' 1;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: flex-end;
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.favorite-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.fav-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.danger-btn {
    background: #ef5350;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    transition: var(--transition-fast);
}

.danger-btn:hover {
    background: #c62828;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-pill);
    font-weight: bold;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}
