:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #f8fafc;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --white: #ffffff;
    --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);
    --radius: 12px;
    --transition: all 0.3s ease;
    --title-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --secondary: #1e293b;
    --white: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --title-gradient: linear-gradient(135deg, #a5b4fc 0%, #d8b4fe 100%);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

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

body {
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    color: var(--text-main);
    transition: var(--transition);
}

.main-content {
    background: var(--white);
    width: 100%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition);
    position: relative;
}

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

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

.header-banner {
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--secondary);
    border-bottom: 1px solid #e2e8f0;
    transition: var(--transition);
    /* Aseguramos que el contenedor sea el punto de referencia */
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

[data-theme="dark"] .header-banner {
    border-bottom-color: #334155;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 3.5rem;
    right: 1.5rem;
    background: var(--white);
    border: 1px solid #e2e8f0;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

[data-theme="dark"] .theme-toggle {
    border-color: #334155;
    background: #1e293b;
}

.theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--text-main);
}

.main-title {
    font-family: 'Merriweather', serif;
    font-size: 2rem;
    font-weight: 900;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;

    /* SOLUCIÓN AL SOLAPAMIENTO */
    max-width: 80%;
    /* Evita que el texto se extienda hasta el botón */
    margin-left: auto;
    /* Centrado horizontal */
    margin-right: auto;
    /* Centrado horizontal */
    line-height: 1.2;
    /* Mejora la legibilidad si el nombre salta de línea */
}

.header-banner img {
    max-width: 120px;
    height: auto;
    filter: drop-shadow(0 10px 15px rgba(99, 102, 241, 0.3));
}

.input-section {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
    position: relative;
}

.input-name {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    background: var(--white);
    color: var(--text-main);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

[data-theme="dark"] .input-name {
    border-color: #334155;
}

.input-name:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.button-add {
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.button-add:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

/* List Styles */
.name-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
}

.name-list li {
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.875rem;
    color: var(--text-main);
    border: 1px solid #e2e8f0;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition);
}

[data-theme="dark"] .name-list li {
    background: #1e293b;
    border-color: #334155;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-list {
    list-style: none;
    margin-top: 1rem;
}

.result-list li {
    background: #ecfdf5;
    color: #065f46;
    padding: 1.25rem;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 600;
    border: 1px solid #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.reveal-animation {
    animation: revealEffect 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes revealEffect {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.button-container {
    margin-top: auto;
}

.button-draw {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.button-draw:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.3);
}

.button-draw img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

/* Validation Feedback */
.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    position: absolute;
    bottom: -1.25rem;
    left: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

/* Custom Scrollbar */
.name-list::-webkit-scrollbar {
    width: 6px;
}

.name-list::-webkit-scrollbar-track {
    background: transparent;
}

.name-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Responsive fixes */
@media (max-width: 480px) {
    .main-content {
        border-radius: 0;
        height: 100vh;
        max-width: none;
    }

    body {
        padding: 0;
    }

    .header-banner {
        padding: 2rem 1rem;
    }
}