/* Emoji Picker Styles - Nuevo orden con altura dinámica */
.emoji-picker {
    width: 300px;
    min-height: 200px;
    max-height: 380px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    font-family: inherit;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: height 0.3s ease;
}

/* Theme support */
[data-theme="dark"] .emoji-picker {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* 1. Catálogo de emojis (arriba) */
.emoji-picker-content {
    flex: 1;
    min-height: 100px;
    max-height: 280px;
    overflow-y: auto;
    padding: 8px;
    order: 1;
    transition: max-height 0.3s ease;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}

.emoji-btn {
    padding: 6px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover {
    background: #f3f4f6;
    transform: scale(1.1);
}

[data-theme="dark"] .emoji-btn:hover {
    background: #374151;
}

.emoji-btn:active {
    transform: scale(0.95);
}

/* Mensaje de no resultados */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-size: 14px;
}

[data-theme="dark"] .no-results {
    color: #9ca3af;
}

/* 2. Categorías (medio) */
.emoji-picker-categories {
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    padding: 8px;
    order: 2;
}

[data-theme="dark"] .emoji-picker-categories {
    background: #111827;
    border-top-color: #374151;
    border-bottom-color: #374151;
}

.emoji-categories {
    display: flex;
    justify-content: space-around;
    gap: 2px;
}

.emoji-category-btn {
    padding: 6px 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-category-btn:hover {
    background: #e5e7eb;
}

[data-theme="dark"] .emoji-category-btn:hover {
    background: #374151;
}

.emoji-category-btn.active {
    background: #3b82f6;
    color: white;
}

.emoji-category-btn.active:hover {
    background: #2563eb;
}

/* 3. Búsqueda (abajo) */
.emoji-picker-search {
    background: #f9fafb;
    padding: 8px;
    order: 3;
}

[data-theme="dark"] .emoji-picker-search {
    background: #111827;
}

.emoji-search {
    position: relative;
}

.emoji-search-input {
    width: 100%;
    padding: 6px 12px 6px 32px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    background: white;
    color: #374151;
    transition: border-color 0.2s ease;
}

.emoji-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .emoji-search-input {
    background: #1f2937;
    border-color: #4b5563;
    color: #f3f4f6;
}

[data-theme="dark"] .emoji-search-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.1);
}

.emoji-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 12px;
    pointer-events: none;
}

[data-theme="dark"] .emoji-search-icon {
    color: #6b7280;
}

/* Scrollbar personalizado */
.emoji-picker-content::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

[data-theme="dark"] .emoji-picker-content::-webkit-scrollbar-track {
    background: #1e293b;
}

.emoji-picker-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

[data-theme="dark"] .emoji-picker-content::-webkit-scrollbar-thumb {
    background: #475569;
}

.emoji-picker-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

[data-theme="dark"] .emoji-picker-content::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Botón de emoji activo */
.emoji-toggle-btn.active {
    background: #e0f2fe !important;
    color: #0369a1 !important;
}

[data-theme="dark"] .emoji-toggle-btn.active {
    background: #1e3a8a !important;
    color: #93c5fd !important;
}

/* Animaciones */
.emoji-picker {
    animation: emojiPickerFadeIn 0.2s ease-out;
}

@keyframes emojiPickerFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Estados hidden */
.emoji-picker.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .emoji-picker {
        width: calc(100vw - 20px);
        max-width: 300px;
        left: 10px !important;
        right: 10px !important;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .emoji-btn {
        font-size: 16px;
        min-height: 28px;
        padding: 4px;
    }
    
    .emoji-category-btn {
        font-size: 14px;
        min-width: 28px;
        height: 28px;
        padding: 4px 6px;
    }
}

/* Estilos para el botón de regreso */
#back-btn {
    transition: all 0.2s ease;
}

#back-btn:hover {
    transform: translateX(-2px);
    background-color: rgba(255, 255, 255, 0.1) !important;
}

#back-btn:active {
    transform: translateX(-1px) scale(0.95);
}

/* Responsive para el botón de regreso */
@media (max-width: 768px) {
    #back-btn {
        /* En móviles, hacer el botón un poco más grande para mejor accesibilidad */
        min-width: 2.5rem;
        min-height: 2.5rem;
    }
    
    #back-btn i {
        font-size: 1.1rem;
    }
}
